use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AccessibilityHearingAidPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mShadowApplication = ShadowApplication.getInstance();
mContext = spy(Robolectric.setupActivity(Activity.class));
setupBluetoothEnvironment();
setupHearingAidEnvironment();
mHearingAidPreference = new Preference(mContext);
mHearingAidPreference.setKey(HEARING_AID_PREFERENCE);
mPreferenceController = new AccessibilityHearingAidPreferenceController(mContext, HEARING_AID_PREFERENCE);
mPreferenceController.setPreference(mHearingAidPreference);
mHearingAidPreference.setSummary("");
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AccessibilitySettingsTest method verifyAccessibilityTimeoutSummary.
private void verifyAccessibilityTimeoutSummary(String preferenceKey, int resId) {
final Preference preference = new Preference(mContext);
doReturn(preference).when(mSettings).findPreference(preferenceKey);
preference.setKey(preferenceKey);
mSettings.updateAccessibilityTimeoutSummary(mContentResolver, preference);
assertThat(preference.getSummary()).isEqualTo(mContext.getResources().getString(resId));
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationVibrationIntensityPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
mContext = spy(RuntimeEnvironment.application);
mResources = spy(mContext.getResources());
when(mContext.getResources()).thenReturn(mResources);
when(mResources.getBoolean(R.bool.config_vibration_supports_multiple_intensities)).thenReturn(true);
mController = new NotificationVibrationIntensityPreferenceController(mContext) {
@Override
protected int getDefaultIntensity() {
return 10;
}
};
mLifecycle.addObserver(mController);
mPreference = new Preference(mContext);
mPreference.setSummary("Test");
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothPairingPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
when(mFragment.getPreferenceScreen().getContext()).thenReturn(mContext);
mPreference = new Preference(mContext);
mPreference.setKey(BluetoothPairingPreferenceController.KEY_PAIRING);
mController = new BluetoothPairingPreferenceController(mContext, mFragment);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothPairingPreferenceControllerTest method testCreateBluetoothPairingPreference.
@Test
public void testCreateBluetoothPairingPreference() {
Preference pref = mController.createBluetoothPairingPreference(ORDER);
assertThat(pref.getKey()).isEqualTo(BluetoothPairingPreferenceController.KEY_PAIRING);
DrawableTestHelper.assertDrawableResId(pref.getIcon(), R.drawable.ic_add_24dp);
assertThat(pref.getOrder()).isEqualTo(ORDER);
assertThat(pref.getTitle()).isEqualTo(mContext.getString(R.string.bluetooth_pairing_pref_title));
}
Aggregations