Loading mechanics/tests/src/com/android/mechanics/MotionValueTest.kt +9 −3 Original line number Diff line number Diff line Loading @@ -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() Loading @@ -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 Loading Loading
mechanics/tests/src/com/android/mechanics/MotionValueTest.kt +9 −3 Original line number Diff line number Diff line Loading @@ -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() Loading @@ -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 Loading