mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 00:52:59 +08:00
Merge pull request #15107 from smoogipoo/fix-multiplayer-tests
Fix intermittent multiplayer tests
This commit is contained in:
commit
9a3b13a0c4
@ -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) =>
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user