use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class UsbDetailsPowerRoleControllerTest method displayRefresh_sink_shouldUncheck.
@Test
public void displayRefresh_sink_shouldUncheck() {
mDetailsPowerRoleController.displayPreference(mScreen);
when(mUsbBackend.areAllRolesSupported()).thenReturn(true);
mDetailsPowerRoleController.refresh(true, UsbManager.FUNCTION_NONE, POWER_ROLE_SINK, DATA_ROLE_DEVICE);
SwitchPreference pref = getPreference();
assertThat(pref.isChecked()).isFalse();
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class UsbDetailsPowerRoleControllerTest method onClickTwice_sink_shouldSetSourceOnce.
@Test
public void onClickTwice_sink_shouldSetSourceOnce() {
mDetailsPowerRoleController.displayPreference(mScreen);
when(mUsbBackend.getPowerRole()).thenReturn(POWER_ROLE_SINK);
SwitchPreference pref = getPreference();
pref.performClick();
assertThat(pref.getSummary()).isEqualTo(mContext.getString(R.string.usb_switching));
pref.performClick();
verify(mUsbBackend, times(1)).setPowerRole(POWER_ROLE_SOURCE);
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class UsbDetailsPowerRoleControllerTest method displayRefresh_source_shouldCheck.
@Test
public void displayRefresh_source_shouldCheck() {
mDetailsPowerRoleController.displayPreference(mScreen);
when(mUsbBackend.areAllRolesSupported()).thenReturn(true);
mDetailsPowerRoleController.refresh(true, UsbManager.FUNCTION_NONE, POWER_ROLE_SOURCE, DATA_ROLE_HOST);
SwitchPreference pref = getPreference();
assertThat(pref.isChecked()).isTrue();
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DevelopmentTilePreferenceControllerTest method preferenceChecked_shouldAddTile.
@Test
public void preferenceChecked_shouldAddTile() throws RemoteException {
SwitchPreference preference = createPreference(/* defaultCheckedState = */
false);
preference.performClick();
ArgumentCaptor<ComponentName> argument = ArgumentCaptor.forClass(ComponentName.class);
verify(mStatusBarService).addTile(argument.capture());
assertThat(argument.getValue().getClassName()).isEqualTo(SERVICE_INFO_NAME);
assertThat(argument.getValue().getPackageName()).isEqualTo(mContext.getPackageName());
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DevelopmentTilePreferenceControllerTest method preferenceUnchecked_shouldRemoveTile.
@Test
public void preferenceUnchecked_shouldRemoveTile() throws RemoteException {
SwitchPreference preference = createPreference(/* defaultCheckedState = */
true);
preference.performClick();
ArgumentCaptor<ComponentName> argument = ArgumentCaptor.forClass(ComponentName.class);
verify(mStatusBarService).remTile(argument.capture());
assertThat(argument.getValue().getClassName()).isEqualTo(SERVICE_INFO_NAME);
assertThat(argument.getValue().getPackageName()).isEqualTo(mContext.getPackageName());
}
Aggregations