fragment/src/androidTest/java/androidx/fragment/app/PostponedTransitionTest.java
@Test
    public void popPostponedTransaction() throws Throwable {
        final FragmentManager fm = mActivityRule.getActivity().getSupportFragmentManager();
        final View startBlue = mBeginningFragment.getView().findViewById(R.id.blueSquare);

        final TransitionFragment fragment = new PostponedFragment2();

        fm.beginTransaction()
                .addSharedElement(startBlue, "blueSquare")
                .replace(R.id.fragmentContainer, fragment)
                .addToBackStack(null)
                .setReorderingAllowed(true)
                .commit();
        FragmentTestUtil.waitForExecution(mActivityRule);

        assertPostponedTransition(mBeginningFragment, fragment, null);

        FragmentTestUtil.popBackStackImmediate(mActivityRule);

        fragment.waitForNoTransition();
        mBeginningFragment.waitForNoTransition();

        assureNoTransition(fragment);
        assureNoTransition(mBeginningFragment);

        assertFalse(fragment.isAdded());
        assertNull(fragment.getView());
        assertNotNull(mBeginningFragment.getView());
        assertEquals(View.VISIBLE, mBeginningFragment.getView().getVisibility());
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            assertEquals(1f, mBeginningFragment.getView().getAlpha(), 0f);
        }
        assertTrue(mBeginningFragment.getView().isAttachedToWindow());
    }
// the transaction results in the original state with no transition.
the transaction results in the original state with no transition.
the transaction results in the original state with no transition .
@Test
    public void popPostponedTransaction() throws Throwable {
        final FragmentManager fm = mActivityRule.getActivity().getSupportFragmentManager();
        final View startBlue = mBeginningFragment.getView().findViewById(R.id.blueSquare);
        final TransitionFragment fragment = new PostponedFragment2();
        fm.beginTransaction()
                .addSharedElement(startBlue, "blueSquare")
                .replace(R.id.fragmentContainer, fragment)
                .addToBackStack(null)
                .setReorderingAllowed(true)
                .commit();
        FragmentTestUtil.waitForExecution(mActivityRule);
        assertPostponedTransition(mBeginningFragment, fragment, null);
        FragmentTestUtil.popBackStackImmediate(mActivityRule);
        fragment.waitForNoTransition();
        mBeginningFragment.waitForNoTransition();
        assureNoTransition(fragment);
        assureNoTransition(mBeginningFragment);
        assertFalse(fragment.isAdded());
        assertNull(fragment.getView());
        assertNotNull(mBeginningFragment.getView());
        assertEquals(View.VISIBLE, mBeginningFragment.getView().getVisibility());
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            assertEquals(1f, mBeginningFragment.getView().getAlpha(), 0f);
        }
        assertTrue(mBeginningFragment.getView().isAttachedToWindow());
    }
@ Test public void popPostponedTransaction ( ) throws Throwable { final FragmentManager fm = mActivityRule . getActivity ( ) . getSupportFragmentManager ( ) ; final View startBlue = mBeginningFragment . getView ( ) . findViewById ( R . id . blueSquare ) ; final TransitionFragment fragment = new PostponedFragment2 ( ) ; fm . beginTransaction ( ) . addSharedElement ( startBlue , "blueSquare" ) . replace ( R . id . fragmentContainer , fragment ) . addToBackStack ( null ) . setReorderingAllowed ( true ) . commit ( ) ; FragmentTestUtil . waitForExecution ( mActivityRule ) ; assertPostponedTransition ( mBeginningFragment , fragment , null ) ; FragmentTestUtil . popBackStackImmediate ( mActivityRule ) ; fragment . waitForNoTransition ( ) ; mBeginningFragment . waitForNoTransition ( ) ; assureNoTransition ( fragment ) ; assureNoTransition ( mBeginningFragment ) ; assertFalse ( fragment . isAdded ( ) ) ; assertNull ( fragment . getView ( ) ) ; assertNotNull ( mBeginningFragment . getView ( ) ) ; assertEquals ( View . VISIBLE , mBeginningFragment . getView ( ) . getVisibility ( ) ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . HONEYCOMB ) { assertEquals ( 1f , mBeginningFragment . getView ( ) . getAlpha ( ) , 0f ) ; } assertTrue ( mBeginningFragment . getView ( ) . isAttachedToWindow ( ) ) ; }
the transaction results in the original state with no transition.
the transaction results in the original state with no transition .