mirror of
https://github.com/ppy/osu.git
synced 2025-02-28 17:02:55 +08:00
Fix notification overlay being present when it doesn't need to
This commit is contained in:
parent
f754686521
commit
229e1a8ef7
@ -7,6 +7,7 @@ using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays;
|
||||
@ -44,6 +45,18 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
notificationOverlay.UnreadCount.ValueChanged += count => { displayedCount.Text = $"displayed count: {count.NewValue}"; };
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestPresence()
|
||||
{
|
||||
AddAssert("tray not present", () => !notificationOverlay.ChildrenOfType<NotificationOverlayToastTray>().Single().IsPresent);
|
||||
AddAssert("overlay not present", () => !notificationOverlay.IsPresent);
|
||||
|
||||
AddStep(@"post notification", sendBackgroundNotification);
|
||||
|
||||
AddUntilStep("wait tray not present", () => !notificationOverlay.ChildrenOfType<NotificationOverlayToastTray>().Single().IsPresent);
|
||||
AddUntilStep("wait overlay not present", () => !notificationOverlay.IsPresent);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCompleteProgress()
|
||||
{
|
||||
@ -63,6 +76,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddUntilStep("wait completion", () => notification.State == ProgressNotificationState.Completed);
|
||||
|
||||
AddAssert("Completion toast shown", () => notificationOverlay.ToastCount == 1);
|
||||
AddUntilStep("wait forwarded", () => notificationOverlay.ToastCount == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -24,6 +24,8 @@ namespace osu.Game.Overlays
|
||||
/// </summary>
|
||||
public class NotificationOverlayToastTray : CompositeDrawable
|
||||
{
|
||||
public override bool IsPresent => IsDisplayingToasts;
|
||||
|
||||
public bool IsDisplayingToasts => displayedCount > 0;
|
||||
|
||||
private FillFlowContainer<Notification> toastFlow = null!;
|
||||
|
Loading…
Reference in New Issue
Block a user