Merge pull request #28772 from OliBomby/time-accurate

Fix CurrentTimeAccurate being inaccurate
This commit is contained in:
Bartłomiej Dach 2024-07-08 14:50:13 +02:00 committed by GitHub
commit baff790b4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -104,6 +104,17 @@ namespace osu.Game.Tests.Visual.Editing
AddUntilStep("time is clamped to track length", () => EditorClock.CurrentTime, () => Is.EqualTo(EditorClock.TrackLength));
}
[Test]
public void TestCurrentTimeDoubleTransform()
{
AddAssert("seek smoothly twice and current time is accurate", () =>
{
EditorClock.SeekSmoothlyTo(1000);
EditorClock.SeekSmoothlyTo(2000);
return 2000 == EditorClock.CurrentTimeAccurate;
});
}
[Test]
public void TestAdjustmentsRemovedOnDisposal()
{

View File

@ -154,7 +154,7 @@ namespace osu.Game.Screens.Edit
/// The current time of this clock, include any active transform seeks performed via <see cref="SeekSmoothlyTo"/>.
/// </summary>
public double CurrentTimeAccurate =>
Transforms.OfType<TransformSeek>().FirstOrDefault()?.EndValue ?? CurrentTime;
Transforms.OfType<TransformSeek>().LastOrDefault()?.EndValue ?? CurrentTime;
public double CurrentTime => underlyingClock.CurrentTime;