use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class TermsPreferenceControllerTest method setup.
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mPreference = new Preference(mContext);
mPreference.setIntent(new Intent());
when(mContext.getPackageManager()).thenReturn(mPackageManager);
when(mScreen.findPreference(anyString())).thenReturn(mPreference);
mController = new TermsPreferenceController(mContext, "pref_key");
mController.displayPreference(mScreen);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WebViewLicensePreferenceControllerTest method setup.
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mPreference = new Preference(mContext);
mPreference.setIntent(new Intent());
when(mContext.getPackageManager()).thenReturn(mPackageManager);
when(mScreen.findPreference(anyString())).thenReturn(mPreference);
mController = new WebViewLicensePreferenceController(mContext, "pref_key");
mController.displayPreference(mScreen);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LicensePreferenceControllerTest method setup.
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mPreference = new Preference(mContext);
mPreference.setIntent(new Intent());
when(mContext.getPackageManager()).thenReturn(mPackageManager);
when(mScreen.findPreference(anyString())).thenReturn(mPreference);
mController = new LicensePreferenceController(mContext, "pref_key");
mController.displayPreference(mScreen);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ColorModePreferenceFragmentTest method addStaticPreferences_shouldAddPreviewImage.
@Test
public void addStaticPreferences_shouldAddPreviewImage() {
PreferenceScreen mockPreferenceScreen = mock(PreferenceScreen.class);
LayoutPreference mockPreview = mock(LayoutPreference.class);
ArgumentCaptor<Preference> preferenceCaptor = ArgumentCaptor.forClass(Preference.class);
mFragment.configureAndInstallPreview(mockPreview, mockPreferenceScreen);
verify(mockPreview, times(1)).setSelectable(false);
verify(mockPreferenceScreen, times(1)).addPreference(preferenceCaptor.capture());
assertThat(preferenceCaptor.getValue()).isEqualTo(mockPreview);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WallpaperPreferenceControllerTest method handlePreferenceTreeClick_wallpaperOnly.
@Test
public void handlePreferenceTreeClick_wallpaperOnly() {
mShadowPackageManager.setResolveInfosForIntent(mWallpaperIntent, Lists.newArrayList(mock(ResolveInfo.class)));
mShadowPackageManager.setResolveInfosForIntent(mStylesAndWallpaperIntent, Lists.newArrayList());
Preference preference = new Preference(mContext);
preference.setKey(TEST_KEY);
mController.handlePreferenceTreeClick(preference);
assertThat(Shadows.shadowOf(mContext).getNextStartedActivityForResult().intent.getComponent().getClassName()).isEqualTo(mContext.getString(R.string.config_wallpaper_picker_class));
}
Aggregations