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

Commit d1da6788 authored by Mike Schneider's avatar Mike Schneider
Browse files

Adopt changes in MotionTestRule API

Bug: 322324387
Test: Unit tests
Flag: NA
Change-Id: Ib94825e49c43fc3d4b84535fc40807d4f4cb2ae6
parent 609b96c7
Loading
Loading
Loading
Loading
+15 −12
Original line number Original line Diff line number Diff line
@@ -28,10 +28,13 @@ import com.android.systemui.activity.EmptyTestActivity
import org.junit.Rule
import org.junit.Rule
import org.junit.Test
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runner.RunWith
import platform.test.motion.MotionTestRule
import platform.test.motion.RecordedMotion
import platform.test.motion.RecordedMotion
import platform.test.motion.Sampling.Companion.evenlySampled
import platform.test.motion.view.AnimationSampling.Companion.evenlySampled
import platform.test.motion.view.DrawableFeatureCaptures
import platform.test.motion.view.DrawableFeatureCaptures
import platform.test.motion.view.ViewMotionTestRule
import platform.test.motion.view.ViewRecordingSpec.Companion.captureWithoutScreenshot
import platform.test.motion.view.ViewToolkit
import platform.test.motion.view.record
import platform.test.screenshot.DeviceEmulationRule
import platform.test.screenshot.DeviceEmulationRule
import platform.test.screenshot.DeviceEmulationSpec
import platform.test.screenshot.DeviceEmulationSpec
import platform.test.screenshot.DisplaySpec
import platform.test.screenshot.DisplaySpec
@@ -64,7 +67,8 @@ class TransitionAnimatorTest : SysuiTestCase() {


    @get:Rule(order = 0) val deviceEmulationRule = DeviceEmulationRule(emulationSpec)
    @get:Rule(order = 0) val deviceEmulationRule = DeviceEmulationRule(emulationSpec)
    @get:Rule(order = 1) val activityRule = ActivityScenarioRule(EmptyTestActivity::class.java)
    @get:Rule(order = 1) val activityRule = ActivityScenarioRule(EmptyTestActivity::class.java)
    @get:Rule(order = 2) val motionRule = ViewMotionTestRule(pathManager, { activityRule.scenario })
    @get:Rule(order = 2)
    val motionRule = MotionTestRule(ViewToolkit { activityRule.scenario }, pathManager)


    @Test
    @Test
    fun backgroundAnimation_whenLaunching() {
    fun backgroundAnimation_whenLaunching() {
@@ -151,15 +155,14 @@ class TransitionAnimatorTest : SysuiTestCase() {
        backgroundLayer: GradientDrawable,
        backgroundLayer: GradientDrawable,
        animator: AnimatorSet
        animator: AnimatorSet
    ): RecordedMotion {
    ): RecordedMotion {
        return motionRule.checkThat(animator).record(
        return motionRule.record(
            backgroundLayer,
            animator,
            evenlySampled(20),
            backgroundLayer.captureWithoutScreenshot(evenlySampled(20)) {
            visualCapture = null
                feature(DrawableFeatureCaptures.bounds, "bounds")
        ) {
                feature(DrawableFeatureCaptures.cornerRadii, "corner_radii")
            capture(DrawableFeatureCaptures.bounds, "bounds")
                feature(DrawableFeatureCaptures.alpha, "alpha")
            capture(DrawableFeatureCaptures.cornerRadii, "corner_radii")
            capture(DrawableFeatureCaptures.alpha, "alpha")
            }
            }
        )
    }
    }
}
}