feat(window): wire inactive opacity to main window focus state
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Plugin.SelfTest;
|
||||
|
||||
namespace HellionChat.SelfTests;
|
||||
|
||||
// UI-12 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() { }
|
||||
}
|
||||
Reference in New Issue
Block a user