mirror of
https://github.com/ppy/osu
synced 2025-01-09 23:59:44 +00:00
Merge pull request #18164 from Joehuu/fix-exit-dialog-bad-state
Fix popup dialog potentially not clicking last button when dismissed
This commit is contained in:
commit
e9cc3ab54a
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.Leaderboards;
|
||||
using osu.Game.Overlays;
|
||||
@ -503,6 +504,22 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
AddStep("test dispose doesn't crash", () => Game.Dispose());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRapidBackButtonExit()
|
||||
{
|
||||
AddStep("set hold delay to 0", () => Game.LocalConfig.SetValue(OsuSetting.UIHoldActivationDelay, 0.0));
|
||||
|
||||
AddStep("press escape twice rapidly", () =>
|
||||
{
|
||||
InputManager.Key(Key.Escape);
|
||||
InputManager.Key(Key.Escape);
|
||||
});
|
||||
|
||||
pushEscape();
|
||||
|
||||
AddAssert("exit dialog is shown", () => Game.Dependencies.Get<IDialogOverlay>().CurrentDialog != null);
|
||||
}
|
||||
|
||||
private Func<Player> playToResults()
|
||||
{
|
||||
Player player = null;
|
||||
|
@ -100,10 +100,6 @@ namespace osu.Game.Overlays.Dialog
|
||||
}
|
||||
}
|
||||
|
||||
// We always want dialogs to show their appear animation, so we request they start hidden.
|
||||
// Normally this would not be required, but is here due to the manual Show() call that occurs before LoadComplete().
|
||||
protected override bool StartHidden => true;
|
||||
|
||||
protected PopupDialog()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
@ -272,7 +268,7 @@ namespace osu.Game.Overlays.Dialog
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
if (!actionInvoked && content.IsPresent)
|
||||
if (!actionInvoked)
|
||||
// In the case a user did not choose an action before a hide was triggered, press the last button.
|
||||
// This is presumed to always be a sane default "cancel" action.
|
||||
buttonsContainer.Last().TriggerClick();
|
||||
|
Loading…
Reference in New Issue
Block a user