1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 23:12:56 +08:00

Update remaining test expectations with new behaviour

This commit is contained in:
Dean Herbert 2022-08-31 00:57:30 +09:00
parent a62ba9e0d9
commit 31a9980686
3 changed files with 11 additions and 3 deletions

View File

@ -110,7 +110,8 @@ namespace osu.Game.Tests.Visual.UserInterface
{
AddStep(@"simple #1", sendHelloNotification);
AddAssert("Is visible", () => notificationOverlay.State.Value == Visibility.Visible);
AddAssert("toast displayed", () => notificationOverlay.ToastCount == 1);
AddAssert("is not visible", () => notificationOverlay.State.Value == Visibility.Hidden);
checkDisplayedCount(1);
@ -183,7 +184,7 @@ namespace osu.Game.Tests.Visual.UserInterface
}
private void checkDisplayedCount(int expected) =>
AddAssert($"Displayed count is {expected}", () => notificationOverlay.UnreadCount.Value == expected);
AddUntilStep($"Displayed count is {expected}", () => notificationOverlay.UnreadCount.Value == expected);
private void sendDownloadProgress()
{

View File

@ -129,6 +129,8 @@ namespace osu.Game.Overlays
public IBindable<int> UnreadCount => unreadCount;
public int ToastCount => toastTray.UnreadCount;
private readonly BindableInt unreadCount = new BindableInt();
private int runningDepth;
@ -155,7 +157,10 @@ namespace osu.Game.Overlays
playDebouncedSample(notification.PopInSampleName);
if (State.Value == Visibility.Hidden)
{
toastTray.Post(notification);
updateCounts();
}
else
addPermanently(notification);
});
@ -220,7 +225,7 @@ namespace osu.Game.Overlays
private void updateCounts()
{
unreadCount.Value = sections.Select(c => c.UnreadCount).Sum();
unreadCount.Value = sections.Select(c => c.UnreadCount).Sum() + toastTray.UnreadCount;
}
private void markAllRead()

View File

@ -32,6 +32,8 @@ namespace osu.Game.Overlays
public Action<Notification>? ForwardNotificationToPermanentStore { get; set; }
public int UnreadCount => toastFlow.Count(n => !n.WasClosed && !n.Read);
private int runningDepth;
[BackgroundDependencyLoader]