Add ability to seek between control points in editor using down/up arrows

Matches stable. Addresses #21376.
This commit is contained in:
Dean Herbert
2022-11-23 15:59:31 +09:00
parent 23f91ec717
commit 9b9b8a5977
2 changed files with 39 additions and 0 deletions

View File

@ -25,6 +25,7 @@ namespace osu.Game.Tests.Visual.Editing
beatmap.ControlPointInfo.Clear();
beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 1000 });
beatmap.ControlPointInfo.Add(2000, new TimingControlPoint { BeatLength = 500 });
beatmap.ControlPointInfo.Add(20000, new TimingControlPoint { BeatLength = 500 });
return beatmap;
}
@ -116,6 +117,26 @@ namespace osu.Game.Tests.Visual.Editing
pressAndCheckTime(Key.Right, 3000);
}
[Test]
public void TestSeekBetweenControlPoints()
{
AddStep("seek to 0", () => EditorClock.Seek(0));
AddAssert("time is 0", () => EditorClock.CurrentTime == 0);
// already at first control point, noop
pressAndCheckTime(Key.Down, 0);
pressAndCheckTime(Key.Up, 2000);
pressAndCheckTime(Key.Up, 20000);
// at last control point, noop
pressAndCheckTime(Key.Up, 20000);
pressAndCheckTime(Key.Down, 2000);
pressAndCheckTime(Key.Down, 0);
pressAndCheckTime(Key.Down, 0);
}
private void pressAndCheckTime(Key key, double expectedTime)
{
AddStep($"press {key}", () => InputManager.Key(key));