1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 08:27:49 +08:00

Fix countdown button being enabled

This commit is contained in:
Dan Balasescu 2023-12-04 11:00:11 +09:00
parent 9ccd33a1ec
commit 8587652869
No known key found for this signature in database
2 changed files with 21 additions and 14 deletions

View File

@ -381,28 +381,32 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Test]
public void TestAbortMatch()
{
multiplayerClient.Setup(m => m.StartMatch())
.Callback(() =>
{
multiplayerClient.Raise(m => m.LoadRequested -= null);
multiplayerClient.Object.Room!.State = MultiplayerRoomState.WaitingForLoad;
AddStep("setup client", () =>
{
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);
});
// 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();
});
multiplayerClient.Setup(m => m.AbortMatch())
.Callback(() =>
{
multiplayerClient.Object.Room!.State = MultiplayerRoomState.Open;
raiseRoomUpdated();
});
});
// Ready
ClickButtonWhenEnabled<MultiplayerReadyButton>();
// Start match
ClickButtonWhenEnabled<MultiplayerReadyButton>();
AddUntilStep("countdown button disabled", () => !this.ChildrenOfType<MultiplayerCountdownButton>().Single().Enabled.Value);
// Abort
ClickButtonWhenEnabled<MultiplayerReadyButton>();

View File

@ -223,6 +223,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
if (!Client.IsHost)
readyButton.Enabled.Value &= Room.State == MultiplayerRoomState.Open;
// At all times, the countdown button should only be enabled when no match is in progress.
countdownButton.Enabled.Value &= Room.State == MultiplayerRoomState.Open;
if (newCountReady == countReady)
return;