mirror of
https://github.com/osukey/osukey.git
synced 2025-06-07 04:18:04 +09: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]
|
[SetUp]
|
||||||
public void SetUp() => Schedule(() =>
|
public void SetUp() => Schedule(() =>
|
||||||
{
|
{
|
||||||
|
InputManager.MoveMouseTo(Vector2.Zero);
|
||||||
|
|
||||||
TimeToCompleteProgress = 2000;
|
TimeToCompleteProgress = 2000;
|
||||||
progressingNotifications.Clear();
|
progressingNotifications.Clear();
|
||||||
|
|
||||||
@ -230,6 +232,31 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddUntilStep("wait overlay not present", () => !notificationOverlay.IsPresent);
|
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]
|
[Test]
|
||||||
public void TestCompleteProgress()
|
public void TestCompleteProgress()
|
||||||
{
|
{
|
||||||
@ -301,7 +328,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
{
|
{
|
||||||
SimpleNotification notification = null!;
|
SimpleNotification notification = null!;
|
||||||
AddStep(@"post", () => notificationOverlay.Post(notification = new BackgroundNotification { Text = @"Welcome to osu!. Enjoy your stay!" }));
|
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);
|
AddAssert("light is not visible", () => notification.ChildrenOfType<Notification.NotificationLight>().Single().Alpha == 0);
|
||||||
|
|
||||||
AddUntilStep("wait for forward to overlay", () => !notification.IsInToastTray);
|
AddUntilStep("wait for forward to overlay", () => !notification.IsInToastTray);
|
||||||
|
@ -229,8 +229,8 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
// Clicking with anything but left button should dismiss but not perform the activation action.
|
// Clicking with anything but left button should dismiss but not perform the activation action.
|
||||||
if (e.Button == MouseButton.Left)
|
if (e.Button == MouseButton.Left && Activated?.Invoke() == false)
|
||||||
Activated?.Invoke();
|
return true;
|
||||||
|
|
||||||
Close(false);
|
Close(false);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user