use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
the class UsbDetailsDataRoleControllerTest method displayRefresh_hostRole_shouldCheckHost.
@Test
public void displayRefresh_hostRole_shouldCheckHost() {
mDetailsDataRoleController.displayPreference(mScreen);
mDetailsDataRoleController.refresh(true, UsbManager.FUNCTION_NONE, POWER_ROLE_SINK, DATA_ROLE_HOST);
final RadioButtonPreference devicePref = getRadioPreference(DATA_ROLE_DEVICE);
final RadioButtonPreference hostPref = getRadioPreference(DATA_ROLE_HOST);
assertThat(devicePref.isChecked()).isFalse();
assertThat(hostPref.isChecked()).isTrue();
}
use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
the class UsbDetailsDataRoleControllerTest method onClickDevice_hostEnabled_shouldSetDevice.
@Test
public void onClickDevice_hostEnabled_shouldSetDevice() {
mDetailsDataRoleController.displayPreference(mScreen);
when(mUsbBackend.getDataRole()).thenReturn(DATA_ROLE_HOST);
final RadioButtonPreference devicePref = getRadioPreference(DATA_ROLE_DEVICE);
devicePref.performClick();
verify(mUsbBackend).setDataRole(DATA_ROLE_DEVICE);
assertThat(devicePref.getSummary()).isEqualTo(mContext.getString(R.string.usb_switching));
}
use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
the class UsbDetailsDataRoleControllerTest method displayRefresh_deviceRole_shouldCheckDevice.
@Test
public void displayRefresh_deviceRole_shouldCheckDevice() {
mDetailsDataRoleController.displayPreference(mScreen);
mDetailsDataRoleController.refresh(true, UsbManager.FUNCTION_NONE, POWER_ROLE_SINK, DATA_ROLE_DEVICE);
final RadioButtonPreference devicePref = getRadioPreference(DATA_ROLE_DEVICE);
final RadioButtonPreference hostPref = getRadioPreference(DATA_ROLE_HOST);
assertThat(devicePref.isChecked()).isTrue();
assertThat(hostPref.isChecked()).isFalse();
}
use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
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.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
the class RestrictedPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mController = new RestrictedPreferenceController(RuntimeEnvironment.application, UID, PACKAGE_NAME);
mPreference = new RadioButtonPreference(RuntimeEnvironment.application);
mController.mBatteryOptimizeUtils = mockBatteryOptimizeUtils;
}
Aggregations