use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DefaultAutofillPreferenceControllerTest method updateState_hasNoApp_shouldNotReturnLabel.
@Test
public void updateState_hasNoApp_shouldNotReturnLabel() {
final Preference pref = mock(Preference.class);
mController.updateState(pref);
verify(pref).setSummary(R.string.app_list_preference_none);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AppSettingPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mActivity = Robolectric.setupActivity(Activity.class);
mPackageManager = Shadows.shadowOf(RuntimeEnvironment.application.getPackageManager());
mController = new AppSettingPreferenceController(mActivity, "test_key");
mController.setPackageName(TEST_PKG_NAME).setParentFragment(mParent);
mPreference = new Preference(mActivity);
mPreference.setKey(mController.getPreferenceKey());
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class TimeSpentInAppPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mFeatureFactory = FakeFeatureFactory.setupForTest();
mContext = RuntimeEnvironment.application;
mPackageManager = Shadows.shadowOf(mContext.getPackageManager());
mController = new TimeSpentInAppPreferenceController(mContext, TEST_KEY);
mPreference = new Preference(mContext);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MoreSpecialAccessPreferenceControllerTest method handlePreferenceTreeClick_sameKey_shouldReturnTrue.
@Test
public void handlePreferenceTreeClick_sameKey_shouldReturnTrue() {
when(mPackageManager.getPermissionControllerPackageName()).thenReturn(PERMISSION_CONTROLLER_PACKAGE_NAME);
MoreSpecialAccessPreferenceController preferenceController = new MoreSpecialAccessPreferenceController(mContext, PREFERENCE_KEY);
Preference preference = mock(Preference.class);
when(preference.getKey()).thenReturn(PREFERENCE_KEY);
assertThat(preferenceController.handlePreferenceTreeClick(preference)).isTrue();
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MoreSpecialAccessPreferenceControllerTest method handlePreferenceTreeClick_canNotResolveActivity_shouldNotStartActivity.
@Test
public void handlePreferenceTreeClick_canNotResolveActivity_shouldNotStartActivity() {
when(mPackageManager.getPermissionControllerPackageName()).thenReturn(PERMISSION_CONTROLLER_PACKAGE_NAME);
MoreSpecialAccessPreferenceController preferenceController = new MoreSpecialAccessPreferenceController(mContext, PREFERENCE_KEY);
Preference preference = mock(Preference.class);
when(preference.getKey()).thenReturn(PREFERENCE_KEY);
preferenceController.handlePreferenceTreeClick(preference);
verify(mContext, never()).startActivity(any(Intent.class));
}
Aggregations