use of androidx.preference.PreferenceScreen in project android_packages_apps_Settings by omnirom.
the class OverlayCategoryPreferenceControllerTest method onDeveloperOptionsSwitchDisabled.
@Test
public void onDeveloperOptionsSwitchDisabled() throws Exception {
mockCurrentOverlays(ONE_ENABLED, TWO_DISABLED);
final PreferenceScreen screen = mock(PreferenceScreen.class);
when(screen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
mController.displayPreference(screen);
mController.onDeveloperOptionsSwitchDisabled();
verify(mPreference).setEnabled(false);
verify(mOverlayManager).setEnabled(eq(ONE_ENABLED.packageName), eq(false), anyInt());
}
use of androidx.preference.PreferenceScreen in project android_packages_apps_Settings by omnirom.
the class ConversationListPreferenceControllerTest method testPopulateList_validConversations.
@Test
public void testPopulateList_validConversations() {
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
PreferenceScreen ps = preferenceManager.createPreferenceScreen(mContext);
PreferenceCategory outerContainer = spy(new PreferenceCategory(mContext));
ps.addPreference(outerContainer);
ConversationChannelWrapper ccw = new ConversationChannelWrapper();
ccw.setNotificationChannel(mock(NotificationChannel.class));
ccw.setPkg("pkg");
ccw.setUid(1);
ccw.setShortcutInfo(mock(ShortcutInfo.class));
ArrayList<ConversationChannelWrapper> list = new ArrayList<>();
list.add(ccw);
mController.populateList(list, outerContainer);
verify(outerContainer, times(1)).addPreference(any());
}
use of androidx.preference.PreferenceScreen in project android_packages_apps_Settings by omnirom.
the class RecentConversationsPreferenceControllerTest method testPopulateList_validConversations.
@Test
public void testPopulateList_validConversations() {
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
PreferenceScreen ps = preferenceManager.createPreferenceScreen(mContext);
PreferenceCategory outerContainer = spy(new PreferenceCategory(mContext));
ps.addPreference(outerContainer);
ConversationChannel ccw = new ConversationChannel(mock(ShortcutInfo.class), 6, new NotificationChannel("hi", "hi", 4), new NotificationChannelGroup("hi", "hi"), 7, false);
ArrayList<ConversationChannel> list = new ArrayList<>();
list.add(ccw);
mController.populateList(list, outerContainer);
// one for the preference, one for the button ro clear all
verify(outerContainer, times(2)).addPreference(any());
}
use of androidx.preference.PreferenceScreen in project android_packages_apps_Settings by omnirom.
the class EnabledNetworkModePreferenceControllerTest method preferredNetworkModeNotification_preferenceUpdates.
@UiThreadTest
@Test
public void preferredNetworkModeNotification_preferenceUpdates() {
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
mPreference.setKey(KEY);
screen.addPreference(mPreference);
mockEnabledNetworkMode(TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA);
// NETWORK_MODE_TDSCDMA_GSM_WCDMA = RAF_TD_SCDMA | GSM | WCDMA
when(mTelephonyManager.getAllowedNetworkTypesForReason(TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER)).thenReturn((long) (RAF_TD_SCDMA | GSM | WCDMA));
mController.displayPreference(screen);
mController.updateState(mPreference);
mLifecycle.handleLifecycleEvent(ON_START);
assertThat(Integer.parseInt(mPreference.getValue())).isEqualTo(TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA);
assertThat(mPreference.getSummary()).isEqualTo("3G");
}
use of androidx.preference.PreferenceScreen in project android_packages_apps_Settings by omnirom.
the class PaymentSettingsTest method isShowEmptyImage_hasVisiblePreference_returnFalse.
@Test
public void isShowEmptyImage_hasVisiblePreference_returnFalse() {
final PaymentSettings paymentSettings = new PaymentSettings();
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
final PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
final Preference preference1 = new Preference(mContext);
screen.addPreference(preference1);
final Preference preference2 = new Preference(mContext);
screen.addPreference(preference2);
assertThat(paymentSettings.isShowEmptyImage(screen)).isFalse();
}
Aggregations