Skip to content

Commit

Permalink
Add test for crashing scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
bdach committed Jan 8, 2024
1 parent 70ba5dd commit 8a87301
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,35 @@ public void TestTouchScreenDetectionInGame()
AddUntilStep("touch device mod still active", () => Game.SelectedMods.Value, () => Has.One.InstanceOf<ModTouchDevice>());
}

[Test]
public void TestExitSongSelectAndImmediatelyClickLogo()
{
Screens.Select.SongSelect songSelect = null;
PushAndConfirm(() => songSelect = new TestPlaySongSelect());
AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded);

AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());

AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);

AddStep("press escape and then click logo immediately", () =>
{
InputManager.Key(Key.Escape);
clickLogoWhenNotCurrent();
});

void clickLogoWhenNotCurrent()
{
if (songSelect.IsCurrentScreen())
Scheduler.AddOnce(clickLogoWhenNotCurrent);
else
{
InputManager.MoveMouseTo(Game.ChildrenOfType<OsuLogo>().Single());
InputManager.Click(MouseButton.Left);
}
}
}

private Func<Player> playToResults()
{
var player = playToCompletion();
Expand Down

0 comments on commit 8a87301

Please sign in to comment.