mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:05:37 +08:00
Add failing test case for frame stable clock direction flip scenario
This commit is contained in:
parent
c251a3016e
commit
b1ad3161dd
@ -103,6 +103,30 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
checkFrameCount(0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSeekToSameTimePreservesRate()
|
||||
{
|
||||
AddStep("set manual clock rate", () => manualClock.Rate = 1);
|
||||
seekManualTo(5000);
|
||||
createStabilityContainer();
|
||||
checkRate(1);
|
||||
|
||||
seekManualTo(10000);
|
||||
checkRate(1);
|
||||
|
||||
seekManualTo(10000);
|
||||
checkRate(1);
|
||||
|
||||
seekManualTo(5000);
|
||||
checkRate(-1);
|
||||
|
||||
seekManualTo(5000);
|
||||
checkRate(-1);
|
||||
|
||||
seekManualTo(10000);
|
||||
checkRate(1);
|
||||
}
|
||||
|
||||
private const int max_frames_catchup = 50;
|
||||
|
||||
private void createStabilityContainer(double gameplayStartTime = double.MinValue) => AddStep("create container", () =>
|
||||
@ -116,6 +140,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
private void checkFrameCount(int frames) =>
|
||||
AddAssert($"elapsed frames is {frames}", () => consumer.ElapsedFrames == frames);
|
||||
|
||||
private void checkRate(double rate) =>
|
||||
AddAssert($"clock rate is {rate}", () => consumer.Clock.Rate == rate);
|
||||
|
||||
public class ClockConsumingChild : CompositeDrawable
|
||||
{
|
||||
private readonly OsuSpriteText text;
|
||||
|
Loading…
Reference in New Issue
Block a user