mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 08:13:31 +08:00
Merge pull request #9566 from Joehuu/seek-replay/auto-with-arrow-keys
This commit is contained in:
commit
afae79662c
@ -11,6 +11,7 @@ using osu.Game.Rulesets.Scoring;
|
||||
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
|
||||
{
|
||||
@ -35,6 +36,18 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddStep("rewind", () => Player.GameplayClockContainer.Seek(-80000));
|
||||
AddUntilStep("key counter reset", () => Player.HUDOverlay.KeyCounter.Children.All(kc => kc.CountPresses == 0));
|
||||
|
||||
double? time = null;
|
||||
|
||||
AddStep("store time", () => time = Player.GameplayClockContainer.GameplayClock.CurrentTime);
|
||||
|
||||
// test seek via keyboard
|
||||
AddStep("seek with right arrow key", () => press(Key.Right));
|
||||
AddAssert("time seeked forward", () => Player.GameplayClockContainer.GameplayClock.CurrentTime > time + 2000);
|
||||
|
||||
AddStep("store time", () => time = Player.GameplayClockContainer.GameplayClock.CurrentTime);
|
||||
AddStep("seek with left arrow key", () => press(Key.Left));
|
||||
AddAssert("time seeked backward", () => Player.GameplayClockContainer.GameplayClock.CurrentTime < time);
|
||||
|
||||
seekToBreak(0);
|
||||
seekToBreak(1);
|
||||
|
||||
@ -54,5 +67,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
BreakPeriod destBreak() => Beatmap.Value.Beatmap.Breaks.ElementAt(breakIndex);
|
||||
}
|
||||
|
||||
private void press(Key key)
|
||||
{
|
||||
InputManager.PressKey(key);
|
||||
InputManager.ReleaseKey(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,8 @@ namespace osu.Game.Screens.Play
|
||||
set => CurrentNumber.Value = value;
|
||||
}
|
||||
|
||||
protected override bool AllowKeyboardInputWhenNotHovered => true;
|
||||
|
||||
public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize)
|
||||
{
|
||||
CurrentNumber.MinValue = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user