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

        // One fragment with a view
        final AnimatorFragment fragment = new AnimatorFragment();
        fm.beginTransaction().add(R.id.fragmentContainer, fragment).detach(fragment).commit();
        FragmentTestUtil.waitForExecution(mActivityRule);

        fm.beginTransaction()
                .setCustomAnimations(ENTER, EXIT, POP_ENTER, POP_EXIT)
                .attach(fragment)
                .addToBackStack(null)
                .commit();
        FragmentTestUtil.waitForExecution(mActivityRule);

        assertEnterPopExit(fragment);
    }
// Ensure that attaching and popping a Fragment uses the enter and popExit animators
Ensure that attaching and popping a Fragment uses the enter and popExit animators
Ensure that attaching and popping a Fragment uses the enter and popExit animators
@Test
    public void attachAnimators() throws Throwable {
        final FragmentManager fm = mActivityRule.getActivity().getSupportFragmentManager();
        final AnimatorFragment fragment = new AnimatorFragment();
        fm.beginTransaction().add(R.id.fragmentContainer, fragment).detach(fragment).commit();
        FragmentTestUtil.waitForExecution(mActivityRule);
        fm.beginTransaction()
                .setCustomAnimations(ENTER, EXIT, POP_ENTER, POP_EXIT)
                .attach(fragment)
                .addToBackStack(null)
                .commit();
        FragmentTestUtil.waitForExecution(mActivityRule);
        assertEnterPopExit(fragment);
    }
@ Test public void attachAnimators ( ) throws Throwable { final FragmentManager fm = mActivityRule . getActivity ( ) . getSupportFragmentManager ( ) ; final AnimatorFragment fragment = new AnimatorFragment ( ) ; fm . beginTransaction ( ) . add ( R . id . fragmentContainer , fragment ) . detach ( fragment ) . commit ( ) ; FragmentTestUtil . waitForExecution ( mActivityRule ) ; fm . beginTransaction ( ) . setCustomAnimations ( ENTER , EXIT , POP_ENTER , POP_EXIT ) . attach ( fragment ) . addToBackStack ( null ) . commit ( ) ; FragmentTestUtil . waitForExecution ( mActivityRule ) ; assertEnterPopExit ( fragment ) ; }
Ensure that attaching and popping a Fragment uses the enter and popExit animators
Ensure that attaching and popping a Fragment uses the enter and popExit animators
// One fragment with a view