use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NetworkScorerPickerPreferenceControllerTest method updateState_noScorersAvailable_preferenceDisabled.
@Test
public void updateState_noScorersAvailable_preferenceDisabled() {
when(mNetworkScorer.getAllValidScorers()).thenReturn(Collections.emptyList());
Preference preference = mock(Preference.class);
mController.updateState(preference);
verify(preference).setEnabled(false);
verify(preference).setSummary(null);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NetworkScorerPickerPreferenceControllerTest method updateState_scorersAvailable_preferenceEnabled.
@Test
public void updateState_scorersAvailable_preferenceEnabled() {
ComponentName scorer = new ComponentName(TEST_SCORER_PACKAGE, TEST_SCORER_CLASS);
NetworkScorerAppData scorerAppData = new NetworkScorerAppData(0, scorer, TEST_SCORER_LABEL, null, /* enableUseOpenWifiActivity */
null);
when(mNetworkScorer.getAllValidScorers()).thenReturn(Collections.singletonList(scorerAppData));
Preference preference = mock(Preference.class);
mController.updateState(preference);
verify(preference).setEnabled(true);
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationsOffPreferenceControllerTest method testUpdateState_channel.
@Test
public void testUpdateState_channel() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getImportance()).thenReturn(IMPORTANCE_NONE);
mController.onResume(appRow, channel, null, null);
Preference pref = new Preference(RuntimeEnvironment.application);
mController.updateState(pref);
assertThat(pref.getTitle().toString()).contains("category");
assertThat(pref.isSelectable()).isFalse();
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationsOffPreferenceControllerTest method testUpdateState_app.
@Test
public void testUpdateState_app() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.banned = true;
mController.onResume(appRow, null, null, null);
Preference pref = new Preference(RuntimeEnvironment.application);
mController.updateState(pref);
assertThat(pref.getTitle().toString()).contains("app");
assertThat(pref.isSelectable()).isFalse();
}
use of androidx.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationsOffPreferenceControllerTest method testUpdateState_channelGroup.
@Test
public void testUpdateState_channelGroup() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannelGroup group = mock(NotificationChannelGroup.class);
when(group.isBlocked()).thenReturn(true);
mController.onResume(appRow, null, group, null);
Preference pref = new Preference(RuntimeEnvironment.application);
mController.updateState(pref);
assertThat(pref.getTitle().toString()).contains("group");
assertThat(pref.isSelectable()).isFalse();
}
Aggregations