use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DockingSoundPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(mSetting.getActivity()).thenReturn(mActivity);
when(mActivity.getContentResolver()).thenReturn(mContentResolver);
mPreference = new SwitchPreference(RuntimeEnvironment.application);
when(mActivity.getResources().getBoolean(com.android.settings.R.bool.has_dock_settings)).thenReturn(true);
mController = new DockingSoundPreferenceController(mContext, mSetting, null);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
doReturn(mScreen).when(mSetting).getPreferenceScreen();
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LockdownButtonPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mPreference = new SwitchPreference(mContext);
mController = spy(new LockdownButtonPreferenceController(mContext, "TestKey"));
ReflectionHelpers.setField(mController, "mLockPatternUtils", mLockPatternUtils);
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotifyOpenNetworkPreferenceControllerTest method updateState_preferenceSetCheckedWhenSettingsAreEnabled.
@Test
public void updateState_preferenceSetCheckedWhenSettingsAreEnabled() {
final SwitchPreference preference = mock(SwitchPreference.class);
Settings.Global.putInt(mContext.getContentResolver(), WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 1);
mController.updateState(preference);
verify(preference).setChecked(true);
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiWakeupPreferenceControllerTest method updateState_preferenceSetCheckedWhenWakeupSettingEnabled.
@Test
public void updateState_preferenceSetCheckedWhenWakeupSettingEnabled() {
final SwitchPreference preference = new SwitchPreference(mContext);
Settings.Global.putInt(mContext.getContentResolver(), WIFI_WAKEUP_ENABLED, 1);
Settings.Global.putInt(mContext.getContentResolver(), WIFI_SCAN_ALWAYS_AVAILABLE, 1);
mController.updateState(preference);
assertThat(preference.isChecked()).isTrue();
assertThat(preference.getSummary()).isEqualTo(mContext.getString(R.string.wifi_wakeup_summary));
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiWakeupPreferenceControllerTest method updateState_preferenceSetUncheckedWhenWifiScanningDisabledLocationEnabled.
@Test
public void updateState_preferenceSetUncheckedWhenWifiScanningDisabledLocationEnabled() {
final SwitchPreference preference = new SwitchPreference(mContext);
Settings.Global.putInt(mContext.getContentResolver(), WIFI_WAKEUP_ENABLED, 1);
Settings.Global.putInt(mContext.getContentResolver(), WIFI_SCAN_ALWAYS_AVAILABLE, 0);
doReturn(false).when(mLocationManager).isLocationEnabled();
mController.updateState(preference);
assertThat(preference.isChecked()).isFalse();
assertThat(TextUtils.equals(preference.getSummary(), mController.getNoLocationSummary())).isTrue();
}
Aggregations