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

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

Merge "Handling another case where an endlistener would not be called" into main

parents 85765e08 a36d566e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -224,6 +224,15 @@ class PhysicsPropertyAnimatorTest : SysuiTestCase() {
    @Test
    fun testEndedBeforeStartingCleanupHandler() {
        effectiveProperty.setValue(view, 100f)
        val finishListener2 = Mockito.mock(DynamicAnimation.OnAnimationEndListener::class.java)
        val animationProperties: AnimationProperties =
            object : AnimationProperties() {
                override fun getAnimationEndListener(
                    property: Property<*, *>?
                ): DynamicAnimation.OnAnimationEndListener {
                    return finishListener2
                }
            }
        animationProperties.setDelay(200)
        PhysicsPropertyAnimator.setProperty(
            view,
@@ -240,6 +249,8 @@ class PhysicsPropertyAnimatorTest : SysuiTestCase() {
        Assert.assertTrue(propertyData.offset == 0f)
        Assert.assertTrue(propertyData.animator == null)
        Assert.assertTrue(propertyData.doubleOvershootAvoidingListener == null)
        Mockito.verify(finishListener)?.onAnimationEnd(any(), any(), any(), any())
        Mockito.verify(finishListener2).onAnimationEnd(any(), any(), any(), any())
    }

    @Test
+4 −0
Original line number Diff line number Diff line
@@ -223,6 +223,10 @@ private fun startAnimation(
            0f /* value */,
            0f /* velocity */
        )
        endListener?.onAnimationEnd(propertyData.animator,
            cancelled,
            0f /* value */,
            0f /* velocity */)
        propertyData.animator = null
        propertyData.doubleOvershootAvoidingListener = null
        propertyData.offset = 0f