From 41a05e0f0cd15294743a670a6a09bdae377977ca Mon Sep 17 00:00:00 2001 From: hwsmm <9151706+hwsmm@users.noreply.github.com> Date: Sun, 22 Sep 2024 02:34:13 +0900 Subject: [PATCH] Fix DecouplingFramedClock retaining old lastSeekFailed --- .../Clocks/DecouplingFramedClockTest.cs | 20 +++++++++++++++++++ osu.Framework/Timing/DecouplingFramedClock.cs | 1 + 2 files changed, 21 insertions(+) diff --git a/osu.Framework.Tests/Clocks/DecouplingFramedClockTest.cs b/osu.Framework.Tests/Clocks/DecouplingFramedClockTest.cs index ba135aa60d..b5b645904e 100644 --- a/osu.Framework.Tests/Clocks/DecouplingFramedClockTest.cs +++ b/osu.Framework.Tests/Clocks/DecouplingFramedClockTest.cs @@ -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 diff --git a/osu.Framework/Timing/DecouplingFramedClock.cs b/osu.Framework/Timing/DecouplingFramedClock.cs index 9a96cc4b49..e8b000680c 100644 --- a/osu.Framework/Timing/DecouplingFramedClock.cs +++ b/osu.Framework/Timing/DecouplingFramedClock.cs @@ -155,6 +155,7 @@ public void ChangeSource(IClock? source) adjustableSourceClock = adjustableSource; currentTime = adjustableSource.CurrentTime; shouldBeRunning = adjustableSource.IsRunning; + lastSeekFailed = false; } #endregion