test(ui): vitals — toggle verified through the real UiRoot mouse path
Two end-to-end additions to the fixture toggle suite: a body press through UiRoot.OnMouseDown's actual hit test + bubble (left toggles, right toggles), and a press on the authored top drag bar (0x1000063C) arming the window move WITHOUT toggling — the retail Dragbar-consumes-the-press semantics proven against the real input path, not just injected OnEvent calls. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
5337899f3f
commit
7fe83e2bb9
1 changed files with 52 additions and 0 deletions
|
|
@ -189,6 +189,58 @@ public class VitalsDetailToggleTests
|
|||
Assert.NotEqual(RetailUiStateIds.ShowDetail, rootB.ActiveRetailStateId);
|
||||
}
|
||||
|
||||
// ── End-to-end: the REAL mouse path (hit test + bubble) ──────────────────
|
||||
|
||||
[Fact]
|
||||
public void MouseDown_OnWindowBody_TogglesThroughTheRealHitPath()
|
||||
{
|
||||
var (root, vitalsRoot) = MountedWindow();
|
||||
|
||||
// Body press: the stamina meter's center (meters are ClickThrough, so
|
||||
// the hit lands on the window content and bubbles to the vitals root).
|
||||
root.OnMouseDown(UiMouseButton.Left, 90, 59);
|
||||
root.OnMouseUp(UiMouseButton.Left, 90, 59);
|
||||
Assert.Equal(RetailUiStateIds.HideDetail, vitalsRoot.ActiveRetailStateId);
|
||||
|
||||
// Right press toggles too (retail dwParam1 0xA).
|
||||
root.OnMouseDown(UiMouseButton.Right, 90, 59);
|
||||
root.OnMouseUp(UiMouseButton.Right, 90, 59);
|
||||
Assert.Equal(RetailUiStateIds.ShowDetail, vitalsRoot.ActiveRetailStateId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MouseDown_OnTopDragBar_MovesArmWithoutToggling()
|
||||
{
|
||||
var (root, vitalsRoot) = MountedWindow();
|
||||
|
||||
// The authored top drag bar (0x1000063C) spans content-local
|
||||
// (5,0)-(155,5) → canvas y just below the window top. Retail's
|
||||
// Dragbar consumes the press; the toggle must not fire.
|
||||
root.OnMouseDown(UiMouseButton.Left, 90, 32);
|
||||
root.OnMouseUp(UiMouseButton.Left, 90, 32);
|
||||
Assert.NotEqual(RetailUiStateIds.HideDetail, vitalsRoot.ActiveRetailStateId);
|
||||
Assert.NotEqual(RetailUiStateIds.ShowDetail, vitalsRoot.ActiveRetailStateId);
|
||||
}
|
||||
|
||||
private static (UiRoot Root, UiVitalsRoot VitalsRoot) MountedWindow()
|
||||
{
|
||||
var root = new UiRoot { Width = 800, Height = 600 };
|
||||
var layout = FixtureLoader.LoadVitals();
|
||||
RetailWindowFrame.Mount(root, layout.Root, static _ => (0u, 0, 0),
|
||||
new RetailWindowFrame.Options
|
||||
{
|
||||
WindowName = WindowNames.Vitals,
|
||||
Chrome = RetailWindowChrome.Imported,
|
||||
Left = 10f,
|
||||
Top = 30f,
|
||||
ResizeX = true,
|
||||
ResizeY = false,
|
||||
MinWidth = 40f,
|
||||
ContentClickThrough = false,
|
||||
});
|
||||
return (root, Assert.IsType<UiVitalsRoot>(layout.Root));
|
||||
}
|
||||
|
||||
// ── Helpers ──────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Delivers a press to <paramref name="root"/> as UiRoot's bubble
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue