mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
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:
@ -400,7 +400,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddUntilStep("wait for clock running", () => getInstance(PLAYER_1_ID).SpectatorPlayerClock.IsRunning);
|
AddUntilStep("wait for clock running", () => getInstance(PLAYER_1_ID).SpectatorPlayerClock.IsRunning);
|
||||||
|
|
||||||
assertNotCatchingUp(PLAYER_1_ID);
|
assertNotCatchingUp(PLAYER_1_ID);
|
||||||
assertRunning(PLAYER_1_ID);
|
waitForRunning(PLAYER_1_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadSpectateScreen(bool waitForPlayerLoad = true, Action<WorkingBeatmap>? applyToBeatmap = null)
|
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)
|
private void assertRunning(int userId)
|
||||||
=> AddAssert($"{nameof(assertRunning)}({userId})", () => getInstance(userId).SpectatorPlayerClock.IsRunning);
|
=> 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)
|
private void assertNotCatchingUp(int userId)
|
||||||
=> AddAssert($"{nameof(assertNotCatchingUp)}({userId})", () => !getInstance(userId).SpectatorPlayerClock.IsCatchingUp);
|
=> AddAssert($"{nameof(assertNotCatchingUp)}({userId})", () => !getInstance(userId).SpectatorPlayerClock.IsCatchingUp);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user