mirror of
https://github.com/ppy/osu.git
synced 2024-09-23 19:27:24 +08:00
Merge pull request #20383 from frenzibyte/fix-cancel-block
This commit is contained in:
commit
739c8c830f
@ -34,6 +34,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
InputManager.MoveMouseTo(Vector2.Zero);
|
||||
|
||||
TimeToCompleteProgress = 2000;
|
||||
progressingNotifications.Clear();
|
||||
|
||||
@ -230,6 +232,31 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddUntilStep("wait overlay not present", () => !notificationOverlay.IsPresent);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestProgressClick()
|
||||
{
|
||||
ProgressNotification notification = null!;
|
||||
|
||||
AddStep("add progress notification", () =>
|
||||
{
|
||||
notification = new ProgressNotification
|
||||
{
|
||||
Text = @"Uploading to BSS...",
|
||||
CompletionText = "Uploaded to BSS!",
|
||||
};
|
||||
notificationOverlay.Post(notification);
|
||||
progressingNotifications.Add(notification);
|
||||
});
|
||||
|
||||
AddStep("hover over notification", () => InputManager.MoveMouseTo(notificationOverlay.ChildrenOfType<ProgressNotification>().Single()));
|
||||
|
||||
AddStep("left click", () => InputManager.Click(MouseButton.Left));
|
||||
AddAssert("not cancelled", () => notification.State == ProgressNotificationState.Active);
|
||||
|
||||
AddStep("right click", () => InputManager.Click(MouseButton.Right));
|
||||
AddAssert("cancelled", () => notification.State == ProgressNotificationState.Cancelled);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCompleteProgress()
|
||||
{
|
||||
@ -301,7 +328,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
SimpleNotification notification = null!;
|
||||
AddStep(@"post", () => notificationOverlay.Post(notification = new BackgroundNotification { Text = @"Welcome to osu!. Enjoy your stay!" }));
|
||||
AddUntilStep("check is toast", () => !notification.IsInToastTray);
|
||||
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);
|
||||
|
@ -229,8 +229,8 @@ namespace osu.Game.Overlays.Notifications
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
// Clicking with anything but left button should dismiss but not perform the activation action.
|
||||
if (e.Button == MouseButton.Left)
|
||||
Activated?.Invoke();
|
||||
if (e.Button == MouseButton.Left && Activated?.Invoke() == false)
|
||||
return true;
|
||||
|
||||
Close(false);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user