mirror of
https://github.com/ppy/osu.git
synced 2026-05-27 19:10:35 +08:00
Add failing test scene
This commit is contained in:
@@ -6,11 +6,15 @@ using NUnit.Framework;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Replays;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Replays;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
using osu.Game.Tests.Resources;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
@@ -157,6 +161,37 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddAssert("Jumped forwards", () => Player.GameplayClockContainer.CurrentTime - lastTime > 500);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestReplayDoesNotFailUntilRunningOutOfFrames()
|
||||
{
|
||||
var score = new Score
|
||||
{
|
||||
ScoreInfo = TestResources.CreateTestScoreInfo(Beatmap.Value.BeatmapInfo),
|
||||
Replay = new Replay
|
||||
{
|
||||
Frames =
|
||||
{
|
||||
new OsuReplayFrame(0, Vector2.Zero),
|
||||
new OsuReplayFrame(10000, Vector2.Zero),
|
||||
}
|
||||
}
|
||||
};
|
||||
score.ScoreInfo.Mods = [];
|
||||
score.ScoreInfo.Rank = ScoreRank.F;
|
||||
AddStep("set global state", () =>
|
||||
{
|
||||
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||
Ruleset.Value = Beatmap.Value.BeatmapInfo.Ruleset;
|
||||
SelectedMods.Value = score.ScoreInfo.Mods;
|
||||
});
|
||||
AddStep("create player", () => Player = new TestReplayPlayer(score, showResults: false));
|
||||
AddStep("load player", () => LoadScreen(Player));
|
||||
AddUntilStep("wait for loaded", () => Player.IsCurrentScreen());
|
||||
AddStep("seek to 8000", () => Player.Seek(8000));
|
||||
AddUntilStep("wait for fail", () => Player.GameplayState.HasFailed);
|
||||
AddAssert("player failed after 10000", () => Player.GameplayClockContainer.CurrentTime, () => Is.GreaterThanOrEqualTo(10000));
|
||||
}
|
||||
|
||||
private void loadPlayerWithBeatmap(IBeatmap? beatmap = null)
|
||||
{
|
||||
AddStep("create player", () =>
|
||||
|
||||
Reference in New Issue
Block a user