Create subclass for "Error" notifications to allow them to have a unique pop-in sound

This commit is contained in:
Jamie Taylor
2021-01-21 18:42:53 +09:00
parent a1ae739a62
commit 2ee634d173
3 changed files with 37 additions and 2 deletions

View File

@ -105,6 +105,15 @@ namespace osu.Game.Tests.Visual.UserInterface
checkDisplayedCount(3);
}
[Test]
public void TestError()
{
setState(Visibility.Visible);
AddStep(@"error #1", sendErrorNotification);
AddAssert("Is visible", () => notificationOverlay.State.Value == Visibility.Visible);
checkDisplayedCount(1);
}
[Test]
public void TestSpam()
{
@ -179,7 +188,7 @@ namespace osu.Game.Tests.Visual.UserInterface
private void sendBarrage()
{
switch (RNG.Next(0, 4))
switch (RNG.Next(0, 5))
{
case 0:
sendHelloNotification();
@ -196,6 +205,10 @@ namespace osu.Game.Tests.Visual.UserInterface
case 3:
sendDownloadProgress();
break;
case 4:
sendErrorNotification();
break;
}
}
@ -214,6 +227,11 @@ namespace osu.Game.Tests.Visual.UserInterface
notificationOverlay.Post(new BackgroundNotification { Text = @"Welcome to osu!. Enjoy your stay!" });
}
private void sendErrorNotification()
{
notificationOverlay.Post(new SimpleErrorNotification { Text = @"Rut roh!. Something went wrong!" });
}
private void sendManyNotifications()
{
for (int i = 0; i < 10; i++)