Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a739e95b authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix flakiness in MotionValue test" into main

parents 9142dc1d f06ee379
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -434,6 +434,8 @@ class MotionValueTest {
            assertThat(framesCount).isEqualTo(it + 1)
        }

        val timeBeforeAutoAdvance = rule.mainClock.currentTime

        // But this will stop as soon as the animation is finished. Skip forward.
        rule.mainClock.autoAdvance = true
        rule.awaitIdle()
@@ -442,9 +444,13 @@ class MotionValueTest {
        assertThat(inspector.frame.isStable).isTrue()
        // ... and animations are suspended again.
        assertThat(inspector.isAnimating).isFalse()
        // Without too many assumptions about how long it took to settle the spring, should be
        // more than  160ms
        assertThat(framesCount).isGreaterThan(10)

        rule.awaitIdle()

        // Stabilizing the spring during awaitIdle() took 176ms (obtained from looking at reference
        // test runs). That time is expected to be 100% reproducible, given the starting
        // state/configuration of the spring before awaitIdle().
        assertThat(rule.mainClock.currentTime).isEqualTo(timeBeforeAutoAdvance + 176)
    }

    @Test