1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 11:35:35 +08:00

Add test for initial button hover

This commit is contained in:
Joehu 2019-09-03 16:56:45 -07:00
parent 3d1f051437
commit 9ec16bc2b2

View File

@ -63,6 +63,7 @@ namespace osu.Game.Tests.Visual.Gameplay
testKeyDownWrapping();
testHideResets();
testInitialButtonHover();
testMouseSelectionAfterKeySelection();
testKeySelectionAfterMouseSelection();
@ -159,6 +160,25 @@ namespace osu.Game.Tests.Visual.Gameplay
AddAssert("Overlay state is reset", () => !failOverlay.Buttons.Any(b => b.Selected.Value));
}
/// <summary>
/// Tests that entering menu with cursor initially on button selects it.
/// </summary>
private void testInitialButtonHover()
{
AddStep("Show overlay", () => pauseOverlay.Show());
var firstButton = pauseOverlay.Buttons.First();
AddStep("Hover first button", () => InputManager.MoveMouseTo(firstButton));
AddStep("Hide overlay", () => pauseOverlay.Hide());
AddStep("Show overlay", () => pauseOverlay.Show());
AddAssert("First button selected", () => firstButton.Selected.Value);
AddStep("Hide overlay", () => pauseOverlay.Hide());
}
/// <summary>
/// Tests that hovering a button that was previously selected with the keyboard correctly selects the new button and deselects the previous button.
/// </summary>