Move hover tests after key tests

This commit is contained in:
Joehu
2019-09-02 11:13:34 -07:00
parent 73fd3cf03c
commit 3d1f051437

View File

@ -56,17 +56,14 @@ namespace osu.Game.Tests.Visual.Gameplay
pauseOverlay.Retries = failOverlay.Retries = retryCount; pauseOverlay.Retries = failOverlay.Retries = retryCount;
}); });
AddToggleStep("Toggle pause overlay", t => pauseOverlay.ToggleVisibility());
AddToggleStep("Toggle fail overlay", t => failOverlay.ToggleVisibility());
testHideResets();
testEnterWithoutSelection(); testEnterWithoutSelection();
testKeyUpFromInitial(); testKeyUpFromInitial();
testKeyDownFromInitial(); testKeyDownFromInitial();
testKeyUpWrapping(); testKeyUpWrapping();
testKeyDownWrapping(); testKeyDownWrapping();
testHideResets();
testMouseSelectionAfterKeySelection(); testMouseSelectionAfterKeySelection();
testKeySelectionAfterMouseSelection(); testKeySelectionAfterMouseSelection();
@ -76,19 +73,6 @@ namespace osu.Game.Tests.Visual.Gameplay
testEnterKeySelection(); testEnterKeySelection();
} }
/// <summary>
/// Test that hiding the overlay after hovering a button will reset the overlay to the initial state with no buttons selected.
/// </summary>
private void testHideResets()
{
AddStep("Show overlay", () => failOverlay.Show());
AddStep("Hover first button", () => InputManager.MoveMouseTo(failOverlay.Buttons.First()));
AddStep("Hide overlay", () => failOverlay.Hide());
AddAssert("Overlay state is reset", () => !failOverlay.Buttons.Any(b => b.Selected.Value));
}
/// <summary> /// <summary>
/// Tests that pressing enter after an overlay shows doesn't trigger an event because a selection hasn't occurred. /// Tests that pressing enter after an overlay shows doesn't trigger an event because a selection hasn't occurred.
/// </summary> /// </summary>
@ -162,6 +146,19 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("Hide overlay", () => failOverlay.Hide()); AddStep("Hide overlay", () => failOverlay.Hide());
} }
/// <summary>
/// Test that hiding the overlay after hovering a button will reset the overlay to the initial state with no buttons selected.
/// </summary>
private void testHideResets()
{
AddStep("Show overlay", () => failOverlay.Show());
AddStep("Hover first button", () => InputManager.MoveMouseTo(failOverlay.Buttons.First()));
AddStep("Hide overlay", () => failOverlay.Hide());
AddAssert("Overlay state is reset", () => !failOverlay.Buttons.Any(b => b.Selected.Value));
}
/// <summary> /// <summary>
/// Tests that hovering a button that was previously selected with the keyboard correctly selects the new button and deselects the previous button. /// Tests that hovering a button that was previously selected with the keyboard correctly selects the new button and deselects the previous button.
/// </summary> /// </summary>