Add test for arrow key seeking

This commit is contained in:
Joehu 2020-07-14 21:59:26 -07:00
parent ecbd8067e9
commit ec3fe8d346
1 changed files with 9 additions and 0 deletions

View File

@ -11,6 +11,7 @@
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.Break;
using osu.Game.Screens.Ranking;
using osuTK.Input;
namespace osu.Game.Tests.Visual.Gameplay
{
@ -34,6 +35,8 @@ protected override void AddCheckSteps()
AddAssert("overlay displays 100% accuracy", () => Player.BreakOverlay.ChildrenOfType<BreakInfo>().Single().AccuracyDisplay.Current.Value == 1);
AddStep("rewind", () => Player.GameplayClockContainer.Seek(-80000));
AddUntilStep("key counter reset", () => Player.HUDOverlay.KeyCounter.Children.All(kc => kc.CountPresses == 0));
AddStep("seek with right arrow key", () => press(Key.Right));
AddUntilStep("key counter counted keys", () => Player.HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 2));
seekToBreak(0);
seekToBreak(1);
@ -54,5 +57,11 @@ private void seekToBreak(int breakIndex)
BreakPeriod destBreak() => Beatmap.Value.Beatmap.Breaks.ElementAt(breakIndex);
}
private void press(Key key)
{
InputManager.PressKey(key);
InputManager.ReleaseKey(key);
}
}
}