Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CurrentTimeAccurate being inaccurate #28772

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ public void TestClampWhenSeekOutsideBeatmapBounds()
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()
{
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Screens/Edit/EditorClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private void seek(int direction, bool snapped, double amount = 1)
/// 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;

Expand Down
Loading