fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimationTest.java
@Test
    public void clearAnimations() throws Throwable {
        final FragmentManager fm = mActivityRule.getActivity().getSupportFragmentManager();

        final StrictViewFragment fragment1 = new StrictViewFragment();
        fm.beginTransaction()
                .add(R.id.fragmentContainer, fragment1)
                .setReorderingAllowed(true)
                .commit();
        FragmentTestUtil.waitForExecution(mActivityRule);

        final View fragmentView = fragment1.getView();

        final TranslateAnimation xAnimation = new TranslateAnimation(0, 1000, 0, 0);
        mActivityRule.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                fragmentView.startAnimation(xAnimation);
            }
        });

        FragmentTestUtil.waitForExecution(mActivityRule);
        FragmentTestUtil.popBackStackImmediate(mActivityRule);
        mActivityRule.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                assertNull(fragmentView.getAnimation());
            }
        });
    }
// test to see if the animation is still running.
test to see if the animation is still running.
test to see if the animation is still running .
@Test
    public void clearAnimations() throws Throwable {
        final FragmentManager fm = mActivityRule.getActivity().getSupportFragmentManager();
        final StrictViewFragment fragment1 = new StrictViewFragment();
        fm.beginTransaction()
                .add(R.id.fragmentContainer, fragment1)
                .setReorderingAllowed(true)
                .commit();
        FragmentTestUtil.waitForExecution(mActivityRule);
        final View fragmentView = fragment1.getView();
        final TranslateAnimation xAnimation = new TranslateAnimation(0, 1000, 0, 0);
        mActivityRule.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                fragmentView.startAnimation(xAnimation);
            }
        });
        FragmentTestUtil.waitForExecution(mActivityRule);
        FragmentTestUtil.popBackStackImmediate(mActivityRule);
        mActivityRule.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                assertNull(fragmentView.getAnimation());
            }
        });
    }
@ Test public void clearAnimations ( ) throws Throwable { final FragmentManager fm = mActivityRule . getActivity ( ) . getSupportFragmentManager ( ) ; final StrictViewFragment fragment1 = new StrictViewFragment ( ) ; fm . beginTransaction ( ) . add ( R . id . fragmentContainer , fragment1 ) . setReorderingAllowed ( true ) . commit ( ) ; FragmentTestUtil . waitForExecution ( mActivityRule ) ; final View fragmentView = fragment1 . getView ( ) ; final TranslateAnimation xAnimation = new TranslateAnimation ( 0 , 1000 , 0 , 0 ) ; mActivityRule . runOnUiThread ( new Runnable ( ) { @ Override public void run ( ) { fragmentView . startAnimation ( xAnimation ) ; } } ) ; FragmentTestUtil . waitForExecution ( mActivityRule ) ; FragmentTestUtil . popBackStackImmediate ( mActivityRule ) ; mActivityRule . runOnUiThread ( new Runnable ( ) { @ Override public void run ( ) { assertNull ( fragmentView . getAnimation ( ) ) ; } } ) ; }
test to see if the animation is still running.
test to see if the animation is still running .