feat(ui): complete retail cursor state machine

Port every reachable ClientUISystem cursor branch through the production DAT enum map, preserve global-default versus widget-local event ordering, and surface the registered OS fallback. Route all four toolbar stance indicators through the same combat toggle command as the key binding, with golden DAT and transition conformance coverage.

Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-11 08:31:40 +02:00
parent 05f6222865
commit 6fcc510d5d
16 changed files with 535 additions and 164 deletions

View file

@ -0,0 +1,62 @@
using AcDream.App.Rendering;
using AcDream.App.UI;
namespace AcDream.App.Tests.UI;
public sealed class RetailCursorManagerTests
{
private static readonly UiCursorMedia WidgetA = new(0x06001001u, 1, 2);
private static readonly UiCursorMedia WidgetB = new(0x06001002u, 3, 4);
[Fact]
public void InitialState_appliesGlobalDefaultThenWidgetOverride()
{
var plan = RetailCursorManager.PlanApplication(
hasLayerState: false,
previousGlobal: default,
previousWidget: default,
currentGlobal: RetailGlobalCursorKind.Default,
currentWidget: WidgetA);
Assert.Equal(new[] { RetailCursorLayer.Global, RetailCursorLayer.Widget }, plan);
}
[Fact]
public void GlobalChange_reassertsDefaultWithoutReapplyingUnchangedWidget()
{
var plan = RetailCursorManager.PlanApplication(
hasLayerState: true,
previousGlobal: RetailGlobalCursorKind.Default,
previousWidget: WidgetA,
currentGlobal: RetailGlobalCursorKind.TargetPending,
currentWidget: WidgetA);
Assert.Equal(new[] { RetailCursorLayer.Global }, plan);
}
[Fact]
public void LaterWidgetTransition_overridesUnchangedGlobalDefault()
{
var plan = RetailCursorManager.PlanApplication(
hasLayerState: true,
previousGlobal: RetailGlobalCursorKind.TargetPending,
previousWidget: WidgetA,
currentGlobal: RetailGlobalCursorKind.TargetPending,
currentWidget: WidgetB);
Assert.Equal(new[] { RetailCursorLayer.Widget }, plan);
}
[Fact]
public void ClearingWidgetCursor_restoresGlobalDefault()
{
var plan = RetailCursorManager.PlanApplication(
hasLayerState: true,
previousGlobal: RetailGlobalCursorKind.TargetPending,
previousWidget: WidgetA,
currentGlobal: RetailGlobalCursorKind.TargetPending,
currentWidget: default);
Assert.Equal(new[] { RetailCursorLayer.Global }, plan);
}
}