Files
HellionChat/HellionChat/SelfTests/HonorificHeaderRenderStep.cs
T
JonKazama-Hellion 0109bfd222 test(selftests): add v1.6.0 SelfTest steps from sub-spec
Six new ISelfTestStep entries register with the Dalamud SelfTestRegistry:
SidebarModeAutoSwitch probes the width threshold both above and below the
exact boundary so the >= contract stays pinned; ColorEditorBuffer is a
placeholder until the picker arrives; ConfigMigrationV20 asserts the
schema stamp and the five v20 field defaults; HoverSheenAlloc drives 100
hovered frames against three constant keys and a final un-hover sweep to
exercise the cleanup branch; HonorificHeaderRender runs one Draw call on
the live component to catch IPC fallback crashes; PerformanceBaseline
prints a JSON line of the IO counters so the cycle notes can pick up a
snapshot. MainWindow gets internal accessors so the probes can reach the
sidebar and honorific header without widening the public surface.
2026-05-23 20:35:01 +02:00

47 lines
1.3 KiB
C#

using Dalamud.Bindings.ImGui;
using Dalamud.Plugin.SelfTest;
namespace HellionChat.SelfTests;
// HonorificHeader has to render without crashing whether the Honorific
// plugin is reachable or not. This probe drives the component through
// one Draw call with the live HonorificService state. The fallback
// path (no IPC, no title) renders just the crown — the present-title
// path renders crown + bracketed title — both must survive without an
// exception.
internal sealed class HonorificHeaderRenderStep : ISelfTestStep
{
private readonly Plugin plugin;
public HonorificHeaderRenderStep(Plugin plugin)
{
this.plugin = plugin;
}
public string Name => "Hellion Chat - HonorificHeader render";
public SelfTestStepResult RunStep()
{
var header = plugin.MainWindow.GetHonorificHeaderForSelfTest();
if (header is null)
{
ImGui.Text("MainWindow.HonorificHeader reference is null");
return SelfTestStepResult.Fail;
}
try
{
header.Draw(420f);
}
catch (Exception ex)
{
ImGui.Text($"HonorificHeader.Draw threw: {ex.GetType().Name}: {ex.Message}");
return SelfTestStepResult.Fail;
}
return SelfTestStepResult.Pass;
}
public void CleanUp() { }
}