mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Better fix for intermittent multiplayer tests
This commit is contained in:
@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
protected new MultiplayerTestSceneDependencies OnlinePlayDependencies => (MultiplayerTestSceneDependencies)base.OnlinePlayDependencies;
|
||||
|
||||
public bool RoomJoined => RoomManager.RoomJoined;
|
||||
public bool RoomJoined => Client.RoomJoined;
|
||||
|
||||
private readonly bool joinRoom;
|
||||
|
||||
|
@ -31,9 +31,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
private readonly Bindable<bool> isConnected = new Bindable<bool>(true);
|
||||
|
||||
public new Room? APIRoom => base.APIRoom;
|
||||
|
||||
public Action<MultiplayerRoom>? RoomSetupAction;
|
||||
|
||||
public bool RoomJoined { get; private set; }
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; } = null!;
|
||||
|
||||
@ -49,7 +50,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
private MultiplayerPlaylistItem? currentItem => Room?.Playlist[currentIndex];
|
||||
private int currentIndex;
|
||||
|
||||
private long lastPlaylistItemId;
|
||||
|
||||
public TestMultiplayerClient(TestMultiplayerRoomManager roomManager)
|
||||
@ -217,9 +217,15 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
// emulate the server sending this after the join room. scheduler required to make sure the join room event is fired first (in Join).
|
||||
changeMatchType(Room.Settings.MatchType).Wait();
|
||||
|
||||
RoomJoined = true;
|
||||
}
|
||||
|
||||
protected override Task LeaveRoomInternal() => Task.CompletedTask;
|
||||
protected override Task LeaveRoomInternal()
|
||||
{
|
||||
RoomJoined = false;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override Task TransferHost(int userId) => ((IMultiplayerClient)this).HostChanged(userId);
|
||||
|
||||
|
@ -17,8 +17,6 @@ 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)
|
||||
@ -29,28 +27,10 @@ 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);
|
||||
}
|
||||
=> base.CreateRoom(room, r => onSuccess?.Invoke(r), 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;
|
||||
}
|
||||
=> base.JoinRoom(room, password, r => onSuccess?.Invoke(r), onError);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a room to a local "server-side" list that's returned when a <see cref="GetRoomsRequest"/> is fired.
|
||||
|
Reference in New Issue
Block a user