Fix lead in tests not waiting for player to start running

The tests are only meant to ensure that gameplay eventually starts.

The case where failures can occur is where the master clock is behind
the player clock (due to being in lead-in time). Because the test is
running in real-time, it can take arbitrary amounts of time to catch up.

If it took too long, the test would fail.
This commit is contained in:
Dean Herbert 2022-08-25 17:58:15 +09:00
parent ddb434f47a
commit a8c699610a

View File

@ -400,7 +400,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddUntilStep("wait for clock running", () => getInstance(PLAYER_1_ID).SpectatorPlayerClock.IsRunning);
assertNotCatchingUp(PLAYER_1_ID);
assertRunning(PLAYER_1_ID);
waitForRunning(PLAYER_1_ID);
}
private void loadSpectateScreen(bool waitForPlayerLoad = true, Action<WorkingBeatmap>? applyToBeatmap = null)
@ -486,6 +486,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
private void assertRunning(int userId)
=> AddAssert($"{nameof(assertRunning)}({userId})", () => getInstance(userId).SpectatorPlayerClock.IsRunning);
private void waitForRunning(int userId)
=> AddUntilStep($"{nameof(waitForRunning)}({userId})", () => getInstance(userId).SpectatorPlayerClock.IsRunning);
private void assertNotCatchingUp(int userId)
=> AddAssert($"{nameof(assertNotCatchingUp)}({userId})", () => !getInstance(userId).SpectatorPlayerClock.IsCatchingUp);