refactor(runtime): close canonical gameplay ownership
Unify the toolbar shortcut manager with Runtime inventory state, route retail-ordered shortcut and spellbook command effects through the canonical owners, and make retained controllers borrow those exact instances. Remove the item-interaction transaction fallback and add graphical/no-window parity plus failure-safe terminal ownership-ledger coverage. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
ce6fae7b38
commit
89e6b207f8
36 changed files with 1433 additions and 251 deletions
|
|
@ -41,4 +41,41 @@ public class ShortcutStoreTests
|
|||
store.SetItem(18, 1u); // no-op, no throw
|
||||
store.Remove(-1); // no-op, no throw
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RevisionObserversAndDisposalTrackTheOneCanonicalSlotMap()
|
||||
{
|
||||
var store = new ShortcutStore();
|
||||
int observed = 0;
|
||||
store.Changed += () => throw new InvalidOperationException("observer");
|
||||
store.Changed += () => observed++;
|
||||
|
||||
store.Load([new ShortcutEntry(2, 0x5001u, 0u)]);
|
||||
|
||||
Assert.Equal(1, observed);
|
||||
Assert.Equal(1, store.Revision);
|
||||
Assert.Equal(1, store.DispatchFailureCount);
|
||||
Assert.Equal(2, store.SubscriberCount);
|
||||
Assert.Equal(1, store.Count);
|
||||
|
||||
store.Set(new ShortcutEntry(2, 0x5001u, 0u));
|
||||
Assert.Equal(1, store.Revision);
|
||||
Assert.Equal(1, observed);
|
||||
|
||||
store.Set(new ShortcutEntry(2, 0x5002u, 0u));
|
||||
Assert.Equal(2, store.Revision);
|
||||
Assert.Equal(2, observed);
|
||||
|
||||
store.Dispose();
|
||||
store.Dispose();
|
||||
|
||||
Assert.True(store.IsDisposed);
|
||||
Assert.Empty(store.Items);
|
||||
Assert.Equal(0, store.SubscriberCount);
|
||||
Assert.Equal(3, observed);
|
||||
Assert.Equal(3, store.Revision);
|
||||
Assert.Equal(3, store.DispatchFailureCount);
|
||||
Assert.Throws<ObjectDisposedException>(
|
||||
() => store.SetItem(1, 1u));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue