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

Commit ad455365 authored by Ang Li's avatar Ang Li Committed by Android (Google) Code Review
Browse files

Merge "Add test for quick switch animation race condition" into main

parents e47b183a 2dcec3b1
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -190,6 +190,27 @@ class BubbleBarAnimationHelperTest {
        assertThat(toBubble.bubbleBarExpandedView?.isSurfaceZOrderedOnTop).isFalse()
    }

    @Test
    fun animateSwitch_quickSwitch_newlySelectedIsVisible() {
        val bubbleA = createBubble(key = "A").initialize(container)
        val bubbleB = createBubble(key = "B").initialize(container)

        activityScenario.onActivity {
            // Start an animation from A to B
            animationHelper.animateSwitch(
                    bubbleA, bubbleB, /* shouldApplyAsJumpcut= */ false, /* endRunnable= */ null)
            // This simulates Bubble B has finished animating out
            bubbleB.bubbleBarExpandedView!!.visibility = View.INVISIBLE
            // Let it run for a bit, but not finish
            animatorTestRule.advanceTimeBy(100)
        }
        getInstrumentation().waitForIdleSync()

        // Assert that even though we manually set it to INVISIBLE, the animation start
        // callback has corrected it to VISIBLE.
        assertThat(bubbleB.bubbleBarExpandedView?.visibility).isEqualTo(View.VISIBLE)
    }

    @Test
    fun animateSwitch_bubbleToBubble_handleColorTransferred() {
        val fromBubble = createBubble(key = "from").initialize(container)