Hide notification read light when in a toast state

Also adds test coverage of read state and light.
This commit is contained in:
Dean Herbert
2022-09-12 15:16:45 +09:00
parent 9ef23c79ce
commit 92beb6cbe7
2 changed files with 27 additions and 4 deletions

View File

@ -219,6 +219,26 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("cancel notification", () => notification.State = ProgressNotificationState.Cancelled);
}
[Test]
public void TestReadState()
{
SimpleNotification notification = null!;
AddStep(@"post", () => notificationOverlay.Post(notification = new BackgroundNotification { Text = @"Welcome to osu!. Enjoy your stay!" }));
AddUntilStep("check is toast", () => !notification.IsInToastTray);
AddAssert("light is not visible", () => notification.ChildrenOfType<Notification.NotificationLight>().Single().Alpha == 0);
AddUntilStep("wait for forward to overlay", () => !notification.IsInToastTray);
setState(Visibility.Visible);
AddAssert("state is not read", () => !notification.Read);
AddUntilStep("light is visible", () => notification.ChildrenOfType<Notification.NotificationLight>().Single().Alpha == 1);
setState(Visibility.Hidden);
setState(Visibility.Visible);
AddAssert("state is read", () => notification.Read);
AddUntilStep("light is not visible", () => notification.ChildrenOfType<Notification.NotificationLight>().Single().Alpha == 0);
}
[Test]
public void TestBasicFlow()
{