mirror of
https://github.com/ppy/osu.git
synced 2025-01-18 11:02:57 +08:00
Add failing test coverage showing offset adjust is not limited correctly
This commit is contained in:
parent
471180d947
commit
a4174a3644
@ -317,6 +317,82 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
AddUntilStep("wait for song select", () => songSelect.IsCurrentScreen());
|
AddUntilStep("wait for song select", () => songSelect.IsCurrentScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestOffsetAdjustDuringPause()
|
||||||
|
{
|
||||||
|
Player player = null;
|
||||||
|
|
||||||
|
Screens.Select.SongSelect songSelect = null;
|
||||||
|
PushAndConfirm(() => songSelect = new TestPlaySongSelect());
|
||||||
|
AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded);
|
||||||
|
|
||||||
|
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
||||||
|
|
||||||
|
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
||||||
|
|
||||||
|
AddStep("set mods", () => Game.SelectedMods.Value = new Mod[] { new OsuModNoFail() });
|
||||||
|
AddStep("press enter", () => InputManager.Key(Key.Enter));
|
||||||
|
|
||||||
|
AddUntilStep("wait for player", () =>
|
||||||
|
{
|
||||||
|
DismissAnyNotifications();
|
||||||
|
player = Game.ScreenStack.CurrentScreen as Player;
|
||||||
|
return player?.IsLoaded == true;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("wait for track playing", () => Game.Beatmap.Value.Track.IsRunning);
|
||||||
|
checkOffset(0);
|
||||||
|
|
||||||
|
AddStep("adjust offset via keyboard", () => InputManager.Key(Key.Minus));
|
||||||
|
checkOffset(-1);
|
||||||
|
|
||||||
|
AddStep("pause", () => player.ChildrenOfType<GameplayClockContainer>().First().Stop());
|
||||||
|
AddUntilStep("wait for pause", () => player.ChildrenOfType<GameplayClockContainer>().First().IsPaused.Value, () => Is.True);
|
||||||
|
AddStep("attempt adjust offset via keyboard", () => InputManager.Key(Key.Minus));
|
||||||
|
checkOffset(-1);
|
||||||
|
|
||||||
|
void checkOffset(double offset) => AddUntilStep($"offset is {offset}", () => Game.BeatmapManager.QueryBeatmap(b => b.ID == Game.Beatmap.Value.BeatmapInfo.ID)!.UserSettings.Offset,
|
||||||
|
() => Is.EqualTo(offset));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestOffsetAdjustDuringGameplay()
|
||||||
|
{
|
||||||
|
Player player = null;
|
||||||
|
|
||||||
|
Screens.Select.SongSelect songSelect = null;
|
||||||
|
PushAndConfirm(() => songSelect = new TestPlaySongSelect());
|
||||||
|
AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded);
|
||||||
|
|
||||||
|
AddStep("import beatmap", () => BeatmapImportHelper.LoadOszIntoOsu(Game).WaitSafely());
|
||||||
|
|
||||||
|
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
||||||
|
|
||||||
|
AddStep("set mods", () => Game.SelectedMods.Value = new Mod[] { new OsuModNoFail() });
|
||||||
|
AddStep("press enter", () => InputManager.Key(Key.Enter));
|
||||||
|
|
||||||
|
AddUntilStep("wait for player", () =>
|
||||||
|
{
|
||||||
|
DismissAnyNotifications();
|
||||||
|
player = Game.ScreenStack.CurrentScreen as Player;
|
||||||
|
return player?.IsLoaded == true;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("wait for track playing", () => Game.Beatmap.Value.Track.IsRunning);
|
||||||
|
checkOffset(0);
|
||||||
|
|
||||||
|
AddStep("adjust offset via keyboard", () => InputManager.Key(Key.Minus));
|
||||||
|
checkOffset(-1);
|
||||||
|
|
||||||
|
AddStep("seek beyond 10 seconds", () => player.ChildrenOfType<GameplayClockContainer>().First().Seek(10500));
|
||||||
|
AddUntilStep("wait for seek", () => player.ChildrenOfType<GameplayClockContainer>().First().CurrentTime, () => Is.GreaterThan(10600));
|
||||||
|
AddStep("attempt adjust offset via keyboard", () => InputManager.Key(Key.Minus));
|
||||||
|
checkOffset(-1);
|
||||||
|
|
||||||
|
void checkOffset(double offset) => AddUntilStep($"offset is {offset}", () => Game.BeatmapManager.QueryBeatmap(b => b.ID == Game.Beatmap.Value.BeatmapInfo.ID)!.UserSettings.Offset,
|
||||||
|
() => Is.EqualTo(offset));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestRetryCountIncrements()
|
public void TestRetryCountIncrements()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user