mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:52:53 +08:00
Add test coverage of clicking close button to dismiss
This commit is contained in:
parent
efe3b1aa7b
commit
a9094c6b03
@ -47,6 +47,35 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
notificationOverlay.UnreadCount.ValueChanged += count => { displayedCount.Text = $"displayed count: {count.NewValue}"; };
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestDismissWithoutActivationCloseButton()
|
||||
{
|
||||
bool activated = false;
|
||||
SimpleNotification notification = null!;
|
||||
|
||||
AddStep("post", () =>
|
||||
{
|
||||
activated = false;
|
||||
notificationOverlay.Post(notification = new SimpleNotification
|
||||
{
|
||||
Text = @"Welcome to osu!. Enjoy your stay!",
|
||||
Activated = () => activated = true,
|
||||
});
|
||||
});
|
||||
|
||||
AddStep("click to activate", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(notificationOverlay
|
||||
.ChildrenOfType<Notification>().Single()
|
||||
.ChildrenOfType<Notification.CloseButton>().Single());
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for closed", () => notification.WasClosed);
|
||||
AddAssert("was not activated", () => !activated);
|
||||
AddStep("reset mouse position", () => InputManager.MoveMouseTo(Vector2.Zero));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDismissWithoutActivationRightClick()
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
Expire();
|
||||
}
|
||||
|
||||
private class CloseButton : OsuClickableContainer
|
||||
internal class CloseButton : OsuClickableContainer
|
||||
{
|
||||
private SpriteIcon icon = null!;
|
||||
private Box background = null!;
|
||||
|
Loading…
Reference in New Issue
Block a user