use of android.app.NotificationChannelGroup in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationsOffPreferenceControllerTest method testIsAvailable_yesIfChannelGroupBlocked.
@Test
public void testIsAvailable_yesIfChannelGroupBlocked() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannelGroup group = mock(NotificationChannelGroup.class);
when(group.isBlocked()).thenReturn(true);
mController.onResume(appRow, null, group, null);
assertThat(mController.isAvailable()).isTrue();
}
use of android.app.NotificationChannelGroup 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();
}
use of android.app.NotificationChannelGroup in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class HeaderPreferenceControllerTest method testGetSummary.
@Test
public void testGetSummary() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.label = "bananas";
mController.onResume(appRow, null, null, null);
assertEquals("", mController.getSummary());
NotificationChannelGroup group = new NotificationChannelGroup("id", "name");
mController.onResume(appRow, null, group, null);
assertEquals(appRow.label, mController.getSummary());
NotificationChannel channel = new NotificationChannel("cid", "cname", IMPORTANCE_NONE);
mController.onResume(appRow, channel, group, null);
assertTrue(mController.getSummary().toString().contains(group.getName()));
assertTrue(mController.getSummary().toString().contains(appRow.label));
mController.onResume(appRow, channel, null, null);
assertFalse(mController.getSummary().toString().contains(group.getName()));
assertTrue(mController.getSummary().toString().contains(appRow.label));
NotificationChannel defaultChannel = new NotificationChannel(NotificationChannel.DEFAULT_CHANNEL_ID, "", IMPORTANCE_NONE);
mController.onResume(appRow, defaultChannel, null, null);
assertEquals("", mController.getSummary());
}
use of android.app.NotificationChannelGroup in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationPreferenceControllerTest method testIsChannelGroupBlockable_canUndoSystemBlock.
@Test
public void testIsChannelGroupBlockable_canUndoSystemBlock() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannelGroup group = mock(NotificationChannelGroup.class);
when(group.isBlocked()).thenReturn(true);
mController.onResume(appRow, null, group, null);
assertTrue(mController.isChannelGroupBlockable());
}
use of android.app.NotificationChannelGroup in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationPreferenceControllerTest method testIsChannelGroupBlockable_SystemNotBlockable.
@Test
public void testIsChannelGroupBlockable_SystemNotBlockable() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannelGroup group = mock(NotificationChannelGroup.class);
when(group.isBlocked()).thenReturn(false);
mController.onResume(appRow, null, group, null);
assertFalse(mController.isChannelGroupBlockable());
}
Aggregations