mirror of
https://github.com/osukey/osukey.git
synced 2025-05-21 21:47:31 +09:00
Fix a few more multiplayer test timeouts
These can be tested by adding a `Task.Delay(3000);` at the end of the `MultiplayerClient.JoinRoom` task. The reason is typically that `Client.Room` becomes not-null but the join task still hasn't completed yet, so e.g. the ready button is still disabled.
This commit is contained in:
parent
7906ae2b1d
commit
69a9fc9732
@ -72,7 +72,7 @@ namespace osu.Game.Tests.NonVisual.Multiplayer
|
||||
RoomManager.CreateRoom(newRoom);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for room join", () => Client.Room != null);
|
||||
AddUntilStep("wait for room join", () => RoomJoined);
|
||||
checkPlayingUserCount(1);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for join", () => Client.Room != null);
|
||||
AddUntilStep("wait for join", () => RoomManager.RoomJoined);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -214,7 +214,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddStep("Press select", () => InputManager.Key(Key.Enter));
|
||||
|
||||
AddUntilStep("wait for room open", () => this.ChildrenOfType<MultiplayerMatchSubScreen>().FirstOrDefault()?.IsLoaded == true);
|
||||
AddUntilStep("wait for join", () => client.Room != null);
|
||||
AddUntilStep("wait for join", () => roomManager.RoomJoined);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -293,7 +293,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddStep("join room", () => InputManager.Key(Key.Enter));
|
||||
|
||||
AddUntilStep("wait for room open", () => this.ChildrenOfType<MultiplayerMatchSubScreen>().FirstOrDefault()?.IsLoaded == true);
|
||||
AddUntilStep("wait for join", () => client.Room != null);
|
||||
AddUntilStep("wait for join", () => roomManager.RoomJoined);
|
||||
|
||||
AddAssert("Check participant count correct", () => client.APIRoom?.ParticipantCount.Value == 1);
|
||||
AddAssert("Check participant list contains user", () => client.APIRoom?.RecentParticipants.Count(u => u.Id == API.LocalUser.Value.Id) == 1);
|
||||
@ -351,7 +351,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddStep("press join room button", () => passwordEntryPopover.ChildrenOfType<OsuButton>().First().TriggerClick());
|
||||
|
||||
AddUntilStep("wait for room open", () => this.ChildrenOfType<MultiplayerMatchSubScreen>().FirstOrDefault()?.IsLoaded == true);
|
||||
AddUntilStep("wait for join", () => client.Room != null);
|
||||
AddUntilStep("wait for join", () => roomManager.RoomJoined);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -618,7 +618,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
AddStep("join room", () => InputManager.Key(Key.Enter));
|
||||
AddUntilStep("wait for room open", () => this.ChildrenOfType<MultiplayerMatchSubScreen>().FirstOrDefault()?.IsLoaded == true);
|
||||
AddUntilStep("wait for join", () => client.Room != null);
|
||||
AddUntilStep("wait for join", () => roomManager.RoomJoined);
|
||||
|
||||
AddAssert("local room has correct settings", () =>
|
||||
{
|
||||
@ -644,7 +644,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for join", () => client.Room != null);
|
||||
AddUntilStep("wait for join", () => roomManager.RoomJoined);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
});
|
||||
});
|
||||
|
||||
AddUntilStep("wait for join", () => Client.Room != null);
|
||||
AddUntilStep("wait for join", () => RoomJoined);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -116,7 +116,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for room join", () => Client.Room != null);
|
||||
AddUntilStep("wait for room join", () => RoomJoined);
|
||||
|
||||
AddStep("join other user (ready)", () =>
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for join", () => client.Room != null);
|
||||
AddUntilStep("wait for join", () => multiplayerScreenStack.RoomManager.RoomJoined);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using osu.Framework.Screens;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Screens.OnlinePlay;
|
||||
using osu.Game.Screens.OnlinePlay.Components;
|
||||
using osu.Game.Tests.Visual.Multiplayer;
|
||||
using osu.Game.Tests.Visual.OnlinePlay;
|
||||
@ -76,6 +77,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public new TestMultiplayerRoomManager RoomManager { get; private set; }
|
||||
public TestRoomRequestsHandler RequestsHandler { get; private set; }
|
||||
public new OngoingOperationTracker OngoingOperationTracker => base.OngoingOperationTracker;
|
||||
|
||||
protected override RoomManager CreateRoomManager() => RoomManager = new TestMultiplayerRoomManager(RequestsHandler = new TestRoomRequestsHandler());
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
protected RoomManager RoomManager { get; private set; }
|
||||
|
||||
[Cached]
|
||||
private readonly OngoingOperationTracker ongoingOperationTracker = new OngoingOperationTracker();
|
||||
protected readonly OngoingOperationTracker OngoingOperationTracker = new OngoingOperationTracker();
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private MusicController music { get; set; }
|
||||
@ -75,7 +75,7 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
screenStack = new OnlinePlaySubScreenStack { RelativeSizeAxes = Axes.Both },
|
||||
new Header(ScreenTitle, screenStack),
|
||||
RoomManager,
|
||||
ongoingOperationTracker
|
||||
OngoingOperationTracker
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
protected new MultiplayerTestSceneDependencies OnlinePlayDependencies => (MultiplayerTestSceneDependencies)base.OnlinePlayDependencies;
|
||||
|
||||
public bool RoomJoined => RoomManager.RoomJoined;
|
||||
|
||||
private readonly bool joinRoom;
|
||||
|
||||
protected MultiplayerTestScene(bool joinRoom = true)
|
||||
@ -61,7 +63,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
if (joinRoom)
|
||||
{
|
||||
AddStep("join room", () => RoomManager.CreateRoom(SelectedRoom.Value));
|
||||
AddUntilStep("wait for room join", () => Client.Room != null);
|
||||
AddUntilStep("wait for room join", () => RoomJoined);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Screens.OnlinePlay.Components;
|
||||
@ -15,6 +16,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
/// </summary>
|
||||
public class TestMultiplayerRoomManager : MultiplayerRoomManager
|
||||
{
|
||||
public bool RoomJoined { get; private set; }
|
||||
|
||||
private readonly TestRoomRequestsHandler requestsHandler;
|
||||
|
||||
public TestMultiplayerRoomManager(TestRoomRequestsHandler requestsHandler)
|
||||
@ -24,6 +27,30 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
public IReadOnlyList<Room> ServerSideRooms => requestsHandler.ServerSideRooms;
|
||||
|
||||
public override void CreateRoom(Room room, Action<Room> onSuccess = null, Action<string> onError = null)
|
||||
{
|
||||
base.CreateRoom(room, r =>
|
||||
{
|
||||
onSuccess?.Invoke(r);
|
||||
RoomJoined = true;
|
||||
}, onError);
|
||||
}
|
||||
|
||||
public override void JoinRoom(Room room, string password = null, Action<Room> onSuccess = null, Action<string> onError = null)
|
||||
{
|
||||
base.JoinRoom(room, password, r =>
|
||||
{
|
||||
onSuccess?.Invoke(r);
|
||||
RoomJoined = true;
|
||||
}, onError);
|
||||
}
|
||||
|
||||
public override void PartRoom()
|
||||
{
|
||||
base.PartRoom();
|
||||
RoomJoined = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a room to a local "server-side" list that's returned when a <see cref="GetRoomsRequest"/> is fired.
|
||||
/// </summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user