mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 19:53:23 +08:00
Setup start/stop requests
This commit is contained in:
parent
1f01714ec2
commit
ca44d2c4dc
@ -66,6 +66,23 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
raiseRoomUpdated();
|
raiseRoomUpdated();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
multiplayerClient.Setup(m => m.SendMatchRequest(It.IsAny<MatchUserRequest>()))
|
||||||
|
.Callback((MatchUserRequest request) =>
|
||||||
|
{
|
||||||
|
switch (request)
|
||||||
|
{
|
||||||
|
case StartMatchCountdownRequest countdownStart:
|
||||||
|
multiplayerRoom.Countdown = new MatchStartCountdown { TimeRemaining = countdownStart.Duration };
|
||||||
|
raiseRoomUpdated();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case StopCountdownRequest _:
|
||||||
|
multiplayerRoom.Countdown = null;
|
||||||
|
raiseRoomUpdated();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
ongoingOperationTracker,
|
ongoingOperationTracker,
|
||||||
@ -151,6 +168,13 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
InputManager.Click(MouseButton.Left);
|
InputManager.Click(MouseButton.Left);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddStep("check request received", () =>
|
||||||
|
{
|
||||||
|
multiplayerClient.Verify(m => m.SendMatchRequest(It.Is<StartMatchCountdownRequest>(req =>
|
||||||
|
req.Duration == TimeSpan.FromSeconds(10)
|
||||||
|
)), Times.Once);
|
||||||
|
});
|
||||||
|
|
||||||
ClickButtonWhenEnabled<MultiplayerCountdownButton>();
|
ClickButtonWhenEnabled<MultiplayerCountdownButton>();
|
||||||
AddStep("click the cancel button", () =>
|
AddStep("click the cancel button", () =>
|
||||||
{
|
{
|
||||||
@ -159,8 +183,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
InputManager.Click(MouseButton.Left);
|
InputManager.Click(MouseButton.Left);
|
||||||
});
|
});
|
||||||
|
|
||||||
// AddStep("finish countdown", skipToEndOfCountdown);
|
AddStep("check request received", () =>
|
||||||
AddUntilStep("match not started", () => MultiplayerClient.LocalUser?.State == MultiplayerUserState.Ready);
|
{
|
||||||
|
multiplayerClient.Verify(m => m.SendMatchRequest(It.IsAny<StopCountdownRequest>()), Times.Once);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
Loading…
Reference in New Issue
Block a user