use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class RegionPreferenceControllerTest method updateState_matchCountryName.
@Test
public void updateState_matchCountryName() {
Preference preference = new Preference(mActivity);
RegionPreferenceController controller = new RegionPreferenceController(mActivity);
controller.setRegionId("US");
controller.updateState(preference);
assertThat(controller.getSummary()).isEqualTo("United States");
assertThat(preference.getSummary()).isEqualTo("United States");
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AutomaticStorageManagerSwitchBarControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mSwitchBar = new SwitchBar(mContext);
mMetricsFeatureProvider = FakeFeatureFactory.setupForTest().getMetricsFeatureProvider();
mPreference = new Preference(mContext);
mController = new AutomaticStorageManagerSwitchBarController(mContext, mSwitchBar, mMetricsFeatureProvider, mPreference, mFragmentManager);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SecondaryUserControllerTest method controllerAddsSecondaryUser.
@Test
public void controllerAddsSecondaryUser() {
mPrimaryUser.name = TEST_NAME;
mController.displayPreference(mScreen);
final ArgumentCaptor<Preference> argumentCaptor = ArgumentCaptor.forClass(Preference.class);
verify(mGroup).addPreference(argumentCaptor.capture());
final Preference preference = argumentCaptor.getValue();
assertThat(preference.getTitle()).isEqualTo(TEST_NAME);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SecondaryUserControllerTest method controllerUpdatesPreferenceOnAcceptingResult.
@Test
public void controllerUpdatesPreferenceOnAcceptingResult() {
mPrimaryUser.name = TEST_NAME;
mPrimaryUser.id = 10;
mController.displayPreference(mScreen);
final StorageAsyncLoader.AppsStorageResult userResult = new StorageAsyncLoader.AppsStorageResult();
final SparseArray<StorageAsyncLoader.AppsStorageResult> result = new SparseArray<>();
userResult.externalStats = new StorageStatsSource.ExternalStorageStats(MEGABYTE_IN_BYTES * 30, MEGABYTE_IN_BYTES * 10, MEGABYTE_IN_BYTES * 10, MEGABYTE_IN_BYTES * 10, 0);
result.put(10, userResult);
mController.handleResult(result);
final ArgumentCaptor<Preference> argumentCaptor = ArgumentCaptor.forClass(Preference.class);
verify(mGroup).addPreference(argumentCaptor.capture());
final Preference preference = argumentCaptor.getValue();
assertThat(preference.getSummary()).isEqualTo("0.03 GB");
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SecurityPatchLevelPreferenceControllerTest method onClick_noActivityIntent_shouldDoNothing.
@Test
public void onClick_noActivityIntent_shouldDoNothing() {
when(mPackageManager.queryIntentActivities(any(), anyInt())).thenReturn(Collections.emptyList());
mController = new SecurityPatchLevelPreferenceController(mContext, "key");
ReflectionHelpers.setField(mController, "mPackageManager", mPackageManager);
final Preference pref = new Preference(mContext);
pref.setKey(mController.getPreferenceKey());
mController.handlePreferenceTreeClick(pref);
verify(mContext, never()).startActivity(any());
}
Aggregations