1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 23:23:04 +08:00

Merge pull request #15107 from smoogipoo/fix-multiplayer-tests

Fix intermittent multiplayer tests
This commit is contained in:
Dean Herbert 2021-10-15 15:43:49 +09:00 committed by GitHub
commit 9a3b13a0c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -374,7 +374,7 @@ namespace osu.Game.Online.Multiplayer
UserJoined?.Invoke(user); UserJoined?.Invoke(user);
RoomUpdated?.Invoke(); RoomUpdated?.Invoke();
}, false); });
} }
Task IMultiplayerClient.UserLeft(MultiplayerRoomUser user) => Task IMultiplayerClient.UserLeft(MultiplayerRoomUser user) =>

View File

@ -53,7 +53,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
public MultiplayerRoomUser AddUser(User user, bool markAsPlaying = false) public MultiplayerRoomUser AddUser(User user, bool markAsPlaying = false)
{ {
var roomUser = new MultiplayerRoomUser(user.Id) { User = user }; var roomUser = new MultiplayerRoomUser(user.Id) { User = user };
((IMultiplayerClient)this).UserJoined(roomUser);
addUser(roomUser);
if (markAsPlaying) if (markAsPlaying)
PlayingUserIds.Add(user.Id); PlayingUserIds.Add(user.Id);
@ -61,7 +62,15 @@ namespace osu.Game.Tests.Visual.Multiplayer
return roomUser; return roomUser;
} }
public void AddNullUser() => ((IMultiplayerClient)this).UserJoined(new MultiplayerRoomUser(TestUserLookupCache.NULL_USER_ID)); public void AddNullUser() => addUser(new MultiplayerRoomUser(TestUserLookupCache.NULL_USER_ID));
private void addUser(MultiplayerRoomUser user)
{
((IMultiplayerClient)this).UserJoined(user).Wait();
// We want the user to be immediately available for testing, so force a scheduler update to run the update-bound continuation.
Scheduler.Update();
}
public void RemoveUser(User user) public void RemoveUser(User user)
{ {