test(selftests): cover Settings window toggle

This commit is contained in:
2026-05-26 23:00:59 +02:00
parent 22bf1dd110
commit dc8d2ae8b7
2 changed files with 38 additions and 0 deletions
+1
View File
@@ -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),
@@ -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() { }
}