use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DeviceListPreferenceFragmentTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mFragment = spy(new TestFragment());
doReturn(mContext).when(mFragment).getContext();
doReturn(mResource).when(mFragment).getResources();
mFragment.mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mMyDevicePreference = new Preference(RuntimeEnvironment.application);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothDeviceNamePreferenceControllerTest method testCreateBluetoothDeviceNamePreference.
@Test
public void testCreateBluetoothDeviceNamePreference() {
Preference preference = mController.createBluetoothDeviceNamePreference(mPreferenceScreen, ORDER);
assertThat(preference.getKey()).isEqualTo(mController.getPreferenceKey());
assertThat(preference.getOrder()).isEqualTo(ORDER);
verify(mPreferenceScreen).addPreference(preference);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothFilesPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mController = new BluetoothFilesPreferenceController(mContext);
mPreference = new Preference(mContext);
mPreference.setKey(BluetoothFilesPreferenceController.KEY_RECEIVED_FILES);
doReturn(mPackageManager).when(mContext).getPackageManager();
doReturn(true).when(mPackageManager).hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class FingerprintStatusPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
when(mContext.getPackageManager()).thenReturn(mPackageManager);
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)).thenReturn(true);
ShadowApplication.getInstance().setSystemService(Context.FINGERPRINT_SERVICE, mFingerprintManager);
ShadowApplication.getInstance().setSystemService(Context.USER_SERVICE, mUm);
mPreference = new Preference(mContext);
mFeatureFactory = FakeFeatureFactory.setupForTest();
when(mFeatureFactory.securityFeatureProvider.getLockPatternUtils(mContext)).thenReturn(mLockPatternUtils);
when(mUm.getProfileIdsWithDisabled(anyInt())).thenReturn(new int[] { 1234 });
mController = new FingerprintStatusPreferenceController(mContext);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AppPrefLoaderTest method loadInBackground_shouldReturnPreference.
@Test
public void loadInBackground_shouldReturnPreference() throws NameNotFoundException {
ApplicationInfo info = mock(ApplicationInfo.class);
when(mPackageManager.getApplicationInfo(anyString(), anyInt())).thenReturn(info);
final Drawable drawable = mock(Drawable.class);
final String label = "Label1";
when(info.loadIcon(mPackageManager)).thenReturn(drawable);
when(info.loadLabel(mPackageManager)).thenReturn(label);
Preference preference = mLoader.loadInBackground().valueAt(0);
assertThat(preference.getTitle()).isEqualTo(label);
assertThat(preference.getIcon()).isEqualTo(drawable);
assertThat(preference.isSelectable()).isFalse();
}
Aggregations