Skip to content

Commit

Permalink
Merge pull request #6378 from hwsmm/reset-decoupling
Browse files Browse the repository at this point in the history
Fix DecouplingFramedClock retaining old lastSeekFailed
  • Loading branch information
peppy committed Sep 22, 2024
2 parents 23e6932 + 41a05e0 commit fbfb0ef
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 fbfb0ef

Please sign in to comment.