Ensure players are always on both leaderboard teams

In a very rare case, the randomisation may cause all users to be on one
team, causing a test failure. The odds make it basically impossible, but
if adjusting the number of users in the test scene this can more readily
be hit.
This commit is contained in:
Dean Herbert 2022-04-12 11:46:21 +09:00
parent ebee9e6888
commit 577e29351e
1 changed files with 3 additions and 2 deletions

View File

@ -3,7 +3,6 @@
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Utils;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
using osu.Game.Rulesets.Osu.Scoring;
@ -14,12 +13,14 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
public class TestSceneMultiplayerGameplayLeaderboardTeams : MultiplayerGameplayLeaderboardTestScene
{
private int team;
protected override MultiplayerRoomUser CreateUser(int userId)
{
var user = base.CreateUser(userId);
user.MatchState = new TeamVersusUserState
{
TeamID = RNG.Next(0, 2)
TeamID = team++ % 2
};
return user;
}