1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00
This commit is contained in:
Dan Balasescu 2023-12-01 21:34:20 +09:00
parent 1b0fc8ca9d
commit f3530a79b1
No known key found for this signature in database
2 changed files with 28 additions and 3 deletions

View File

@ -378,6 +378,31 @@ namespace osu.Game.Tests.Visual.Multiplayer
}, users);
}
[Test]
public void TestAbortMatch()
{
multiplayerClient.Setup(m => m.StartMatch())
.Callback(() =>
{
multiplayerClient.Raise(m => m.LoadRequested -= null);
multiplayerClient.Object.Room!.State = MultiplayerRoomState.WaitingForLoad;
// The local user state doesn't really matter, so let's do the same as the base implementation for these tests.
changeUserState(localUser.UserID, MultiplayerUserState.Idle);
});
multiplayerClient.Setup(m => m.AbortMatch())
.Callback(() =>
{
multiplayerClient.Object.Room!.State = MultiplayerRoomState.Open;
raiseRoomUpdated();
});
ClickButtonWhenEnabled<MultiplayerReadyButton>();
ClickButtonWhenEnabled<MultiplayerReadyButton>();
ClickButtonWhenEnabled<MultiplayerReadyButton>();
}
private void verifyGameplayStartFlow()
{
checkLocalUserState(MultiplayerUserState.Ready);

View File

@ -396,10 +396,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
return Task.CompletedTask;
}
public override Task AbortMatch()
public override async Task AbortMatch()
{
// Todo:
return Task.CompletedTask;
ChangeUserState(api.LocalUser.Value.Id, MultiplayerUserState.Idle);
await ((IMultiplayerClient)this).GameplayAborted(GameplayAbortReason.HostAbortedTheMatch).ConfigureAwait(false);
}
public async Task AddUserPlaylistItem(int userId, MultiplayerPlaylistItem item)