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

Using Loop to create a loop in the past doesn't work as expected #6482

Open
peppy opened this issue Jan 2, 2025 · 0 comments
Open

Using Loop to create a loop in the past doesn't work as expected #6482

peppy opened this issue Jan 2, 2025 · 0 comments

Comments

@peppy
Copy link
Member

peppy commented Jan 2, 2025

Failing test:

diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneTransformRewinding.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneTransformRewinding.cs
index 868aa4a69..9de3b6b84 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneTransformRewinding.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneTransformRewinding.cs
@@ -240,6 +240,34 @@ public void StartInMiddleOfSequence()
             AddAssert("check transform count", () => box.Transforms.Count() == 3);
         }
 
+        [Test]
+        public void RewindWithLoop()
+        {
+            boxTest(box => box.Alpha = 0);
+
+            // move forward to future point in time before adding transforms.
+            checkAtTime(interval * 4, _ => true);
+
+            AddStep("add transforms", () =>
+            {
+                using (box.BeginAbsoluteSequence(0))
+                {
+                    box.ClearTransforms();
+
+                    box.FadeOutFromOne(interval)
+                       .Then()
+                       .FadeIn(interval)
+                       .Loop();
+                }
+            });
+
+            checkAtTime(0, box => Precision.AlmostEquals(box.Alpha, 1));
+            checkAtTime(interval * 1, box => Precision.AlmostEquals(box.Alpha, 0));
+            checkAtTime(interval * 2, box => Precision.AlmostEquals(box.Alpha, 1));
+            checkAtTime(interval * 3, box => Precision.AlmostEquals(box.Alpha, 0));
+            checkAtTime(interval * 4, box => Precision.AlmostEquals(box.Alpha, 1));
+        }
+
         [Test]
         public void RewindBetweenDisparateValues()
         {

We do this in osu! hitobjects (reverse arrows as one example) and expect it to work, at least when RemoveCompletedTransforms is disabled (to allow rewinding).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant