Skip to content

Commit 0b1dafc

Browse files
committed
Add similar test coverage for interpolating clock for good measure
1 parent 4c185e5 commit 0b1dafc

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

osu.Framework.Tests/Clocks/InterpolatingFramedClockTest.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,28 @@ public void TestInterpolationAfterSourceStoppedThenSeeked()
250250
Assert.That(interpolating.ElapsedFrameTime, Is.EqualTo(0).Within(100));
251251
}
252252

253+
[TestCase(0)]
254+
[TestCase(1)]
255+
[TestCase(10)]
256+
[TestCase(50)]
257+
public void TestNoInterpolationDrift(int updateRate)
258+
{
259+
var stopwatch = new StopwatchClock();
260+
261+
interpolating.ChangeSource(stopwatch);
262+
263+
source.Start();
264+
stopwatch.Start();
265+
266+
while (interpolating.CurrentTime <= 1000)
267+
{
268+
interpolating.ProcessFrame();
269+
Assert.That(interpolating.CurrentTime, Is.EqualTo(stopwatch.CurrentTime).Within(1));
270+
271+
Thread.Sleep(updateRate);
272+
}
273+
}
274+
253275
[Test]
254276
public void InterpolationStaysWithinBounds()
255277
{

0 commit comments

Comments
 (0)