-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17950 from Susko3/ButtonSystem-keys
Allow any key to trigger the osu! cookie in the initial state
- Loading branch information
Showing
3 changed files
with
110 additions
and
6 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
osu.Game.Tests/Visual/Navigation/TestSceneButtonSystemNavigation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Linq; | ||
using NUnit.Framework; | ||
using osu.Framework.Testing; | ||
using osu.Game.Screens.Menu; | ||
using osu.Game.Screens.Select; | ||
using osuTK.Input; | ||
|
||
namespace osu.Game.Tests.Visual.Navigation | ||
{ | ||
public class TestSceneButtonSystemNavigation : OsuGameTestScene | ||
{ | ||
private ButtonSystem buttons => ((MainMenu)Game.ScreenStack.CurrentScreen).ChildrenOfType<ButtonSystem>().Single(); | ||
|
||
[Test] | ||
public void TestGlobalActionHasPriority() | ||
{ | ||
AddAssert("state is initial", () => buttons.State == ButtonSystemState.Initial); | ||
|
||
// triggering the cookie in the initial state with any key should only happen if no other action is bound to that key. | ||
// here, F10 is bound to GlobalAction.ToggleGameplayMouseButtons. | ||
AddStep("press F10", () => InputManager.Key(Key.F10)); | ||
AddAssert("state is initial", () => buttons.State == ButtonSystemState.Initial); | ||
|
||
AddStep("press P", () => InputManager.Key(Key.P)); | ||
AddAssert("state is top level", () => buttons.State == ButtonSystemState.TopLevel); | ||
} | ||
|
||
[Test] | ||
public void TestShortcutKeys() | ||
{ | ||
AddAssert("state is initial", () => buttons.State == ButtonSystemState.Initial); | ||
|
||
AddStep("press P", () => InputManager.Key(Key.P)); | ||
AddAssert("state is top level", () => buttons.State == ButtonSystemState.TopLevel); | ||
|
||
AddStep("press P", () => InputManager.Key(Key.P)); | ||
AddAssert("state is play", () => buttons.State == ButtonSystemState.Play); | ||
|
||
AddStep("press P", () => InputManager.Key(Key.P)); | ||
AddAssert("entered song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters