fix(runtime): restore interaction completion ownership
Preserve prepublication local motion completion, require the PartArray enter-world lifecycle port, and balance deferred Use busy ownership across dispatch and cancellation. Reconcile the completed GameWindow connected gates and add regression coverage. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
5c955c36ec
commit
f9736ece6c
26 changed files with 675 additions and 68 deletions
|
|
@ -0,0 +1,57 @@
|
|||
using AcDream.App.Input;
|
||||
using AcDream.Core.Physics;
|
||||
|
||||
namespace AcDream.App.Tests.Input;
|
||||
|
||||
public sealed class LocalPlayerControllerSlotTests
|
||||
{
|
||||
[Fact]
|
||||
public void MotionPreparation_RoutesCompletionWithoutPublishingController()
|
||||
{
|
||||
var slot = new LocalPlayerControllerSlot();
|
||||
ILocalPlayerMotionSource source = slot;
|
||||
var controller = new PlayerMovementController(new PhysicsEngine());
|
||||
controller.Motion.AddToQueue(0, MotionCommand.Ready, 0);
|
||||
|
||||
using (slot.BeginMotionPreparation(controller))
|
||||
{
|
||||
Assert.Null(slot.Controller);
|
||||
MotionInterpreter? owner = source.Motion;
|
||||
Assert.Same(controller.Motion, owner);
|
||||
|
||||
owner!.MotionDone(MotionCommand.Ready, success: true);
|
||||
Assert.False(controller.Motion.MotionsPending());
|
||||
}
|
||||
|
||||
Assert.Null(source.Motion);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MotionPreparation_HandsOffToCommittedControllerOnDispose()
|
||||
{
|
||||
var slot = new LocalPlayerControllerSlot();
|
||||
ILocalPlayerMotionSource source = slot;
|
||||
var controller = new PlayerMovementController(new PhysicsEngine());
|
||||
|
||||
using (slot.BeginMotionPreparation(controller))
|
||||
{
|
||||
slot.Controller = controller;
|
||||
Assert.Same(controller.Motion, source.Motion);
|
||||
}
|
||||
|
||||
Assert.Same(controller.Motion, source.Motion);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MotionPreparation_RejectsConcurrentCandidate()
|
||||
{
|
||||
var slot = new LocalPlayerControllerSlot();
|
||||
var first = new PlayerMovementController(new PhysicsEngine());
|
||||
var second = new PlayerMovementController(new PhysicsEngine());
|
||||
|
||||
using IDisposable preparation = slot.BeginMotionPreparation(first);
|
||||
|
||||
Assert.Throws<InvalidOperationException>(
|
||||
() => slot.BeginMotionPreparation(second));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue