The first sweep matched a character class that swallowed the digit, so a bare B1 slipped through while B1-2 was caught. Searching the whole A-Z space instead of guessing prefixes turned up 130-odd more: B0 through B6, C2, C3, D1, H2, M6, P7, P8, T2, W2, plus GP-04, KB-01, OD-1, PM-1, PM-3, SEC-01, TR-4, TR-7, UI-11, UI-12, XC-8 and API-3. Kept deliberately: 41 B4 01 is a byte signature, "N0" a format string, #L119-L128 a source anchor, LS4/LS6 are linkshells, and A=FF B=0C G=41 R=C2 explains a colour-channel order. Those look like codes and are not. Also translated the eight German comments left in the theme files and ImGuiUtil. Seven of them described what a palette does to which channel, which is worth reading -- just not in a second language in an otherwise English codebase.
97 lines
3.4 KiB
C#
97 lines
3.4 KiB
C#
using Dalamud.Bindings.ImGui;
|
|
using Dalamud.Plugin.SelfTest;
|
|
using HellionChat.Ui.Windows;
|
|
|
|
namespace HellionChat.SelfTests;
|
|
|
|
// window flags. Drives the REAL MainWindow.PreDraw and asserts it wired
|
|
// Window.Flags to ResolveFlags(CanMove, CanResize), then pins the pure
|
|
// fresh-base contract: false/false adds NoMove|NoResize, true/true clears them
|
|
// -- flags must rebuild from a fresh base, or NoMove sticks after toggling
|
|
// back. NoScrollbar|NoScrollWithMouse always present.
|
|
// Non-test caller of ResolveFlags: MainWindow.PreDraw.
|
|
internal sealed class MainWindowFlagsStep : ISelfTestStep
|
|
{
|
|
private readonly Plugin plugin;
|
|
|
|
public MainWindowFlagsStep(Plugin plugin)
|
|
{
|
|
this.plugin = plugin;
|
|
}
|
|
|
|
public string Name => "Hellion Chat - MainWindow flags";
|
|
|
|
public SelfTestStepResult RunStep()
|
|
{
|
|
var window = this.plugin.MainWindow;
|
|
if (window is null)
|
|
{
|
|
ImGui.Text("Plugin.MainWindow is null");
|
|
return SelfTestStepResult.Fail;
|
|
}
|
|
|
|
// Wiring proof: drive the real PreDraw and confirm Flags == the helper's
|
|
// value for the live config. No state mutation needed.
|
|
var savedFlags = window.Flags;
|
|
window.PreDraw();
|
|
var expected = MainWindow.ResolveFlags(
|
|
Plugin.Config.CanMove,
|
|
Plugin.Config.CanResize,
|
|
Plugin.Config.ShowTitleBar
|
|
);
|
|
if (window.Flags != expected)
|
|
{
|
|
ImGui.Text($"PreDraw set Flags {window.Flags}, expected ResolveFlags = {expected}");
|
|
window.Flags = savedFlags;
|
|
return SelfTestStepResult.Fail;
|
|
}
|
|
|
|
// Fresh-base contract: locked window carries NoMove|NoResize ...
|
|
var locked = MainWindow.ResolveFlags(false, false, true);
|
|
if (
|
|
!locked.HasFlag(ImGuiWindowFlags.NoMove)
|
|
|| !locked.HasFlag(ImGuiWindowFlags.NoResize)
|
|
|| !locked.HasFlag(ImGuiWindowFlags.NoScrollbar)
|
|
)
|
|
{
|
|
ImGui.Text(
|
|
$"ResolveFlags(false,false,true) = {locked}, missing NoMove/NoResize/NoScrollbar"
|
|
);
|
|
window.Flags = savedFlags;
|
|
return SelfTestStepResult.Fail;
|
|
}
|
|
|
|
// ... and re-enabling both CLEARS NoMove|NoResize (no accumulation).
|
|
var free = MainWindow.ResolveFlags(true, true, true);
|
|
if (free.HasFlag(ImGuiWindowFlags.NoMove) || free.HasFlag(ImGuiWindowFlags.NoResize))
|
|
{
|
|
ImGui.Text(
|
|
$"ResolveFlags(true,true,true) = {free}, NoMove/NoResize stuck after re-enable"
|
|
);
|
|
window.Flags = savedFlags;
|
|
return SelfTestStepResult.Fail;
|
|
}
|
|
|
|
// title-bar contract: ShowTitleBar=false adds NoTitleBar from the
|
|
// fresh base, true clears it (same no-accumulation guarantee).
|
|
var barHidden = MainWindow.ResolveFlags(true, true, false);
|
|
var barShown = MainWindow.ResolveFlags(true, true, true);
|
|
if (
|
|
!barHidden.HasFlag(ImGuiWindowFlags.NoTitleBar)
|
|
|| barShown.HasFlag(ImGuiWindowFlags.NoTitleBar)
|
|
)
|
|
{
|
|
ImGui.Text(
|
|
$"NoTitleBar wiring wrong: hidden={barHidden} (want NoTitleBar), shown={barShown} (want none)"
|
|
);
|
|
window.Flags = savedFlags;
|
|
return SelfTestStepResult.Fail;
|
|
}
|
|
|
|
window.Flags = savedFlags;
|
|
return SelfTestStepResult.Pass;
|
|
}
|
|
|
|
public void CleanUp() { }
|
|
}
|