Fix gameplay proceeding when no frames have been received yet

This commit is contained in:
Dean Herbert 2020-10-27 18:28:49 +09:00
parent d4467d20a2
commit b3d793a505
2 changed files with 21 additions and 0 deletions

View File

@ -56,6 +56,9 @@ namespace osu.Game.Tests.Visual.Gameplay
public void TestBasicSpectatingFlow()
{
loadSpectatingScreen();
AddAssert("screen hasn't changed", () => Stack.CurrentScreen is Spectator);
AddStep("start play", () => testSpectatorStreamingClient.StartPlay());
sendFrames();
@ -73,6 +76,18 @@ namespace osu.Game.Tests.Visual.Gameplay
AddAssert("game is paused", () => player.ChildrenOfType<DrawableRuleset>().First().IsPaused.Value);
}
[Test]
public void TestPlayStartsWithNoFrames()
{
loadSpectatingScreen();
AddStep("start play", () => testSpectatorStreamingClient.StartPlay());
AddUntilStep("wait for player", () => Stack.CurrentScreen is Player);
AddUntilStep("game is paused", () => player.ChildrenOfType<DrawableRuleset>().First().IsPaused.Value);
}
[Test]
public void TestSpectatingDuringGameplay()
{

View File

@ -162,6 +162,12 @@ namespace osu.Game.Rulesets.Replays
// if we didn't change frames, we need to ensure we are allowed to run frames in between, else return null.
}
}
else
{
// if we never received frames and are expecting to, block.
if (!replay.HasReceivedAllFrames)
return null;
}
return CurrentTime = time;
}