fix(ui): OP8 rework — activation/scope preservation, camera-row de-alias, conflict-confirm dialog

Fixes the three MUST-FIX findings from the 2026-08-11 combined dual-lens
review of commit b4edee97 (docs/research/2026-08-11-op8-review.md).

M1 — SetForAction destroyed ActivationType/InputScope on every write,
collapsing walk-mode's Hold, the three combat-scoped bindings, and
CameraInstantMouseLook's mouse chord the instant a row (including
Defaults, which touches all ~140 mapped rows at once) wrote back.
Widened the Bindings seam to carry the full Binding (chord + activation
+ scope), not a bare chord: KeyboardConfigController captures each
row's live Activation/Scope ONCE at build time (every multi-chord
action in KeyBindings.RetailDefaults() shares one pair across all its
bindings) and reapplies it on every write — rebind, Cancel/Revert, and
Defaults (which restores DAT-sourced KEYS only, never touches the
pair). New tests pin this across both Defaults and Cancel for a
Hold+MeleeCombat-scoped action.

M2 — InputMap 0x5 (CameraControls) and 0x6 (CameraAlternateControls)
aliased one InputAction each: both rows read/wrote the same live target,
so they showed identical stale chords, a rebind of one silently wiped
the other, and a row could conflict with its own twin. Building real
per-scheme dual-binding storage (or new InputAction members plus the
camera-dispatch code to consume them) is a feature, not a one-line fix.
Chose the third option: only ctx 0x5 — the scheme RetailDefaults()
actually has live support for — maps to InputAction; ctx 0x6 falls
through to the existing unmapped/store-only path (AP-203), fully
rendered, bindable, and persisted, honestly carrying no live effect.
This also retired 10 stale allowlist entries in the DAT-vs-
RetailDefaults() round-trip test: with the alias gone, ctx 0x5 alone
matches RetailDefaults() exactly for all twelve Camera actions.

M3 — the auto-reassign-on-conflict path was wired silent in production
(NotifyReassigned: _ => "") though the contract asked for a prompt and
retail confirms before overwriting (OpenOverwriteBindingDialog). Wired
a real confirm dialog through RetailDialogFactory.MakeConfirmation —
the same seam GameplayConfirmationController already uses — read
lazily since DialogFactory mounts after MountKeyboardConfig in
Initialize()'s order. Only reassigns on accept; decline leaves every
row untouched. AP-204 (which recorded the narrowing) is RETIRED; the
still-true OK/Cancel left-click-vs-right-click-release note moves to a
code comment (zero observable difference, doesn't warrant a register
row). Reverted the gate script's step 9 from documenting the silent
shape back to the real confirm-prompt behavior.

SHOULD-FIX addressed as one-liners in files already touched:
- S1: non-user-bindable conflicts are now checked BEFORE any row
  conflict (retail's own order), and ALL conflicting rows are collected
  (N-way), not just the first match.
- S3: Save wraps the file-write pair in the same try/catch
  RuntimeKeyBindingTarget.Apply already uses for keybinds.json.
- S4: assigning "Mapping 3" on a row with no existing bindings now
  lands on display index 2, not index 0 — ReplaceSlotValue trims only
  TRAILING empty slots instead of stripping every default(KeyChord).
  Right-click on an already-empty slot is now a no-op instead of
  shifting later bindings.
- S6: UiButton.OnRightClick returns false (unhandled, bubbles to
  parent) when no handler is set, disabled or not — matching the
  pre-existing behavior the class doc already claimed.

Left for a future pass (not one-liners): S2 (ActionMap.ConflictingMaps
is still unread — the conflict scan treats all 306 rows as one flat
universe instead of respecting the DAT's own legitimately-shared-key
table) and S5 (the ~330 DAT layout imports still run eagerly at mount
instead of lazily on first open).

19 KeyboardConfigControllerTests (was 12): +2 activation/scope
preservation (Defaults, Cancel), +1 camera de-alias, +2 confirm-dialog
accept/decline, +1 non-bindable-takes-priority-over-row-conflict, +1
sparse-row third-slot placement. Full solution suite 13,154 passed / 4
skipped / 0 failed (this round's baseline 13,147/4/0, zero regressions).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-11 09:53:10 +02:00
parent b4edee970f
commit b1968ce980
8 changed files with 521 additions and 163 deletions

View file

@ -16,6 +16,13 @@ namespace AcDream.App.Tests.UI.Layout;
/// so the behavioral assertions stay focused. Live-DAT row-count/label conformance
/// lives in <c>AcDream.Core.Tests.Input.RetailActionMapReaderTests</c> and
/// <c>RetailActionIdentityRoundTripTests</c>.
///
/// <para>
/// Reworked at the 2026-08-11 combined review (M1/M2/M3/S1/S4): the seam now
/// carries <see cref="Binding"/> (chord + activation + scope), the M2 fix means
/// only ONE camera InputMap context maps live, and conflicts open a real confirm
/// dialog instead of auto-reassigning silently.
/// </para>
/// </summary>
public sealed class KeyboardConfigControllerTests
{
@ -51,14 +58,15 @@ public sealed class KeyboardConfigControllerTests
private sealed class FakeBindings
{
public Dictionary<InputAction, List<KeyChord>> Mapped { get; } = new();
public Dictionary<InputAction, List<Binding>> Mapped { get; } = new();
public Dictionary<(uint, uint), List<KeyChord>> Unmapped { get; } = new();
public List<(InputAction Action, IReadOnlyList<KeyChord> Value)> MappedSets { get; } = new();
public List<(InputAction Action, IReadOnlyList<Binding> Value)> MappedSets { get; } = new();
public List<((uint, uint) Row, IReadOnlyList<KeyChord> Value)> UnmappedSets { get; } = new();
public List<string> Messages { get; } = new();
public int SaveCalls { get; private set; }
public int ToggleCalls { get; private set; }
public Action<KeyChord?>? PendingCapture { get; private set; }
public (string Message, Action<bool> OnResult)? PendingConfirm { get; private set; }
public void Capture(KeyChord? chord)
{
@ -67,8 +75,15 @@ public sealed class KeyboardConfigControllerTests
cb?.Invoke(chord);
}
public void RespondToConfirm(bool accept)
{
var pending = PendingConfirm ?? throw new InvalidOperationException("no pending confirm");
PendingConfirm = null;
pending.OnResult(accept);
}
public KeyboardConfigController.Bindings ToBindings() => new(
CurrentForAction: a => Mapped.TryGetValue(a, out var v) ? v : Array.Empty<KeyChord>(),
CurrentForAction: a => Mapped.TryGetValue(a, out var v) ? v : Array.Empty<Binding>(),
SetForAction: (a, v) =>
{
Mapped[a] = v.ToList();
@ -85,7 +100,7 @@ public sealed class KeyboardConfigControllerTests
Toggle: () => ToggleCalls++,
DisplaySystemMessage: msg => Messages.Add(msg),
NonBindableRefusalText: "cannot overwrite",
NotifyReassigned: label => $"reassigned from {label}");
ConfirmOverwrite: (message, onResult) => PendingConfirm = (message, onResult));
}
private static readonly KeyChord ChordW = new(Silk.NET.Input.Key.W, ModifierMask.None);
@ -143,7 +158,11 @@ public sealed class KeyboardConfigControllerTests
});
var fake = new FakeBindings();
fake.Mapped[InputAction.MovementForward] = new List<KeyChord> { ChordW, ChordUp };
fake.Mapped[InputAction.MovementForward] = new List<Binding>
{
new(ChordW, InputAction.MovementForward),
new(ChordUp, InputAction.MovementForward),
};
fake.Unmapped[(0x10000006u, 0x100000A0u)] = new List<KeyChord> { ChordA };
ImportedLayout layout = FixtureLoader.LoadKeyboardConfig();
@ -174,7 +193,14 @@ public sealed class KeyboardConfigControllerTests
fake.Capture(ChordW);
Assert.Contains(ChordW, row.Model.Current);
Assert.Contains((InputAction.MovementForward, (IReadOnlyList<KeyChord>)row.Model.Current), fake.MappedSets);
(InputAction Action, IReadOnlyList<Binding> Value) written = Assert.Single(fake.MappedSets);
Assert.Equal(InputAction.MovementForward, written.Action);
Binding onlyBinding = Assert.Single(written.Value);
Assert.Equal(ChordW, onlyBinding.Chord);
// No live binding existed at build time — falls back to the Binding
// record's own defaults (Press/Game), same as before M1.
Assert.Equal(ActivationType.Press, onlyBinding.Activation);
Assert.Equal(InputScope.Game, onlyBinding.Scope);
Assert.Equal("W", row.KeyButtons[0].Label);
}
@ -183,7 +209,7 @@ public sealed class KeyboardConfigControllerTests
{
var snapshot = new RetailActionMapSnapshot(new[] { Row(0x4, 0x29, RetailActionClass.Movement) });
var fake = new FakeBindings();
fake.Mapped[InputAction.MovementForward] = new List<KeyChord> { ChordW };
fake.Mapped[InputAction.MovementForward] = new List<Binding> { new(ChordW, InputAction.MovementForward) };
ImportedLayout layout = FixtureLoader.LoadKeyboardConfig();
KeyboardConfigController controller = KeyboardConfigController.Bind(
layout, snapshot, MakeTemplateResolver(), (_, _) => null, fake.ToBindings())!;
@ -201,7 +227,11 @@ public sealed class KeyboardConfigControllerTests
{
var snapshot = new RetailActionMapSnapshot(new[] { Row(0x4, 0x29, RetailActionClass.Movement) });
var fake = new FakeBindings();
fake.Mapped[InputAction.MovementForward] = new List<KeyChord> { ChordW, ChordUp };
fake.Mapped[InputAction.MovementForward] = new List<Binding>
{
new(ChordW, InputAction.MovementForward),
new(ChordUp, InputAction.MovementForward),
};
ImportedLayout layout = FixtureLoader.LoadKeyboardConfig();
KeyboardConfigController controller = KeyboardConfigController.Bind(
layout, snapshot, MakeTemplateResolver(), (_, _) => null, fake.ToBindings())!;
@ -216,7 +246,55 @@ public sealed class KeyboardConfigControllerTests
}
[Fact]
public void Capture_ConflictWithAnotherRow_AutoReassignsAndNotifies()
public void KeyButtonRightClick_OnAlreadyEmptySlot_IsANoOp()
{
var snapshot = new RetailActionMapSnapshot(new[] { Row(0x4, 0x29, RetailActionClass.Movement) });
var fake = new FakeBindings();
ImportedLayout layout = FixtureLoader.LoadKeyboardConfig();
KeyboardConfigController controller = KeyboardConfigController.Bind(
layout, snapshot, MakeTemplateResolver(), (_, _) => null, fake.ToBindings())!;
KeyboardConfigController.RowView row = controller.Rows.Single();
Assert.Empty(row.Model.Current);
row.KeyButtons[0].OnRightClick!.Invoke();
Assert.Empty(row.Model.Current);
Assert.Empty(fake.MappedSets);
}
/// <summary>S4 (2026-08-11 review): clicking "Mapping 3" (slot index 2) on a
/// row with NO existing bindings must land the captured chord on display
/// index 2, not collapse it onto index 0.</summary>
[Fact]
public void KeyButtonClick_OnSparseRow_ThirdSlotLandsOnThirdButton()
{
var snapshot = new RetailActionMapSnapshot(new[] { Row(0x4, 0x29, RetailActionClass.Movement) });
var fake = new FakeBindings();
ImportedLayout layout = FixtureLoader.LoadKeyboardConfig();
KeyboardConfigController controller = KeyboardConfigController.Bind(
layout, snapshot, MakeTemplateResolver(), (_, _) => null, fake.ToBindings())!;
KeyboardConfigController.RowView row = controller.Rows.Single();
Assert.Equal(3, row.KeyButtons.Count);
Assert.Empty(row.Model.Current);
row.KeyButtons[2].OnClick!.Invoke(); // "Mapping 3"
fake.Capture(ChordW);
Assert.Null(row.KeyButtons[0].Label);
Assert.Null(row.KeyButtons[1].Label);
Assert.Equal("W", row.KeyButtons[2].Label);
// The write to the live seam only ever carries the REAL chord — no
// default(KeyChord) padding leaks into the persisted Binding list.
(InputAction Action, IReadOnlyList<Binding> Value) written = Assert.Single(fake.MappedSets);
Binding onlyBinding = Assert.Single(written.Value);
Assert.Equal(ChordW, onlyBinding.Chord);
}
[Fact]
public void Capture_ConflictWithAnotherRow_OpensConfirmDialog_AcceptReassigns()
{
var snapshot = new RetailActionMapSnapshot(new[]
{
@ -224,7 +302,7 @@ public sealed class KeyboardConfigControllerTests
Row(0x4, 0x2A, RetailActionClass.Movement), // MovementBackup — will hold ChordA
});
var fake = new FakeBindings();
fake.Mapped[InputAction.MovementBackup] = new List<KeyChord> { ChordA };
fake.Mapped[InputAction.MovementBackup] = new List<Binding> { new(ChordA, InputAction.MovementBackup) };
ImportedLayout layout = FixtureLoader.LoadKeyboardConfig();
KeyboardConfigController controller = KeyboardConfigController.Bind(
layout, snapshot, MakeTemplateResolver(), (_, _) => null, fake.ToBindings())!;
@ -235,19 +313,53 @@ public sealed class KeyboardConfigControllerTests
forward.KeyButtons[0].OnClick!.Invoke();
fake.Capture(ChordA); // steal MovementBackup's chord
// M3: nothing is applied yet — a confirm dialog is pending.
Assert.NotNull(fake.PendingConfirm);
Assert.DoesNotContain(ChordA, forward.Model.Current);
Assert.Contains(ChordA, backup.Model.Current);
Assert.Empty(fake.Messages);
fake.RespondToConfirm(true);
Assert.Contains(ChordA, forward.Model.Current);
Assert.DoesNotContain(ChordA, backup.Model.Current);
Assert.Contains(fake.Messages, m => m.Contains("reassigned"));
}
[Fact]
public void Capture_ConflictWithNonBindableAcdreamAction_RefusesAndLeavesBoth()
public void Capture_ConflictWithAnotherRow_DeclineLeavesBothRowsUnchanged()
{
var snapshot = new RetailActionMapSnapshot(new[]
{
Row(0x4, 0x29, RetailActionClass.Movement),
Row(0x4, 0x2A, RetailActionClass.Movement),
});
var fake = new FakeBindings();
fake.Mapped[InputAction.MovementForward] = new List<Binding> { new(ChordW, InputAction.MovementForward) };
fake.Mapped[InputAction.MovementBackup] = new List<Binding> { new(ChordA, InputAction.MovementBackup) };
ImportedLayout layout = FixtureLoader.LoadKeyboardConfig();
KeyboardConfigController controller = KeyboardConfigController.Bind(
layout, snapshot, MakeTemplateResolver(), (_, _) => null, fake.ToBindings())!;
KeyboardConfigController.RowView forward = controller.Rows.Single(r => r.ActionId == 0x29u);
KeyboardConfigController.RowView backup = controller.Rows.Single(r => r.ActionId == 0x2Au);
forward.KeyButtons[0].OnClick!.Invoke();
fake.Capture(ChordA);
fake.RespondToConfirm(false);
Assert.Equal(new[] { ChordW }, forward.Model.Current); // untouched
Assert.Equal(new[] { ChordA }, backup.Model.Current); // untouched
}
[Fact]
public void Capture_ConflictWithNonBindableAcdreamAction_RefusesWithoutADialog()
{
var snapshot = new RetailActionMapSnapshot(new[] { Row(0x4, 0x29, RetailActionClass.Movement) });
var fake = new FakeBindings();
// AcdreamToggleAudioMute has no RetailActionIdentityTable row at all.
var muteChord = new KeyChord(Silk.NET.Input.Key.M, ModifierMask.Ctrl);
fake.Mapped[InputAction.AcdreamToggleAudioMute] = new List<KeyChord> { muteChord };
fake.Mapped[InputAction.AcdreamToggleAudioMute] =
new List<Binding> { new(muteChord, InputAction.AcdreamToggleAudioMute) };
ImportedLayout layout = FixtureLoader.LoadKeyboardConfig();
KeyboardConfigController controller = KeyboardConfigController.Bind(
layout, snapshot, MakeTemplateResolver(), (_, _) => null, fake.ToBindings())!;
@ -256,9 +368,39 @@ public sealed class KeyboardConfigControllerTests
forward.KeyButtons[0].OnClick!.Invoke();
fake.Capture(muteChord);
// S1: refused outright, no confirm dialog offered.
Assert.Null(fake.PendingConfirm);
Assert.DoesNotContain(muteChord, forward.Model.Current);
Assert.Contains("cannot overwrite", fake.Messages);
Assert.Equal(new[] { muteChord }, fake.Mapped[InputAction.AcdreamToggleAudioMute]);
Assert.Equal(muteChord, Assert.Single(fake.Mapped[InputAction.AcdreamToggleAudioMute]).Chord);
}
/// <summary>S1: retail checks the non-user-bindable target BEFORE any
/// user-bindable row conflict, even when both exist for the same chord.</summary>
[Fact]
public void Capture_ConflictWithBothARowAndANonBindableAction_NonBindableWins()
{
var snapshot = new RetailActionMapSnapshot(new[]
{
Row(0x4, 0x29, RetailActionClass.Movement),
Row(0x4, 0x2A, RetailActionClass.Movement),
});
var fake = new FakeBindings();
var sharedChord = new KeyChord(Silk.NET.Input.Key.M, ModifierMask.Ctrl);
fake.Mapped[InputAction.MovementBackup] = new List<Binding> { new(sharedChord, InputAction.MovementBackup) };
fake.Mapped[InputAction.AcdreamToggleAudioMute] =
new List<Binding> { new(sharedChord, InputAction.AcdreamToggleAudioMute) };
ImportedLayout layout = FixtureLoader.LoadKeyboardConfig();
KeyboardConfigController controller = KeyboardConfigController.Bind(
layout, snapshot, MakeTemplateResolver(), (_, _) => null, fake.ToBindings())!;
KeyboardConfigController.RowView forward = controller.Rows.Single(r => r.ActionId == 0x29u);
forward.KeyButtons[0].OnClick!.Invoke();
fake.Capture(sharedChord);
Assert.Null(fake.PendingConfirm);
Assert.Contains("cannot overwrite", fake.Messages);
Assert.DoesNotContain(sharedChord, forward.Model.Current);
}
[Fact]
@ -288,7 +430,7 @@ public sealed class KeyboardConfigControllerTests
{
var snapshot = new RetailActionMapSnapshot(new[] { Row(0x4, 0x29, RetailActionClass.Movement) });
var fake = new FakeBindings();
fake.Mapped[InputAction.MovementForward] = new List<KeyChord> { ChordW };
fake.Mapped[InputAction.MovementForward] = new List<Binding> { new(ChordW, InputAction.MovementForward) };
ImportedLayout layout = FixtureLoader.LoadKeyboardConfig();
KeyboardConfigController controller = KeyboardConfigController.Bind(
layout, snapshot, MakeTemplateResolver(), (_, _) => null, fake.ToBindings())!;
@ -314,7 +456,7 @@ public sealed class KeyboardConfigControllerTests
new[] { new RetailKeyChord(0x11, 0, 0, 3) }), // DIK_W
});
var fake = new FakeBindings();
fake.Mapped[InputAction.MovementForward] = new List<KeyChord> { ChordUp };
fake.Mapped[InputAction.MovementForward] = new List<Binding> { new(ChordUp, InputAction.MovementForward) };
ImportedLayout layout = FixtureLoader.LoadKeyboardConfig();
KeyboardConfigController controller = KeyboardConfigController.Bind(
layout, snapshot, MakeTemplateResolver(), (_, _) => null, fake.ToBindings())!;
@ -329,6 +471,106 @@ public sealed class KeyboardConfigControllerTests
Assert.True(row.Model.Changed); // live but uncommitted, matching retail
}
/// <summary>M1 (2026-08-11 review): Defaults must restore the DAT-sourced
/// KEY only — the row's live Activation/Scope (Hold + MeleeCombat here,
/// captured from the action's live binding at build time) must survive the
/// click unchanged, across the FULL 306-row shape this test represents with
/// one Hold+scoped action.</summary>
[Fact]
public void DefaultsButton_PreservesActivationAndScope_ForAHoldScopedAction()
{
var snapshot = new RetailActionMapSnapshot(new[]
{
Row(0x10000003, 0x1000005D, RetailActionClass.Combat, defaults:
new[] { new RetailKeyChord(0xD3, 0, 0, 3) }), // CombatLowAttack, DIK_DELETE
});
var fake = new FakeBindings();
fake.Mapped[InputAction.CombatLowAttack] = new List<Binding>
{
new(ChordUp, InputAction.CombatLowAttack, ActivationType.Hold, InputScope.MeleeCombat),
};
ImportedLayout layout = FixtureLoader.LoadKeyboardConfig();
KeyboardConfigController controller = KeyboardConfigController.Bind(
layout, snapshot, MakeTemplateResolver(), (_, _) => null, fake.ToBindings())!;
UiButton defaultsButton = (UiButton)layout.FindElement(0x1000002Au)!;
defaultsButton.OnClick!.Invoke();
(InputAction Action, IReadOnlyList<Binding> Value) written = Assert.Single(fake.MappedSets);
Assert.Equal(InputAction.CombatLowAttack, written.Action);
Binding result = Assert.Single(written.Value);
Assert.Equal(Silk.NET.Input.Key.Delete, result.Chord.Key); // the DAT default key
Assert.Equal(ActivationType.Hold, result.Activation); // preserved, not reset to Press
Assert.Equal(InputScope.MeleeCombat, result.Scope); // preserved, not reset to Game
}
/// <summary>M1: Cancel/Revert (RestoreSavedValue) must ALSO preserve
/// Activation/Scope, not just Defaults.</summary>
[Fact]
public void CancelButton_PreservesActivationAndScope()
{
var snapshot = new RetailActionMapSnapshot(new[] { Row(0x4, 0x32, RetailActionClass.Movement) });
var fake = new FakeBindings();
fake.Mapped[InputAction.MovementWalkMode] = new List<Binding>
{
new(ChordW, InputAction.MovementWalkMode, ActivationType.Hold, InputScope.Game),
};
ImportedLayout layout = FixtureLoader.LoadKeyboardConfig();
KeyboardConfigController controller = KeyboardConfigController.Bind(
layout, snapshot, MakeTemplateResolver(), (_, _) => null, fake.ToBindings())!;
KeyboardConfigController.RowView row = controller.Rows.Single();
row.KeyButtons[0].OnClick!.Invoke();
fake.Capture(ChordUp); // uncommitted edit
UiButton cancel = (UiButton)layout.FindElement(0x1000002Du)!;
cancel.OnClick!.Invoke();
// MappedSets also carries the capture's own write (ChordUp) before the
// revert — take the LAST write, which is Cancel's RestoreSavedValue.
(InputAction Action, IReadOnlyList<Binding> Value) written = fake.MappedSets[^1];
Binding result = Assert.Single(written.Value);
Assert.Equal(ChordW, result.Chord); // reverted to saved
Assert.Equal(ActivationType.Hold, result.Activation);
}
/// <summary>M2 (2026-08-11 review): InputMap 0x6 (CameraAlternateControls) no
/// longer aliases InputMap 0x5's (CameraControls) InputAction — each row is
/// independent, so rebinding one never clobbers the other, and a row cannot
/// conflict with its own former twin.</summary>
[Fact]
public void CameraContext5And6_AreIndependentRows_NotAliased()
{
var snapshot = new RetailActionMapSnapshot(new[]
{
Row(0x5, 0x35, RetailActionClass.Camera, defaults: new[] { new RetailKeyChord(0x4B, 0, 0, 3) }),
Row(0x6, 0x35, RetailActionClass.Camera, defaults: new[] { new RetailKeyChord(0xCB, 0, 0, 3) }),
});
var fake = new FakeBindings();
ImportedLayout layout = FixtureLoader.LoadKeyboardConfig();
KeyboardConfigController controller = KeyboardConfigController.Bind(
layout, snapshot, MakeTemplateResolver(), (_, _) => null, fake.ToBindings())!;
KeyboardConfigController.RowView ctx5 = controller.Rows.Single(r => r.InputMapId == 0x5u);
KeyboardConfigController.RowView ctx6 = controller.Rows.Single(r => r.InputMapId == 0x6u);
Assert.Equal(InputAction.CameraRotateLeft, ctx5.MappedAction);
Assert.Null(ctx6.MappedAction); // unmapped — no live dual-binding infrastructure (M2)
// Rebinding ctx5's row must not touch ctx6's storage, and vice versa.
ctx5.KeyButtons[0].OnClick!.Invoke();
fake.Capture(ChordW);
Assert.Contains(ChordW, ctx5.Model.Current);
Assert.Empty(ctx6.Model.Current); // ctx6 never seeded/written by ctx5's edit
Assert.Empty(fake.Unmapped); // ctx6 untouched — only ctx5's mapped write happened
ctx6.KeyButtons[0].OnClick!.Invoke();
fake.Capture(ChordA);
Assert.Contains(ChordA, ctx6.Model.Current);
Assert.Contains(ChordW, ctx5.Model.Current); // ctx5 unaffected by ctx6's edit
Assert.True(fake.Unmapped.ContainsKey((0x6u, 0x35u)));
}
[Fact]
public void Bind_MissingWindowRoot_ReturnsNull()
{

View file

@ -18,11 +18,18 @@ namespace AcDream.Core.Tests.Input;
/// unavailable (CI), matching every other live-DAT conformance test in this project.
///
/// <para>
/// <b>Three real, byte-verified disagreements survive after the mechanism fixes</b>
/// (2026-08-11 investigation — none are bugs in this slice's table; all three are
/// PRE-EXISTING <see cref="KeyBindings.RetailDefaults"/> gaps/design choices this
/// slice does not touch, listed in <see cref="KnownRetailDefaultsDisagreements"/>
/// with citations):
/// <b>Two real, byte-verified disagreements survive after the mechanism fixes</b>
/// (2026-08-11 investigation, updated at the M2 rework — none are bugs in this
/// slice's table; both are PRE-EXISTING <see cref="KeyBindings.RetailDefaults"/>
/// gaps/design choices this slice does not touch, listed in
/// <see cref="KnownRetailDefaultsDisagreements"/> with citations). A THIRD
/// disagreement — ten CameraAlternateControls (InputMap 0x6) actions — was RETIRED
/// at the M2 rework: <see cref="RetailActionIdentityTable"/> no longer maps InputMap
/// 0x6 to any <see cref="InputAction"/> at all (the aliasing that produced two
/// independent rows fighting over one live target — M2, 2026-08-11 review), so this
/// test never sees a ctx-0x6 row and the ctx-0x5-only union now matches
/// <c>RetailDefaults()</c> exactly for all twelve Camera actions with no allowlist
/// entry needed:
/// </para>
/// <list type="number">
/// <item><description><b>MovementWalkMode.</b> The DAT's raw <c>QualifiedControl.Modifier</c>
@ -33,18 +40,6 @@ namespace AcDream.Core.Tests.Input;
/// <c>CurrentModifiers=Shift</c> alongside a Shift key-DOWN event, so the chord must
/// carry the flag to match at dispatch time. Not a disagreement to fix; a raw-DAT
/// artifact this slice's reader faithfully reproduces.</description></item>
/// <item><description><b>Ten CameraAlternateControls (InputMap 0x6) actions.</b> Retail
/// ships TWO camera-control schemes with DIFFERENT default keys: InputMap 0x5's
/// (Numpad: Keypad4/6/8/2 for rotate, KeypadSubtract/Add for zoom, ...) and InputMap
/// 0x6's (Arrow keys: Left/Right/Up/Down for rotate, ...). Both InputMaps' actions
/// share the SAME <see cref="RetailActionClass.Camera"/> bucket and this slice
/// correctly maps BOTH to the same <see cref="InputAction"/> (research doc §5.3: a
/// user can rebind either scheme's row independently). <c>RetailDefaults()</c> — a
/// PRE-EXISTING, OP8-independent file — only carries the Numpad (0x5) scheme; it does
/// not carry the arrow-key (0x6) alternates as SECOND bindings for the same action.
/// This is a genuine <c>RetailDefaults()</c> completeness gap, reported here rather
/// than silently patched into a foundational, heavily-tested file outside this
/// slice's scope (register row filed).</description></item>
/// <item><description><b>Quickslot 1-9's Ctrl+N chord (and its SelectQuickSlot_1-9
/// counterpart).</b> The DAT's own default
/// master map binds Ctrl+1..9 to the SAME action id as bare 1..9 ("Quickslot N" —
@ -67,16 +62,6 @@ public sealed class RetailActionIdentityRoundTripTests
private static readonly HashSet<InputAction> KnownRetailDefaultsDisagreements = new()
{
InputAction.MovementWalkMode,
InputAction.CameraMoveToward,
InputAction.CameraMoveAway,
InputAction.CameraRotateLeft,
InputAction.CameraRotateRight,
InputAction.CameraRotateUp,
InputAction.CameraRotateDown,
InputAction.CameraViewDefault,
InputAction.CameraViewFirstPerson,
InputAction.CameraViewLookDown,
InputAction.CameraViewMapMode,
InputAction.UseQuickSlot_1,
InputAction.UseQuickSlot_2,
InputAction.UseQuickSlot_3,