diff --git a/HellionChat/Plugin.cs b/HellionChat/Plugin.cs index e271a68..4f987ca 100755 --- a/HellionChat/Plugin.cs +++ b/HellionChat/Plugin.cs @@ -344,6 +344,7 @@ public sealed class Plugin : IAsyncDalamudPlugin new SelfTests.SidebarModeAutoSwitchStep(this), new SelfTests.ColorEditorBufferStep(this), new SelfTests.ThemePickerCategoryStep(this), + new SelfTests.SettingsWindowOpenStep(this), new SelfTests.ConfigMigrationV20Step(this), new SelfTests.HoverSheenAllocStep(this), new SelfTests.HonorificHeaderRenderStep(this), diff --git a/HellionChat/SelfTests/SettingsWindowOpenStep.cs b/HellionChat/SelfTests/SettingsWindowOpenStep.cs new file mode 100644 index 0000000..628dbd2 --- /dev/null +++ b/HellionChat/SelfTests/SettingsWindowOpenStep.cs @@ -0,0 +1,37 @@ +using Dalamud.Bindings.ImGui; +using Dalamud.Plugin.SelfTest; + +namespace HellionChat.SelfTests; + +internal sealed class SettingsWindowOpenStep : ISelfTestStep +{ + private readonly Plugin _plugin; + + public SettingsWindowOpenStep(Plugin plugin) + { + _plugin = plugin; + } + + public string Name => "Hellion Chat - Settings window toggles via direct call"; + + public SelfTestStepResult RunStep() + { + var initial = _plugin.SettingsWindow.IsOpen; + _plugin.SettingsWindow.Toggle(); + var afterFirst = _plugin.SettingsWindow.IsOpen; + _plugin.SettingsWindow.Toggle(); + var afterSecond = _plugin.SettingsWindow.IsOpen; + + if (afterFirst == initial || afterSecond != initial) + { + ImGui.Text( + $"Toggle did not flip state: initial={initial} after1={afterFirst} after2={afterSecond}" + ); + return SelfTestStepResult.Fail; + } + + return SelfTestStepResult.Pass; + } + + public void CleanUp() { } +}