1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:12:54 +08:00

Add test for crashing scenario

This commit is contained in:
Bartłomiej Dach 2024-01-08 21:33:25 +01:00
parent 70ba5dd0d3
commit 8a87301c55
No known key found for this signature in database

View File

@ -938,6 +938,35 @@ namespace osu.Game.Tests.Visual.Navigation
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();