mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:02:55 +08:00
Add test coverage of flinging
This commit is contained in:
parent
d92e000fe6
commit
f56f6545c0
@ -48,6 +48,40 @@ 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 TestDismissWithoutActivationFling()
|
||||||
|
{
|
||||||
|
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("start drag", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(notification.ChildrenOfType<Notification>().Single());
|
||||||
|
InputManager.PressButton(MouseButton.Left);
|
||||||
|
InputManager.MoveMouseTo(notification.ChildrenOfType<Notification>().Single().ScreenSpaceDrawQuad.Centre + new Vector2(-500, 0));
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("fling away", () =>
|
||||||
|
{
|
||||||
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("wait for closed", () => notification.WasClosed);
|
||||||
|
AddAssert("was not activated", () => !activated);
|
||||||
|
AddStep("reset mouse position", () => InputManager.MoveMouseTo(Vector2.Zero));
|
||||||
|
AddAssert("unread count zero", () => notificationOverlay.UnreadCount.Value == 0);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDismissWithoutActivationCloseButton()
|
public void TestDismissWithoutActivationCloseButton()
|
||||||
{
|
{
|
||||||
@ -75,6 +109,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddUntilStep("wait for closed", () => notification.WasClosed);
|
AddUntilStep("wait for closed", () => notification.WasClosed);
|
||||||
AddAssert("was not activated", () => !activated);
|
AddAssert("was not activated", () => !activated);
|
||||||
AddStep("reset mouse position", () => InputManager.MoveMouseTo(Vector2.Zero));
|
AddStep("reset mouse position", () => InputManager.MoveMouseTo(Vector2.Zero));
|
||||||
|
AddAssert("unread count zero", () => notificationOverlay.UnreadCount.Value == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
Loading…
Reference in New Issue
Block a user