Add test for initial button hover

This commit is contained in:
Joehu 2019-09-03 16:56:45 -07:00
parent 3d1f051437
commit 9ec16bc2b2
1 changed files with 20 additions and 0 deletions

View File

@ -63,6 +63,7 @@ private void load(OsuGameBase game)
testKeyDownWrapping();
testHideResets();
testInitialButtonHover();
testMouseSelectionAfterKeySelection();
testKeySelectionAfterMouseSelection();
@ -159,6 +160,25 @@ private void testHideResets()
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>