mirror of
https://github.com/ppy/osu.git
synced 2024-09-22 03:27:24 +08:00
Hide notification read light when in a toast state
Also adds test coverage of read state and light.
This commit is contained in:
parent
9ef23c79ce
commit
92beb6cbe7
@ -219,6 +219,26 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddStep("cancel notification", () => notification.State = ProgressNotificationState.Cancelled);
|
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]
|
[Test]
|
||||||
public void TestBasicFlow()
|
public void TestBasicFlow()
|
||||||
{
|
{
|
||||||
|
@ -75,12 +75,17 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsInToastTray
|
public bool IsInToastTray
|
||||||
{
|
{
|
||||||
private get => isInToastTray;
|
get => isInToastTray;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
isInToastTray = value;
|
isInToastTray = value;
|
||||||
|
|
||||||
if (!isInToastTray)
|
if (!isInToastTray)
|
||||||
|
{
|
||||||
dragContainer.ResetPosition();
|
dragContainer.ResetPosition();
|
||||||
|
if (!Read)
|
||||||
|
Light.FadeIn(100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,6 +102,7 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
{
|
{
|
||||||
Light = new NotificationLight
|
Light = new NotificationLight
|
||||||
{
|
{
|
||||||
|
Alpha = 0,
|
||||||
Margin = new MarginPadding { Right = 5 },
|
Margin = new MarginPadding { Right = 5 },
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
@ -239,10 +245,7 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
WasClosed = true;
|
WasClosed = true;
|
||||||
|
|
||||||
if (dragContainer.FlingLeft())
|
if (dragContainer.FlingLeft())
|
||||||
{
|
|
||||||
Light.FadeOut(100);
|
|
||||||
this.FadeOut(600, Easing.In);
|
this.FadeOut(600, Easing.In);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Closed?.Invoke();
|
Closed?.Invoke();
|
||||||
|
Loading…
Reference in New Issue
Block a user