mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Fix incorrect count tracking when notification is manually disposed
This commit is contained in:
@ -57,6 +57,19 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddUntilStep("wait overlay not present", () => !notificationOverlay.IsPresent);
|
AddUntilStep("wait overlay not present", () => !notificationOverlay.IsPresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestPresenceWithManualDismiss()
|
||||||
|
{
|
||||||
|
AddAssert("tray not present", () => !notificationOverlay.ChildrenOfType<NotificationOverlayToastTray>().Single().IsPresent);
|
||||||
|
AddAssert("overlay not present", () => !notificationOverlay.IsPresent);
|
||||||
|
|
||||||
|
AddStep(@"post notification", sendBackgroundNotification);
|
||||||
|
AddStep("click notification", () => notificationOverlay.ChildrenOfType<Notification>().Single().TriggerClick());
|
||||||
|
|
||||||
|
AddUntilStep("wait tray not present", () => !notificationOverlay.ChildrenOfType<NotificationOverlayToastTray>().Single().IsPresent);
|
||||||
|
AddUntilStep("wait overlay not present", () => !notificationOverlay.IsPresent);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestCompleteProgress()
|
public void TestCompleteProgress()
|
||||||
{
|
{
|
||||||
|
@ -97,6 +97,8 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
public void Post(Notification notification)
|
public void Post(Notification notification)
|
||||||
{
|
{
|
||||||
|
notification.Closed += stopTrackingNotification;
|
||||||
|
|
||||||
++runningDepth;
|
++runningDepth;
|
||||||
displayedCount++;
|
displayedCount++;
|
||||||
|
|
||||||
@ -139,14 +141,23 @@ namespace osu.Game.Overlays
|
|||||||
notification.MoveToOffset(new Vector2(400, 0), NotificationOverlay.TRANSITION_LENGTH, Easing.OutQuint);
|
notification.MoveToOffset(new Vector2(400, 0), NotificationOverlay.TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
notification.FadeOut(NotificationOverlay.TRANSITION_LENGTH, Easing.OutQuint).OnComplete(_ =>
|
notification.FadeOut(NotificationOverlay.TRANSITION_LENGTH, Easing.OutQuint).OnComplete(_ =>
|
||||||
{
|
{
|
||||||
|
notification.Closed -= stopTrackingNotification;
|
||||||
|
if (!notification.WasClosed)
|
||||||
|
stopTrackingNotification();
|
||||||
|
|
||||||
RemoveInternal(notification, false);
|
RemoveInternal(notification, false);
|
||||||
displayedCount--;
|
|
||||||
ForwardNotificationToPermanentStore?.Invoke(notification);
|
ForwardNotificationToPermanentStore?.Invoke(notification);
|
||||||
|
|
||||||
notification.FadeIn(300, Easing.OutQuint);
|
notification.FadeIn(300, Easing.OutQuint);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void stopTrackingNotification()
|
||||||
|
{
|
||||||
|
Debug.Assert(displayedCount > 0);
|
||||||
|
displayedCount--;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
Reference in New Issue
Block a user