From dc8d2ae8b7579d4aa2158e369cd9ac89b82bbcf3 Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Tue, 26 May 2026 23:00:59 +0200 Subject: [PATCH] test(selftests): cover Settings window toggle --- HellionChat/Plugin.cs | 1 + .../SelfTests/SettingsWindowOpenStep.cs | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 HellionChat/SelfTests/SettingsWindowOpenStep.cs 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() { } +}