1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Fix failing tests due to CurrentDialog being unexpectedly not set after Push

This commit is contained in:
Dean Herbert 2022-05-05 01:52:39 +09:00
parent 383245f43a
commit a27fcda9f1
2 changed files with 12 additions and 17 deletions

View File

@ -105,8 +105,6 @@ namespace osu.Game.Tests.Visual.UserInterface
});
});
AddAssert("dialog not displayed", () => overlay.CurrentDialog != dialog);
AddStep("complete load", () => ((SlowLoadingDialogOverlay)overlay).LoadEvent.Set());
AddUntilStep("wait for load", () => overlay.IsLoaded);

View File

@ -47,23 +47,23 @@ namespace osu.Game.Overlays
public void Push(PopupDialog dialog)
{
if (!IsLoaded)
{
Schedule(() => Push(dialog));
return;
}
if (dialog == CurrentDialog || dialog.State.Value != Visibility.Visible) return;
// if any existing dialog is being displayed, dismiss it before showing a new one.
CurrentDialog?.Hide();
var lastDialog = CurrentDialog;
CurrentDialog = dialog;
CurrentDialog.State.ValueChanged += state => onDialogOnStateChanged(dialog, state.NewValue);
dialogContainer.Add(CurrentDialog);
Scheduler.Add(() =>
{
// if any existing dialog is being displayed, dismiss it before showing a new one.
lastDialog?.Hide();
Show();
CurrentDialog = dialog;
CurrentDialog.State.ValueChanged += state => onDialogOnStateChanged(dialog, state.NewValue);
dialogContainer.Add(CurrentDialog);
Show();
}, false);
}
public override bool IsPresent => Scheduler.HasPendingTasks || dialogContainer.Children.Count > 0;
@ -96,9 +96,6 @@ namespace osu.Game.Overlays
base.PopOut();
this.FadeOut(PopupDialog.EXIT_DURATION, Easing.InSine);
// PopOut is called as part of VisibilityContainer's initialisation logic, but we don't want it to interact with a potentially waiting dialog.
if (!IsLoaded) return;
lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF, 100, Easing.InCubic);
if (CurrentDialog?.State.Value == Visibility.Visible) CurrentDialog.Hide();