Checke radio on default app screen if there's 1 option only

Change-Id: Ib091eb033ce541dc6a6d97ef45a15a5eb957e405
Fix: 34746591
Test: make RunSettingsRoboTests -j40
This commit is contained in:
Fan Zhang
2017-02-08 12:52:48 -08:00
parent 2470b1e142
commit 4be105e9f4
2 changed files with 25 additions and 0 deletions

View File

@@ -106,6 +106,18 @@ public class DefaultAppPickerFragmentTest {
mFragment.onRadioButtonClicked(pref);
}
@Test
public void displaySingleOption_shouldSelectRadioButton() {
final RadioButtonPreference pref =
new RadioButtonPreference(RuntimeEnvironment.application);
when(mScreen.getPreferenceCount()).thenReturn(1);
when(mScreen.getPreference(0)).thenReturn(pref);
mFragment.mayCheckOnlyRadioButton();
assertThat(pref.isChecked()).isTrue();
}
public static class TestFragment extends DefaultAppPickerFragment {
boolean setDefaultAppKeyCalled;