mirror of
https://github.com/ppy/osu
synced 2025-01-18 20:10:49 +00:00
Merge pull request #28808 from frenzibyte/fix-all-notifications
Fix confirm exit dialog potentially showing incorrect number of ongoing operations
This commit is contained in:
commit
452fbed681
@ -838,18 +838,25 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
[Test]
|
||||
public void TestExitWithOperationInProgress()
|
||||
{
|
||||
AddUntilStep("wait for dialog overlay", () => Game.ChildrenOfType<DialogOverlay>().SingleOrDefault() != null);
|
||||
int x = 0;
|
||||
|
||||
AddUntilStep("wait for dialog overlay", () =>
|
||||
{
|
||||
x = 0;
|
||||
return Game.ChildrenOfType<DialogOverlay>().SingleOrDefault() != null;
|
||||
});
|
||||
|
||||
AddRepeatStep("start ongoing operation", () =>
|
||||
{
|
||||
Game.Notifications.Post(new ProgressNotification
|
||||
{
|
||||
Text = "Something is still running",
|
||||
Text = $"Something is still running #{++x}",
|
||||
Progress = 0.5f,
|
||||
State = ProgressNotificationState.Active,
|
||||
});
|
||||
}, 15);
|
||||
|
||||
AddAssert("all notifications = 15", () => Game.Notifications.AllNotifications.Count(), () => Is.EqualTo(15));
|
||||
AddStep("Hold escape", () => InputManager.PressKey(Key.Escape));
|
||||
AddUntilStep("confirmation dialog shown", () => Game.ChildrenOfType<DialogOverlay>().Single().CurrentDialog is ConfirmExitDialog);
|
||||
AddStep("Release escape", () => InputManager.ReleaseKey(Key.Escape));
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Overlays
|
||||
/// <summary>
|
||||
/// All notifications currently being displayed by the toast tray.
|
||||
/// </summary>
|
||||
public IEnumerable<Notification> Notifications => toastFlow;
|
||||
public IEnumerable<Notification> Notifications => toastFlow.Concat(InternalChildren.OfType<Notification>());
|
||||
|
||||
public bool IsDisplayingToasts => toastFlow.Count > 0;
|
||||
|
||||
@ -43,12 +43,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
public Action<Notification>? ForwardNotificationToPermanentStore { get; set; }
|
||||
|
||||
public int UnreadCount => allDisplayedNotifications.Count(n => !n.WasClosed && !n.Read);
|
||||
|
||||
/// <summary>
|
||||
/// Notifications contained in the toast flow, or in a detached state while they animate during forwarding to the main overlay.
|
||||
/// </summary>
|
||||
private IEnumerable<Notification> allDisplayedNotifications => toastFlow.Concat(InternalChildren.OfType<Notification>());
|
||||
public int UnreadCount => Notifications.Count(n => !n.WasClosed && !n.Read);
|
||||
|
||||
private int runningDepth;
|
||||
|
||||
@ -91,11 +86,7 @@ namespace osu.Game.Overlays
|
||||
};
|
||||
}
|
||||
|
||||
public void MarkAllRead()
|
||||
{
|
||||
toastFlow.Children.ForEach(n => n.Read = true);
|
||||
InternalChildren.OfType<Notification>().ForEach(n => n.Read = true);
|
||||
}
|
||||
public void MarkAllRead() => Notifications.ForEach(n => n.Read = true);
|
||||
|
||||
public void FlushAllToasts()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user