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

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

Merge "Adopt changes in MotionTestRule API" into main

parents 89af38a6 d1da6788
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")
            }
            }
        )
    }
    }
}
}