Merge "Check if boxes still available when restoring state" into pi-dev am: 6fcce25b72
am: f6d5f31564
Change-Id: I8b59411b62292b8f65a62f60bde8981c66f3401a
This commit is contained in:
@@ -115,6 +115,21 @@ public class HotspotApBandSelectionPreferenceTest {
|
||||
assertThat(mPreference.mShouldRestore).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onSaveInstanceState_doesNotCrashWhenViewGone() {
|
||||
mPreference.setExistingConfigValue(WifiConfiguration.AP_BAND_2GHZ);
|
||||
mPreference.onBindDialogView(mLayout);
|
||||
// When the device dozes the view and dialog can become null
|
||||
mPreference.mBox5G = null;
|
||||
mPreference.mBox2G = null;
|
||||
ReflectionHelpers.setField(mPreference, "mFragment", null);
|
||||
|
||||
// make sure it does not crash and state is not restored
|
||||
Parcelable parcelable = mPreference.onSaveInstanceState();
|
||||
mPreference.onRestoreInstanceState(parcelable);
|
||||
assertThat(mPreference.mShouldRestore).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onSaveInstanceState_presentWhenDialogPresent() {
|
||||
mPreference.setExistingConfigValue(WifiConfiguration.AP_BAND_2GHZ);
|
||||
|
||||
Reference in New Issue
Block a user