preference/src/androidTest/java/androidx/preference/PreferenceGroupInitialExpandedChildrenCountTest.java
@Test
    @UiThreadTest
    public void saveInstanceState_shouldSaveMaxNumberOfChildrenToShow() {
        // No limit set, should save max value
        Parcelable state = mScreen.onSaveInstanceState();
        assertEquals(PreferenceGroup.SavedState.class, state.getClass());
        assertEquals(Integer.MAX_VALUE,
                ((PreferenceGroup.SavedState) state).mInitialExpandedChildrenCount);

        // Has limit set, should save limit
        mScreen.setInitialExpandedChildrenCount(INITIAL_EXPANDED_COUNT);
        state = mScreen.onSaveInstanceState();
        assertEquals(PreferenceGroup.SavedState.class, state.getClass());
        assertEquals(INITIAL_EXPANDED_COUNT,
                ((PreferenceGroup.SavedState) state).mInitialExpandedChildrenCount);
    }
/**
     * Verifies that the correct maximum number of preferences to show is being saved in the
     * instance state.
     */
Verifies that the correct maximum number of preferences to show is being saved in the
instance state.
Verifies that the correct maximum number of preferences to show is being saved in the instance state .
@Test
    @UiThreadTest
    public void saveInstanceState_shouldSaveMaxNumberOfChildrenToShow() {
        Parcelable state = mScreen.onSaveInstanceState();
        assertEquals(PreferenceGroup.SavedState.class, state.getClass());
        assertEquals(Integer.MAX_VALUE,
                ((PreferenceGroup.SavedState) state).mInitialExpandedChildrenCount);
        mScreen.setInitialExpandedChildrenCount(INITIAL_EXPANDED_COUNT);
        state = mScreen.onSaveInstanceState();
        assertEquals(PreferenceGroup.SavedState.class, state.getClass());
        assertEquals(INITIAL_EXPANDED_COUNT,
                ((PreferenceGroup.SavedState) state).mInitialExpandedChildrenCount);
    }
@ Test @ UiThreadTest public void saveInstanceState_shouldSaveMaxNumberOfChildrenToShow ( ) { Parcelable state = mScreen . onSaveInstanceState ( ) ; assertEquals ( PreferenceGroup . SavedState . class , state . getClass ( ) ) ; assertEquals ( Integer . MAX_VALUE , ( ( PreferenceGroup . SavedState ) state ) . mInitialExpandedChildrenCount ) ; mScreen . setInitialExpandedChildrenCount ( INITIAL_EXPANDED_COUNT ) ; state = mScreen . onSaveInstanceState ( ) ; assertEquals ( PreferenceGroup . SavedState . class , state . getClass ( ) ) ; assertEquals ( INITIAL_EXPANDED_COUNT , ( ( PreferenceGroup . SavedState ) state ) . mInitialExpandedChildrenCount ) ; }
Verifies that the correct maximum number of preferences to show is being saved in the
 instance state.
Verifies that the correct maximum number of preferences to show is being saved in the instance state .
// No limit set, should save max value // Has limit set, should save limit