use of com.android.settings.widget.RadioButtonPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class UsbDetailsFunctionsControllerTest method displayRefresh_allAllowed_shouldCreatePrefs.
@Test
public void displayRefresh_allAllowed_shouldCreatePrefs() {
when(mUsbBackend.areFunctionsSupported(anyLong())).thenReturn(true);
mDetailsFunctionsController.displayPreference(mScreen);
mDetailsFunctionsController.refresh(true, UsbManager.FUNCTION_NONE, POWER_ROLE_SINK, DATA_ROLE_DEVICE);
List<RadioButtonPreference> prefs = getRadioPreferences();
Iterator<Long> iter = UsbDetailsFunctionsController.FUNCTIONS_MAP.keySet().iterator();
for (RadioButtonPreference pref : prefs) {
assertThat(pref.getKey()).isEqualTo(UsbBackend.usbFunctionsToString(iter.next()));
}
}
use of com.android.settings.widget.RadioButtonPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class UsbDetailsFunctionsControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mLifecycle = new Lifecycle(() -> mLifecycle);
mPreferenceManager = new PreferenceManager(mContext);
mScreen = mPreferenceManager.createPreferenceScreen(mContext);
when(mFragment.getActivity()).thenReturn(mActivity);
when(mActivity.getApplicationContext()).thenReturn(mContext);
when(mFragment.getContext()).thenReturn(mContext);
when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager);
when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
when(mContext.getSystemService(ConnectivityManager.class)).thenReturn(mConnectivityManager);
mDetailsFunctionsController = new UsbDetailsFunctionsController(mContext, mFragment, mUsbBackend);
mPreferenceCategory = new PreferenceCategory(mContext);
mPreferenceCategory.setKey(mDetailsFunctionsController.getPreferenceKey());
mScreen.addPreference(mPreferenceCategory);
mDetailsFunctionsController.displayPreference(mScreen);
mRadioButtonPreference = new RadioButtonPreference(mContext);
}
use of com.android.settings.widget.RadioButtonPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WebViewAppPickerTest method testDisabledPackageShowsDisabledReasonSummary.
@Test
public void testDisabledPackageShowsDisabledReasonSummary() {
String disabledReason = "disabled";
DefaultAppInfo webviewAppInfo = mPicker.createDefaultAppInfo(mContext, mContext.getPackageManager(), createApplicationInfo(PACKAGE_NAME), disabledReason);
RadioButtonPreference preference = mock(RadioButtonPreference.class);
mPicker.bindPreference(preference, PACKAGE_NAME, webviewAppInfo, null);
mPicker.bindPreferenceExtra(preference, PACKAGE_NAME, webviewAppInfo, null, null);
verify(preference, times(1)).setSummary(eq(disabledReason));
// Ensure we haven't called setSummary several times.
verify(preference, times(1)).setSummary(any());
}
use of com.android.settings.widget.RadioButtonPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WebViewAppPickerTest method testEnabledPackageShowsEmptySummary.
@Test
public void testEnabledPackageShowsEmptySummary() {
DefaultAppInfo webviewAppInfo = mPicker.createDefaultAppInfo(mContext, mContext.getPackageManager(), createApplicationInfo(PACKAGE_NAME), null);
RadioButtonPreference preference = mock(RadioButtonPreference.class);
mPicker.bindPreference(preference, PACKAGE_NAME, webviewAppInfo, null);
mPicker.bindPreferenceExtra(preference, PACKAGE_NAME, webviewAppInfo, null, null);
verify(preference, never()).setSummary(any());
}
use of com.android.settings.widget.RadioButtonPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WebViewAppPickerTest method testDisabledPackageShownAsDisabled.
@Test
public void testDisabledPackageShownAsDisabled() {
DefaultAppInfo webviewAppInfo = mPicker.createDefaultAppInfo(mContext, mContext.getPackageManager(), createApplicationInfo(PACKAGE_NAME), "disabled");
RadioButtonPreference preference = mock(RadioButtonPreference.class);
mPicker.bindPreference(preference, PACKAGE_NAME, webviewAppInfo, null);
mPicker.bindPreferenceExtra(preference, PACKAGE_NAME, webviewAppInfo, null, null);
verify(preference, times(1)).setEnabled(eq(false));
verify(preference, never()).setEnabled(eq(true));
}
Aggregations