mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Add test coverage of clicking close button to dismiss
This commit is contained in:
@ -47,6 +47,35 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
notificationOverlay.UnreadCount.ValueChanged += count => { displayedCount.Text = $"displayed count: {count.NewValue}"; };
|
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]
|
[Test]
|
||||||
public void TestDismissWithoutActivationRightClick()
|
public void TestDismissWithoutActivationRightClick()
|
||||||
{
|
{
|
||||||
|
@ -218,7 +218,7 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
Expire();
|
Expire();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CloseButton : OsuClickableContainer
|
internal class CloseButton : OsuClickableContainer
|
||||||
{
|
{
|
||||||
private SpriteIcon icon = null!;
|
private SpriteIcon icon = null!;
|
||||||
private Box background = null!;
|
private Box background = null!;
|
||||||
|
Reference in New Issue
Block a user