Remove tests for removed API in Animation
The methods add/removeAnimationListener have been withdrawn before they
were released, so the tests can be removed as well.
Bug: 117519981
Test: atest AnimationTest
Change-Id: I2daf1e328116388ac25533c38cc3dc951089957c
diff --git a/tests/tests/view/src/android/view/animation/cts/AnimationTest.java b/tests/tests/view/src/android/view/animation/cts/AnimationTest.java
index fb9e27d..5fe1141 100644
--- a/tests/tests/view/src/android/view/animation/cts/AnimationTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AnimationTest.java
@@ -599,90 +599,6 @@
}
@Test
- public void testAddRemoveAnimationListener() throws Throwable {
- final View animWindow = mActivity.findViewById(R.id.anim_window);
-
- // XML file of R.anim.accelerate_alpha
- // <alpha xmlns:android="http://schemas.android.com/apk/res/android"
- // android:interpolator="@android:anim/accelerate_interpolator"
- // android:fromAlpha="0.1"
- // android:toAlpha="0.9"
- // android:duration="1000" />
- final Animation anim = AnimationUtils.loadAnimation(mActivity, R.anim.accelerate_alpha);
- // Speed things up a little
- anim.setDuration(10);
-
- final AnimationListener l1 = mock(AnimationListener.class);
- final AnimationListener l2 = mock(AnimationListener.class);
- final AnimationListener l3 = mock(AnimationListener.class);
- final AnimationListener l4 = mock(AnimationListener.class);
-
- // Test that adding listeners does not remove the set listener
- anim.setAnimationListener(l1);
- anim.addAnimationListener(l2);
- anim.addAnimationListener(l3);
- verifyZeroInteractions(l1, l2, l3, l4);
-
- // set: l1
- // added: l2, l3
- AnimationTestUtils.assertRunAnimation(mInstrumentation, mActivityRule, animWindow, anim);
- verifyListeners(anim, l1, l2, l3);
- verifyZeroInteractions(l4);
-
- // Test that setting a listener does not remove the added listeners
- reset(l1, l2, l3, l4);
- anim.setAnimationListener(l4);
- verifyZeroInteractions(l1, l2, l3, l4);
-
- // set: l4
- // added: l2, l3
- AnimationTestUtils.assertRunAnimation(mInstrumentation, mActivityRule, animWindow, anim);
- verifyListeners(anim, l2, l3, l4);
- verifyZeroInteractions(l1);
-
- // Test that removing a listener does not affect the set listener
- reset(l1, l2, l3, l4);
- anim.removeAnimationListener(l2);
- verifyZeroInteractions(l1, l2, l3, l4);
-
- // set: l4
- // added: l3
- AnimationTestUtils.assertRunAnimation(mInstrumentation, mActivityRule, animWindow, anim);
- verifyListeners(anim, l3, l4);
- verifyZeroInteractions(l1, l2);
-
- // Test that removing the set listener does not affect the set listener
- reset(l1, l2, l3, l4);
- anim.removeAnimationListener(l4);
- verifyZeroInteractions(l1, l2, l3, l4);
-
- // set: l4
- // added: l3
- AnimationTestUtils.assertRunAnimation(mInstrumentation, mActivityRule, animWindow, anim);
- verifyListeners(anim, l3, l4);
- verifyZeroInteractions(l1, l2);
-
- // Test that setting the set listener to null does not remove the added listeners
- reset(l1, l2, l3, l4);
- anim.setAnimationListener(null);
- verifyZeroInteractions(l1, l2, l3, l4);
-
- // set: null
- // added: l3
- AnimationTestUtils.assertRunAnimation(mInstrumentation, mActivityRule, animWindow, anim);
- verifyListeners(anim, l3);
- verifyZeroInteractions(l1, l2, l4);
- }
-
- private void verifyListeners(Animation anim, AnimationListener... listeners) {
- for (AnimationListener listener : listeners) {
- verify(listener, times(1)).onAnimationStart(anim);
- verify(listener, times(1)).onAnimationEnd(anim);
- verify(listener, never()).onAnimationRepeat(anim);
- }
- }
-
- @Test
public void testStart() {
Animation animation = AnimationUtils.loadAnimation(mActivity, R.anim.accelerate_alpha);
animation.setStartTime(0);