use of com.android.settingslib.RestrictedSwitchPreference in project android_packages_apps_Settings by LineageOS.
the class AddUserWhenLockedPreferenceControllerTest method displayPref_NotAdmin_shouldNotDisplay.
@Test
public void displayPref_NotAdmin_shouldNotDisplay() {
when(mUserManager.getUserInfo(anyInt())).thenReturn(mUserInfo);
when(mUserInfo.isAdmin()).thenReturn(false);
final RestrictedSwitchPreference preference = mock(RestrictedSwitchPreference.class);
when(mScreen.getPreferenceCount()).thenReturn(1);
when(mScreen.getPreference(0)).thenReturn(preference);
when(preference.getKey()).thenReturn(mController.getPreferenceKey());
mController.displayPreference(mScreen);
verify(mScreen).removePreference(any(Preference.class));
}
use of com.android.settingslib.RestrictedSwitchPreference in project android_packages_apps_Settings by LineageOS.
the class AddUserWhenLockedPreferenceControllerTest method updateState_preferenceSetCheckedWhenSettingIsOn.
@Test
public void updateState_preferenceSetCheckedWhenSettingIsOn() {
final RestrictedSwitchPreference preference = mock(RestrictedSwitchPreference.class);
Global.putInt(mContext.getContentResolver(), Global.ADD_USERS_WHEN_LOCKED, 1);
mController.updateState(preference);
verify(preference).setChecked(true);
}
use of com.android.settingslib.RestrictedSwitchPreference in project android_packages_apps_Settings by LineageOS.
the class AddUserWhenLockedPreferenceControllerTest method onPreferenceChange_SettingIsOffWhenPreferenceNotChecked.
@Test
public void onPreferenceChange_SettingIsOffWhenPreferenceNotChecked() {
final RestrictedSwitchPreference preference = mock(RestrictedSwitchPreference.class);
preference.setChecked(false);
mController.onPreferenceChange(preference, Boolean.FALSE);
assertThat(Global.getInt(mContext.getContentResolver(), Global.ADD_USERS_WHEN_LOCKED, 0)).isEqualTo(0);
}
use of com.android.settingslib.RestrictedSwitchPreference in project android_packages_apps_Settings by LineageOS.
the class AddUserWhenLockedPreferenceControllerTest method onPreferenceChange_SettingIsOnWhenPreferenceChecked.
@Test
public void onPreferenceChange_SettingIsOnWhenPreferenceChecked() {
final RestrictedSwitchPreference preference = mock(RestrictedSwitchPreference.class);
preference.setChecked(true);
mController.onPreferenceChange(preference, Boolean.TRUE);
assertThat(Global.getInt(mContext.getContentResolver(), Global.ADD_USERS_WHEN_LOCKED, 0)).isEqualTo(1);
}
use of com.android.settingslib.RestrictedSwitchPreference in project android_packages_apps_Settings by omnirom.
the class AddUserWhenLockedPreferenceControllerTest method updateState_preferenceSetUncheckedWhenSettingIsOff.
@Test
public void updateState_preferenceSetUncheckedWhenSettingIsOff() {
final RestrictedSwitchPreference preference = mock(RestrictedSwitchPreference.class);
Global.putInt(mContext.getContentResolver(), Global.ADD_USERS_WHEN_LOCKED, 0);
mController.updateState(preference);
verify(preference).setChecked(false);
}
Aggregations