Files
HellionChat/HellionChat/SelfTests/MainWindowFocusOpacityStep.cs
T
JonKazama-Hellion 16557213cd chore: comments, second pass -- the task codes the first pass missed
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.
2026-08-19 22:03:12 +02:00

55 lines
1.9 KiB
C#

using Dalamud.Bindings.ImGui;
using Dalamud.Plugin.SelfTest;
namespace HellionChat.SelfTests;
// focus opacity. Pins the pure ResolveBgAlpha contract (focused →
// WindowOpacity, unfocused → WindowOpacityInactive). The PreDraw wiring
// (BgAlpha = ResolveBgAlpha(IsFocused) behind the main-viewport/!docked guard)
// is NOT headless-deterministic — the guard may leave BgAlpha null when
// LastViewport is stale on a /xlperf frame — so the wiring is verified by the
// reviewer grep (ResolveBgAlpha has a non-test caller: MainWindow.PreDraw) and
// the visible transparency by in-game smoke, not by driving PreDraw here.
internal sealed class MainWindowFocusOpacityStep : ISelfTestStep
{
private readonly Plugin plugin;
public MainWindowFocusOpacityStep(Plugin plugin)
{
this.plugin = plugin;
}
public string Name => "Hellion Chat - MainWindow focus opacity";
public SelfTestStepResult RunStep()
{
var window = this.plugin.MainWindow;
if (window is null)
{
ImGui.Text("Plugin.MainWindow is null");
return SelfTestStepResult.Fail;
}
// Contract: focused returns the focused opacity, unfocused the inactive one.
if (window.ResolveBgAlpha(true) != Plugin.Config.WindowOpacity)
{
ImGui.Text(
$"ResolveBgAlpha(true) = {window.ResolveBgAlpha(true)}, expected {Plugin.Config.WindowOpacity}"
);
return SelfTestStepResult.Fail;
}
if (window.ResolveBgAlpha(false) != Plugin.Config.WindowOpacityInactive)
{
ImGui.Text(
$"ResolveBgAlpha(false) = {window.ResolveBgAlpha(false)}, expected {Plugin.Config.WindowOpacityInactive}"
);
return SelfTestStepResult.Fail;
}
return SelfTestStepResult.Pass;
}
public void CleanUp() { }
}