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

Merge pull request #26437 from bdach/song-select-logo-crash

Fix crash when clicking osu! logo in song select immediately after exiting
This commit is contained in:
Dean Herbert 2024-01-09 19:40:19 +09:00 committed by GitHub
commit 8324b75fa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 1 deletions

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();

View File

@ -660,7 +660,8 @@ namespace osu.Game.Screens.Select
logo.Action = () =>
{
FinaliseSelection();
if (this.IsCurrentScreen())
FinaliseSelection();
return false;
};
}