Skip to content

Commit

Permalink
Fix DecouplingFramedClock retaining old lastSeekFailed
Browse files Browse the repository at this point in the history
  • Loading branch information
hwsmm committed Sep 21, 2024
1 parent 23e6932 commit 41a05e0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions osu.Framework.Tests/Clocks/DecouplingFramedClockTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,26 @@ public void TestForwardPlaybackOverLengthBoundary()
Assert.That(source.IsRunning, Is.False);
}

[Test]
public void TestPlayDifferentSourceAfterSeekFailure()
{
decouplingClock.AllowDecoupling = true;

var firstSource = (TestClockWithRange)source;
firstSource.MaxTime = 100;

decouplingClock.Seek(1000);

Assert.That(firstSource.IsRunning, Is.False);

var secondSource = new TestClockWithRange();

decouplingClock.ChangeSource(secondSource);
decouplingClock.Start();

Assert.That(secondSource.IsRunning, Is.True);
}

#endregion

private class TestClockWithRange : TestClock
Expand Down
1 change: 1 addition & 0 deletions osu.Framework/Timing/DecouplingFramedClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public void ChangeSource(IClock? source)
adjustableSourceClock = adjustableSource;
currentTime = adjustableSource.CurrentTime;
shouldBeRunning = adjustableSource.IsRunning;
lastSeekFailed = false;
}

#endregion
Expand Down

0 comments on commit 41a05e0

Please sign in to comment.