Loading packages/SystemUI/tests/utils/src/android/animation/AnimatorTestRule.java→tests/testables/src/android/animation/AnimatorTestRule.java +0 −0 File moved. View file tests/testables/tests/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -26,14 +26,18 @@ android_test { platform_apis: true, srcs: [ "src/**/*.java", "src/**/*.kt", "src/**/I*.aidl", ], resource_dirs: ["res"], static_libs: [ "androidx.core_core-animation", "androidx.core_core-ktx", "androidx.test.rules", "hamcrest-library", "mockito-target-inline-minus-junit4", "testables", "truth", ], compile_multilib: "both", jni_libs: [ Loading packages/SystemUI/tests/src/android/animation/AnimatorTestRuleIsolationTest.kt→tests/testables/tests/src/android/animation/AnimatorTestRuleIsolationTest.kt +5 −6 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ import android.testing.AndroidTestingRunner import android.testing.TestableLooper.RunWithLooper import androidx.core.animation.doOnEnd import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.google.common.truth.Truth.assertThat import org.junit.Rule import org.junit.Test Loading @@ -32,7 +31,7 @@ import org.junit.runner.RunWith @RunWith(AndroidTestingRunner::class) @SmallTest @RunWithLooper class AnimatorTestRuleIsolationTest : SysuiTestCase() { class AnimatorTestRuleIsolationTest { @get:Rule val animatorTestRule = AnimatorTestRule(this) Loading @@ -41,7 +40,7 @@ class AnimatorTestRuleIsolationTest : SysuiTestCase() { // GIVEN global state is reset at the start of the test didTouchA = false didTouchB = false // WHEN starting 2 animations of different durations, and setting didTouchA at the end // WHEN starting 2 animations of different durations, and setting didTouch{A,B} at the end ObjectAnimator.ofFloat(0f, 1f).apply { duration = 100 doOnEnd { didTouchA = true } Loading @@ -49,7 +48,7 @@ class AnimatorTestRuleIsolationTest : SysuiTestCase() { } ObjectAnimator.ofFloat(0f, 1f).apply { duration = 150 doOnEnd { didTouchA = true } doOnEnd { didTouchB = true } start() } // WHEN when you advance time so that only one of the animations has ended Loading @@ -65,7 +64,7 @@ class AnimatorTestRuleIsolationTest : SysuiTestCase() { // GIVEN global state is reset at the start of the test didTouchA = false didTouchB = false // WHEN starting 2 animations of different durations, and setting didTouchB at the end // WHEN starting 2 animations of different durations, and setting didTouch{A,B} at the end ObjectAnimator.ofFloat(0f, 1f).apply { duration = 100 doOnEnd { didTouchB = true } Loading @@ -73,7 +72,7 @@ class AnimatorTestRuleIsolationTest : SysuiTestCase() { } ObjectAnimator.ofFloat(0f, 1f).apply { duration = 150 doOnEnd { didTouchB = true } doOnEnd { didTouchA = true } start() } animatorTestRule.advanceTimeBy(100) Loading packages/SystemUI/tests/src/android/animation/AnimatorTestRulePrecisionTest.kt→tests/testables/tests/src/android/animation/AnimatorTestRulePrecisionTest.kt +7 −4 Original line number Diff line number Diff line Loading @@ -17,10 +17,9 @@ package android.animation import android.testing.AndroidTestingRunner import android.testing.TestableLooper.RunWithLooper import android.view.animation.LinearInterpolator import androidx.core.animation.doOnEnd import androidx.test.filters.SmallTest import com.android.app.animation.Interpolators import com.android.systemui.SysuiTestCase import com.google.common.truth.Truth.assertThat import org.junit.Rule import org.junit.Test Loading @@ -29,7 +28,7 @@ import org.junit.runner.RunWith @RunWith(AndroidTestingRunner::class) @SmallTest @RunWithLooper class AnimatorTestRulePrecisionTest : SysuiTestCase() { class AnimatorTestRulePrecisionTest { @get:Rule val animatorTestRule = AnimatorTestRule(this) Loading @@ -43,7 +42,7 @@ class AnimatorTestRulePrecisionTest : SysuiTestCase() { crossinline onEndAction: (animator: Animator) -> Unit, ) { ObjectAnimator.ofFloat(this, propertyName, 0f, 1f).also { it.interpolator = Interpolators.LINEAR it.interpolator = LINEAR_INTERPOLATOR it.duration = duration it.startDelay = startDelay it.doOnEnd(onEndAction) Loading Loading @@ -190,4 +189,8 @@ class AnimatorTestRulePrecisionTest : SysuiTestCase() { assertThat(ended2).isTrue() assertThat(AnimationHandler.getAnimationCount()).isEqualTo(0) } private companion object { private val LINEAR_INTERPOLATOR = LinearInterpolator() } } Loading
packages/SystemUI/tests/utils/src/android/animation/AnimatorTestRule.java→tests/testables/src/android/animation/AnimatorTestRule.java +0 −0 File moved. View file
tests/testables/tests/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -26,14 +26,18 @@ android_test { platform_apis: true, srcs: [ "src/**/*.java", "src/**/*.kt", "src/**/I*.aidl", ], resource_dirs: ["res"], static_libs: [ "androidx.core_core-animation", "androidx.core_core-ktx", "androidx.test.rules", "hamcrest-library", "mockito-target-inline-minus-junit4", "testables", "truth", ], compile_multilib: "both", jni_libs: [ Loading
packages/SystemUI/tests/src/android/animation/AnimatorTestRuleIsolationTest.kt→tests/testables/tests/src/android/animation/AnimatorTestRuleIsolationTest.kt +5 −6 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ import android.testing.AndroidTestingRunner import android.testing.TestableLooper.RunWithLooper import androidx.core.animation.doOnEnd import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.google.common.truth.Truth.assertThat import org.junit.Rule import org.junit.Test Loading @@ -32,7 +31,7 @@ import org.junit.runner.RunWith @RunWith(AndroidTestingRunner::class) @SmallTest @RunWithLooper class AnimatorTestRuleIsolationTest : SysuiTestCase() { class AnimatorTestRuleIsolationTest { @get:Rule val animatorTestRule = AnimatorTestRule(this) Loading @@ -41,7 +40,7 @@ class AnimatorTestRuleIsolationTest : SysuiTestCase() { // GIVEN global state is reset at the start of the test didTouchA = false didTouchB = false // WHEN starting 2 animations of different durations, and setting didTouchA at the end // WHEN starting 2 animations of different durations, and setting didTouch{A,B} at the end ObjectAnimator.ofFloat(0f, 1f).apply { duration = 100 doOnEnd { didTouchA = true } Loading @@ -49,7 +48,7 @@ class AnimatorTestRuleIsolationTest : SysuiTestCase() { } ObjectAnimator.ofFloat(0f, 1f).apply { duration = 150 doOnEnd { didTouchA = true } doOnEnd { didTouchB = true } start() } // WHEN when you advance time so that only one of the animations has ended Loading @@ -65,7 +64,7 @@ class AnimatorTestRuleIsolationTest : SysuiTestCase() { // GIVEN global state is reset at the start of the test didTouchA = false didTouchB = false // WHEN starting 2 animations of different durations, and setting didTouchB at the end // WHEN starting 2 animations of different durations, and setting didTouch{A,B} at the end ObjectAnimator.ofFloat(0f, 1f).apply { duration = 100 doOnEnd { didTouchB = true } Loading @@ -73,7 +72,7 @@ class AnimatorTestRuleIsolationTest : SysuiTestCase() { } ObjectAnimator.ofFloat(0f, 1f).apply { duration = 150 doOnEnd { didTouchB = true } doOnEnd { didTouchA = true } start() } animatorTestRule.advanceTimeBy(100) Loading
packages/SystemUI/tests/src/android/animation/AnimatorTestRulePrecisionTest.kt→tests/testables/tests/src/android/animation/AnimatorTestRulePrecisionTest.kt +7 −4 Original line number Diff line number Diff line Loading @@ -17,10 +17,9 @@ package android.animation import android.testing.AndroidTestingRunner import android.testing.TestableLooper.RunWithLooper import android.view.animation.LinearInterpolator import androidx.core.animation.doOnEnd import androidx.test.filters.SmallTest import com.android.app.animation.Interpolators import com.android.systemui.SysuiTestCase import com.google.common.truth.Truth.assertThat import org.junit.Rule import org.junit.Test Loading @@ -29,7 +28,7 @@ import org.junit.runner.RunWith @RunWith(AndroidTestingRunner::class) @SmallTest @RunWithLooper class AnimatorTestRulePrecisionTest : SysuiTestCase() { class AnimatorTestRulePrecisionTest { @get:Rule val animatorTestRule = AnimatorTestRule(this) Loading @@ -43,7 +42,7 @@ class AnimatorTestRulePrecisionTest : SysuiTestCase() { crossinline onEndAction: (animator: Animator) -> Unit, ) { ObjectAnimator.ofFloat(this, propertyName, 0f, 1f).also { it.interpolator = Interpolators.LINEAR it.interpolator = LINEAR_INTERPOLATOR it.duration = duration it.startDelay = startDelay it.doOnEnd(onEndAction) Loading Loading @@ -190,4 +189,8 @@ class AnimatorTestRulePrecisionTest : SysuiTestCase() { assertThat(ended2).isTrue() assertThat(AnimationHandler.getAnimationCount()).isEqualTo(0) } private companion object { private val LINEAR_INTERPOLATOR = LinearInterpolator() } }