1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-01 00:39:11 +08:00

Add test coverage of user offset being set before construction of MasterGameplayClockContainer

This commit is contained in:
Dean Herbert 2022-03-24 14:55:01 +09:00
parent 16dc2f6ef5
commit 1049e349e3

View File

@ -73,11 +73,15 @@ namespace osu.Game.Tests.Gameplay
public void TestSeekPerformsInGameplayTime( public void TestSeekPerformsInGameplayTime(
[Values(1.0, 0.5, 2.0)] double clockRate, [Values(1.0, 0.5, 2.0)] double clockRate,
[Values(0.0, 200.0, -200.0)] double userOffset, [Values(0.0, 200.0, -200.0)] double userOffset,
[Values(false, true)] bool whileStopped) [Values(false, true)] bool whileStopped,
[Values(false, true)] bool setAudioOffsetBeforeConstruction)
{ {
ClockBackedTestWorkingBeatmap working = null; ClockBackedTestWorkingBeatmap working = null;
GameplayClockContainer gameplayClockContainer = null; GameplayClockContainer gameplayClockContainer = null;
if (setAudioOffsetBeforeConstruction)
AddStep($"preset audio offset to {userOffset}", () => localConfig.SetValue(OsuSetting.AudioOffset, userOffset));
AddStep("create container", () => AddStep("create container", () =>
{ {
working = new ClockBackedTestWorkingBeatmap(new OsuRuleset().RulesetInfo, new FramedClock(new ManualClock()), Audio); working = new ClockBackedTestWorkingBeatmap(new OsuRuleset().RulesetInfo, new FramedClock(new ManualClock()), Audio);
@ -89,6 +93,8 @@ namespace osu.Game.Tests.Gameplay
}); });
AddStep($"set clock rate to {clockRate}", () => working.Track.AddAdjustment(AdjustableProperty.Frequency, new BindableDouble(clockRate))); AddStep($"set clock rate to {clockRate}", () => working.Track.AddAdjustment(AdjustableProperty.Frequency, new BindableDouble(clockRate)));
if (!setAudioOffsetBeforeConstruction)
AddStep($"set audio offset to {userOffset}", () => localConfig.SetValue(OsuSetting.AudioOffset, userOffset)); AddStep($"set audio offset to {userOffset}", () => localConfig.SetValue(OsuSetting.AudioOffset, userOffset));
AddStep("seek to 2500", () => gameplayClockContainer.Seek(2500)); AddStep("seek to 2500", () => gameplayClockContainer.Seek(2500));