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

Commit 332cb167 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Adopt end animation callback adjustment for QSIconViewImplTest

With Animator.setPostNotifyEndListenerEnabled set to true
(for excluding potential heavy operation from last animating frame),
the end callback will be notified on next frame. So make the test
compatible with the behavior.

See Idb7be51f5d01e080f2375dd3d022915d48b5cc53

Bug: 300035126
Flag: com.android.window.flags.system_ui_post_animation_end
Test: atest SystemUITests:QSIconViewImplTest_311121830
Change-Id: I78c020e944d5206c7aadfa3e524d410916ab4270
parent 73a98226
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.systemui.qs.tileimpl

import android.animation.AnimatorTestRule
import android.content.Context
import android.service.quicksettings.Tile
import android.view.ContextThemeWrapper
@@ -26,6 +25,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.annotation.UiThreadTest
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.animation.AnimatorTestRule
import com.android.systemui.plugins.qs.QSTile
import com.android.systemui.res.R
import com.android.systemui.statusbar.connectivity.WifiIcons
@@ -77,7 +77,7 @@ class QSIconViewImplTest_311121830 : SysuiTestCase() {
        // Set the second state to animate (it shouldn't, because `State.state` is the same) and
        // advance time to 2 animations length
        iconView.setIcon(secondState, /* allowAnimations= */ true)
        animatorRule.advanceTimeBy(QSIconViewImpl.QS_ANIM_LENGTH * 2)
        animatorRule.advanceAnimationDuration(QSIconViewImpl.QS_ANIM_LENGTH * 2)

        assertThat(iconView.mLastIcon).isEqualTo(secondState.icon)
    }
@@ -126,7 +126,7 @@ class QSIconViewImplTest_311121830 : SysuiTestCase() {
        // Set the third state to animate and advance time by two times the animation length
        // to guarantee that all animations are done
        iconView.setIcon(thirdState, /* allowAnimations= */ true)
        animatorRule.advanceTimeBy(QSIconViewImpl.QS_ANIM_LENGTH * 2)
        animatorRule.advanceAnimationDuration(QSIconViewImpl.QS_ANIM_LENGTH * 2)

        assertThat(iconView.mLastIcon).isEqualTo(thirdState.icon)
    }