1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 12:35:34 +08:00

Update menu key shortcut test coverage

This commit is contained in:
Dean Herbert 2023-11-24 11:28:06 +09:00
parent a069a673fa
commit a02b6a5bcb
No known key found for this signature in database

View File

@ -67,14 +67,15 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("Enter mode", performEnterMode);
}
[TestCase(Key.P, true)]
[TestCase(Key.M, true)]
[TestCase(Key.L, true)]
[TestCase(Key.E, false)]
[TestCase(Key.D, false)]
[TestCase(Key.Q, false)]
[TestCase(Key.O, false)]
public void TestShortcutKeys(Key key, bool entersPlay)
[TestCase(Key.P, Key.P)]
[TestCase(Key.M, Key.P)]
[TestCase(Key.L, Key.P)]
[TestCase(Key.B, Key.E)]
[TestCase(Key.S, Key.E)]
[TestCase(Key.D, null)]
[TestCase(Key.Q, null)]
[TestCase(Key.O, null)]
public void TestShortcutKeys(Key key, Key? subMenuEnterKey)
{
int activationCount = -1;
AddStep("set up action", () =>
@ -96,10 +97,14 @@ namespace osu.Game.Tests.Visual.UserInterface
buttons.OnPlaylists = action;
break;
case Key.E:
case Key.B:
buttons.OnEditBeatmap = action;
break;
case Key.S:
buttons.OnEditSkin = action;
break;
case Key.D:
buttons.OnBeatmapListing = action;
break;
@ -117,10 +122,10 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep($"press {key}", () => InputManager.Key(key));
AddAssert("state is top level", () => buttons.State == ButtonSystemState.TopLevel);
if (entersPlay)
if (subMenuEnterKey != null)
{
AddStep("press P", () => InputManager.Key(Key.P));
AddAssert("state is play", () => buttons.State == ButtonSystemState.Play);
AddStep($"press {subMenuEnterKey}", () => InputManager.Key(subMenuEnterKey.Value));
AddAssert("state is not top menu", () => buttons.State != ButtonSystemState.TopLevel);
}
AddStep($"press {key}", () => InputManager.Key(key));