mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
Add failing test showing progress notifications can be flung and cancelled
This commit is contained in:
parent
1eaaf80b99
commit
82d4689716
@ -107,9 +107,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
AddStep("start drag", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(notification.ChildrenOfType<Notification>().Single());
|
||||
InputManager.MoveMouseTo(notificationOverlay.ChildrenOfType<Notification>().Single());
|
||||
InputManager.PressButton(MouseButton.Left);
|
||||
InputManager.MoveMouseTo(notification.ChildrenOfType<Notification>().Single().ScreenSpaceDrawQuad.Centre + new Vector2(-500, 0));
|
||||
InputManager.MoveMouseTo(notificationOverlay.ChildrenOfType<Notification>().Single().ScreenSpaceDrawQuad.Centre + new Vector2(-500, 0));
|
||||
});
|
||||
|
||||
AddStep("fling away", () =>
|
||||
@ -123,6 +123,45 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddAssert("unread count zero", () => notificationOverlay.UnreadCount.Value == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestProgressNotificationCantBeFlung()
|
||||
{
|
||||
bool activated = false;
|
||||
ProgressNotification notification = null!;
|
||||
|
||||
AddStep("post", () =>
|
||||
{
|
||||
activated = false;
|
||||
notificationOverlay.Post(notification = new ProgressNotification
|
||||
{
|
||||
Text = @"Uploading to BSS...",
|
||||
CompletionText = "Uploaded to BSS!",
|
||||
Activated = () => activated = true,
|
||||
});
|
||||
|
||||
progressingNotifications.Add(notification);
|
||||
});
|
||||
|
||||
AddStep("start drag", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(notificationOverlay.ChildrenOfType<Notification>().Single());
|
||||
InputManager.PressButton(MouseButton.Left);
|
||||
InputManager.MoveMouseTo(notificationOverlay.ChildrenOfType<Notification>().Single().ScreenSpaceDrawQuad.Centre + new Vector2(-500, 0));
|
||||
});
|
||||
|
||||
AddStep("attempt fling", () =>
|
||||
{
|
||||
InputManager.ReleaseButton(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddUntilStep("was not closed", () => !notification.WasClosed);
|
||||
AddUntilStep("was not cancelled", () => notification.State == ProgressNotificationState.Active);
|
||||
AddAssert("was not activated", () => !activated);
|
||||
AddStep("reset mouse position", () => InputManager.MoveMouseTo(Vector2.Zero));
|
||||
|
||||
AddUntilStep("was completed", () => notification.State == ProgressNotificationState.Completed);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDismissWithoutActivationCloseButton()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user