test(selftests): cover Settings window toggle
This commit is contained in:
@@ -344,6 +344,7 @@ public sealed class Plugin : IAsyncDalamudPlugin
|
|||||||
new SelfTests.SidebarModeAutoSwitchStep(this),
|
new SelfTests.SidebarModeAutoSwitchStep(this),
|
||||||
new SelfTests.ColorEditorBufferStep(this),
|
new SelfTests.ColorEditorBufferStep(this),
|
||||||
new SelfTests.ThemePickerCategoryStep(this),
|
new SelfTests.ThemePickerCategoryStep(this),
|
||||||
|
new SelfTests.SettingsWindowOpenStep(this),
|
||||||
new SelfTests.ConfigMigrationV20Step(this),
|
new SelfTests.ConfigMigrationV20Step(this),
|
||||||
new SelfTests.HoverSheenAllocStep(this),
|
new SelfTests.HoverSheenAllocStep(this),
|
||||||
new SelfTests.HonorificHeaderRenderStep(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() { }
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user