1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 21:02:56 +08:00

Add failing test of importing failed replay in OsuGame flow

We had a test covering this but it wasn't within `OsuGame` so didn't
have full import blocking coverage (see
cbbe2f9dc0/osu.Game.Tests/Visual/Gameplay/TestScenePlayerLocalScoreImport.cs (L89-L88)).
This commit is contained in:
Dean Herbert 2024-10-03 17:11:25 +09:00
parent 8773c34fdd
commit ecf144f4a5
No known key found for this signature in database

View File

@ -364,6 +364,37 @@ namespace osu.Game.Tests.Visual.Navigation
AddUntilStep("wait for player", () => Game.ScreenStack.CurrentScreen != getOriginalPlayer() && Game.ScreenStack.CurrentScreen is Player);
}
[Test]
public void TestSaveFailedReplay()
{
Player player = null;
Screens.Select.SongSelect songSelect = null;
PushAndConfirm(() => songSelect = new TestPlaySongSelect());
AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded);
AddStep("import beatmap", () => BeatmapImportHelper.LoadOszIntoOsu(Game, virtualTrack: true).WaitSafely());
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
AddStep("press enter", () => InputManager.Key(Key.Enter));
AddUntilStep("wait for player", () =>
{
DismissAnyNotifications();
return (player = Game.ScreenStack.CurrentScreen as Player) != null;
});
AddUntilStep("wait for fail", () => player.GameplayState.HasFailed);
AddUntilStep("fail screen displayed", () => player.ChildrenOfType<FailOverlay>().First().State.Value == Visibility.Visible);
AddUntilStep("wait for button clickable", () => player.ChildrenOfType<SaveFailedScoreButton>().First().ChildrenOfType<OsuClickableContainer>().First().Enabled.Value);
AddUntilStep("score not in database", () => Realm.Run(r => r.Find<ScoreInfo>(player.Score.ScoreInfo.ID) == null));
AddStep("click save button", () => player.ChildrenOfType<SaveFailedScoreButton>().First().ChildrenOfType<OsuClickableContainer>().First().TriggerClick());
AddUntilStep("score in database", () => Realm.Run(r => r.Find<ScoreInfo>(player.Score.ScoreInfo.ID) != null));
}
[Test]
public void TestExitImmediatelyAfterCompletion()
{