Search in sources :

Example 36 with SwitchPreference

use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ZenModeAlarmsPreferenceControllerTest method updateState_AlarmsOnly.

@Test
public void updateState_AlarmsOnly() {
    Settings.Global.putInt(mContentResolver, ZEN_MODE, ZEN_MODE_ALARMS);
    final SwitchPreference mockPref = mock(SwitchPreference.class);
    mController.updateState(mockPref);
    verify(mockPref).setEnabled(false);
    verify(mockPref).setChecked(true);
}
Also used : SwitchPreference(androidx.preference.SwitchPreference) Test(org.junit.Test)

Example 37 with SwitchPreference

use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ZenModeRemindersPreferenceControllerTest method updateState_AlarmsOnly.

@Test
public void updateState_AlarmsOnly() {
    Settings.Global.putInt(mContentResolver, ZEN_MODE, ZEN_MODE_ALARMS);
    final SwitchPreference mockPref = mock(SwitchPreference.class);
    mController.updateState(mockPref);
    verify(mockPref).setEnabled(false);
    verify(mockPref).setChecked(false);
}
Also used : SwitchPreference(androidx.preference.SwitchPreference) Test(org.junit.Test)

Example 38 with SwitchPreference

use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ZenModeRepeatCallersPreferenceControllerTest method updateState_TotalSilence.

@Test
public void updateState_TotalSilence() {
    Settings.Global.putInt(mContentResolver, ZEN_MODE, ZEN_MODE_NO_INTERRUPTIONS);
    final SwitchPreference mockPref = mock(SwitchPreference.class);
    mController.updateState(mockPref);
    verify(mockPref).setEnabled(false);
    verify(mockPref).setChecked(false);
}
Also used : SwitchPreference(androidx.preference.SwitchPreference) Test(org.junit.Test)

Example 39 with SwitchPreference

use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class PowerButtonInstantLockPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mFeatureFactory = FakeFeatureFactory.setupForTest();
    when(mFeatureFactory.securityFeatureProvider.getTrustAgentManager()).thenReturn(mTrustAgentManager);
    mPreference = new SwitchPreference(mContext);
    mController = new PowerButtonInstantLockPreferenceController(mContext, TEST_USER_ID, mLockPatternUtils);
}
Also used : SwitchPreference(androidx.preference.SwitchPreference) Before(org.junit.Before)

Example 40 with SwitchPreference

use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AutoSyncDataPreferenceControllerTest method autoSyncData_shouldNotBeSetOnCancel.

@Test
public void autoSyncData_shouldNotBeSetOnCancel() {
    final Context context = RuntimeEnvironment.application;
    final SwitchPreference preference = new SwitchPreference(context);
    preference.setChecked(false);
    mController = new AutoSyncDataPreferenceController(context, mFragment);
    mConfirmSyncFragment.mPreference = preference;
    mConfirmSyncFragment.mEnabling = true;
    mConfirmSyncFragment.onClick(null, DialogInterface.BUTTON_NEGATIVE);
    assertThat(preference.isChecked()).isFalse();
}
Also used : Context(android.content.Context) SwitchPreference(androidx.preference.SwitchPreference) Test(org.junit.Test)

Aggregations

SwitchPreference (androidx.preference.SwitchPreference)139 Test (org.junit.Test)61 Before (org.junit.Before)29 Intent (android.content.Intent)9 Preference (androidx.preference.Preference)6 ComponentName (android.content.ComponentName)5 A2dpProfile (com.android.settingslib.bluetooth.A2dpProfile)5 ListPreference (androidx.preference.ListPreference)4 PreferenceScreen (androidx.preference.PreferenceScreen)4 PbapServerProfile (com.android.settingslib.bluetooth.PbapServerProfile)4 BluetoothDevice (android.bluetooth.BluetoothDevice)2 Context (android.content.Context)2 ServiceInfo (android.content.pm.ServiceInfo)2 KeyboardLayout (android.hardware.input.KeyboardLayout)2 Parcel (android.os.Parcel)2 PersistableBundle (android.os.PersistableBundle)2 RemoteException (android.os.RemoteException)2 TelephonyManager (android.telephony.TelephonyManager)2 VisibleForTesting (androidx.annotation.VisibleForTesting)2 MultiSelectListPreference (androidx.preference.MultiSelectListPreference)2