Skip to content

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

Open
@peppy

Description

@peppy

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).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions