test(D.2b): close drag-drop spec-review coverage gaps
Add the 3 tests the spec-compliance review flagged: 0x0022 ConfirmMove clears the pending move (no rollback after a confirm); OnDragOver advisory-accepts a closed bag (cap>0, contents not indexed = AP-61); App-level drop -> RollbackMove reverts the optimistic move to the original container+slot. Production code was already correct; these exercise the spec's test plan. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
468da225d3
commit
8df395894e
2 changed files with 52 additions and 0 deletions
|
|
@ -606,6 +606,28 @@ public sealed class GameEventWiringTests
|
|||
Assert.Equal(2, items.Get(0x50000B01u)!.ContainerSlot);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_InventoryPutObjInContainer_ConfirmsOptimisticMove_soNoRollback()
|
||||
{
|
||||
var (d, items, _, _, _) = MakeAll();
|
||||
items.RecordMembership(0x50000B02u, containerId: 0x500000C0u);
|
||||
items.MoveItem(0x50000B02u, 0x500000C0u, 2);
|
||||
items.MoveItemOptimistic(0x50000B02u, 0x500000C1u, 0); // optimistic move (pending snapshot)
|
||||
|
||||
// Server CONFIRMS via InventoryPutObjInContainer (item, container, placement, containerType).
|
||||
byte[] payload = new byte[16];
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(0), 0x50000B02u);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(4), 0x500000C1u);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(8), 0u); // placement
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(12), 0u); // containerType
|
||||
var env = GameEventEnvelope.TryParse(WrapEnvelope(GameEventType.InventoryPutObjInContainer, payload));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
// ConfirmMove cleared the pending snapshot → a later rollback is a no-op (the move stuck).
|
||||
Assert.False(items.RollbackMove(0x50000B02u));
|
||||
Assert.Equal(0x500000C1u, items.Get(0x50000B02u)!.ContainerId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_InventoryPutObjectIn3D_UnparentsFromContainer()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue