Disable collapse when fragment is opened from search

Change-Id: I9564dff4ec53256a0fe992055049cf65ce68e37b
Fix: 36076953
Test: make RunSettingsRoboTests
This commit is contained in:
Fan Zhang
2017-03-15 15:06:41 -07:00
parent 8c3dc96b21
commit f0215712ba
6 changed files with 28 additions and 13 deletions

View File

@@ -77,8 +77,7 @@ public class ProgressiveDisclosureTest {
mAppContext = ShadowApplication.getInstance().getApplicationContext();
mFakeFeatureFactory = (FakeFeatureFactory) FeatureFactory.getFactory(mContext);
mMixin = new ProgressiveDisclosureMixin(mAppContext,
mFakeFeatureFactory.metricsFeatureProvider,
mPreferenceFragment);
mPreferenceFragment, false /* keepExpanded */);
ReflectionHelpers.setField(mMixin, "mExpandButton", mExpandButton);
mPreference = new Preference(mAppContext);
mPreference.setKey("test");
@@ -93,6 +92,17 @@ public class ProgressiveDisclosureTest {
assertThat(mMixin.shouldCollapse(mScreen)).isFalse();
}
@Test
public void shouldNotCollapse_whenStartAsExpanded() {
when(mScreen.getPreferenceCount()).thenReturn(5);
mMixin = new ProgressiveDisclosureMixin(mAppContext,
mPreferenceFragment, true /* keepExpanded */);
mMixin.setTileLimit(10);
assertThat(mMixin.shouldCollapse(mScreen)).isFalse();
}
@Test
public void shouldCollapse_morePreferenceThanLimit() {
when(mScreen.getPreferenceCount()).thenReturn(5);