mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:03:11 +08:00
Merge pull request #24246 from bdach/fix-exit-dialog-crash
Fix potential crash in confirm exit dialog while attempting to exit game
This commit is contained in:
commit
acb51dfca3
@ -722,6 +722,30 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
AddUntilStep("Wait for game exit", () => Game.ScreenStack.CurrentScreen == null);
|
AddUntilStep("Wait for game exit", () => Game.ScreenStack.CurrentScreen == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestForceExitWithOperationInProgress()
|
||||||
|
{
|
||||||
|
AddStep("set hold delay to 0", () => Game.LocalConfig.SetValue(OsuSetting.UIHoldActivationDelay, 0.0));
|
||||||
|
AddUntilStep("wait for dialog overlay", () => Game.ChildrenOfType<DialogOverlay>().SingleOrDefault() != null);
|
||||||
|
|
||||||
|
AddStep("start ongoing operation", () =>
|
||||||
|
{
|
||||||
|
Game.Notifications.Post(new ProgressNotification
|
||||||
|
{
|
||||||
|
Text = "Something is still running",
|
||||||
|
Progress = 0.5f,
|
||||||
|
State = ProgressNotificationState.Active,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("attempt exit", () =>
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 2; ++i)
|
||||||
|
Game.ScreenStack.CurrentScreen.Exit();
|
||||||
|
});
|
||||||
|
AddUntilStep("stopped at exit confirm", () => Game.ChildrenOfType<DialogOverlay>().Single().CurrentDialog is ConfirmExitDialog);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestExitGameFromSongSelect()
|
public void TestExitGameFromSongSelect()
|
||||||
{
|
{
|
||||||
|
@ -229,7 +229,7 @@ namespace osu.Game.Overlays.Dialog
|
|||||||
{
|
{
|
||||||
// Buttons are regularly added in BDL or LoadComplete, so let's schedule to ensure
|
// Buttons are regularly added in BDL or LoadComplete, so let's schedule to ensure
|
||||||
// they are ready to be pressed.
|
// they are ready to be pressed.
|
||||||
Schedule(() => Buttons.OfType<T>().First().TriggerClick());
|
Schedule(() => Buttons.OfType<T>().FirstOrDefault()?.TriggerClick());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
|
Loading…
Reference in New Issue
Block a user