use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.
the class WearNotificationsTest method testBuildStackedNotificationWithArchiveActionEnabled.
@Test
public void testBuildStackedNotificationWithArchiveActionEnabled() throws Exception {
enableArchiveAction();
int notificationIndex = 0;
int notificationId = NotificationIds.getNewMailStackedNotificationId(account, notificationIndex);
MessageReference messageReference = createMessageReference(1);
NotificationContent content = createNotificationContent(messageReference);
NotificationHolder holder = createNotificationHolder(notificationId, content);
PendingIntent archivePendingIntent = createFakePendingIntent(1);
when(actionCreator.createArchiveMessagePendingIntent(messageReference, notificationId)).thenReturn(archivePendingIntent);
Notification result = wearNotifications.buildStackedNotification(account, holder);
assertEquals(notification, result);
verifyExtendWasOnlyCalledOnce();
verifyAddAction(R.drawable.ic_action_archive_dark, "Archive", archivePendingIntent);
}
use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.
the class WearNotificationsTest method testBuildStackedNotificationWithMarkAsSpamActionEnabled.
@Test
public void testBuildStackedNotificationWithMarkAsSpamActionEnabled() throws Exception {
enableSpamAction();
int notificationIndex = 0;
int notificationId = NotificationIds.getNewMailStackedNotificationId(account, notificationIndex);
MessageReference messageReference = createMessageReference(1);
NotificationContent content = createNotificationContent(messageReference);
NotificationHolder holder = createNotificationHolder(notificationId, content);
PendingIntent markAsSpamPendingIntent = createFakePendingIntent(1);
when(actionCreator.createMarkMessageAsSpamPendingIntent(messageReference, notificationId)).thenReturn(markAsSpamPendingIntent);
Notification result = wearNotifications.buildStackedNotification(account, holder);
assertEquals(notification, result);
verifyExtendWasOnlyCalledOnce();
verifyAddAction(R.drawable.ic_action_spam_dark, "Spam", markAsSpamPendingIntent);
}
use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.
the class WearNotificationsTest method testBuildStackedNotificationWithDeleteActionEnabled.
@Test
public void testBuildStackedNotificationWithDeleteActionEnabled() throws Exception {
enableDeleteAction();
int notificationIndex = 0;
int notificationId = NotificationIds.getNewMailStackedNotificationId(account, notificationIndex);
MessageReference messageReference = createMessageReference(1);
NotificationContent content = createNotificationContent(messageReference);
NotificationHolder holder = createNotificationHolder(notificationId, content);
PendingIntent deletePendingIntent = createFakePendingIntent(1);
when(actionCreator.createDeleteMessagePendingIntent(messageReference, notificationId)).thenReturn(deletePendingIntent);
Notification result = wearNotifications.buildStackedNotification(account, holder);
assertEquals(notification, result);
verifyExtendWasOnlyCalledOnce();
verifyAddAction(R.drawable.ic_action_delete_dark, "Delete", deletePendingIntent);
}
use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.
the class WearNotificationsTest method testBuildStackedNotification.
@Test
public void testBuildStackedNotification() throws Exception {
disableOptionalActions();
int notificationIndex = 0;
int notificationId = NotificationIds.getNewMailStackedNotificationId(account, notificationIndex);
MessageReference messageReference = createMessageReference(1);
NotificationContent content = createNotificationContent(messageReference);
NotificationHolder holder = createNotificationHolder(notificationId, content);
PendingIntent replyPendingIntent = createFakePendingIntent(1);
when(actionCreator.createReplyPendingIntent(messageReference, notificationId)).thenReturn(replyPendingIntent);
PendingIntent markAsReadPendingIntent = createFakePendingIntent(2);
when(actionCreator.createMarkMessageAsReadPendingIntent(messageReference, notificationId)).thenReturn(markAsReadPendingIntent);
Notification result = wearNotifications.buildStackedNotification(account, holder);
assertEquals(notification, result);
verifyExtendWasOnlyCalledOnce();
verifyAddAction(R.drawable.ic_action_single_message_options_dark, "Reply", replyPendingIntent);
verifyAddAction(R.drawable.ic_action_mark_as_read_dark, "Mark Read", markAsReadPendingIntent);
verifyNumberOfActions(2);
}
use of com.fsck.k9.activity.MessageReference in project k-9 by k9mail.
the class NewMailNotificationsTest method testRemoveNewMailNotificationWithUnknownMessageReference.
@Test
public void testRemoveNewMailNotificationWithUnknownMessageReference() throws Exception {
enablePrivacyMode();
MessageReference messageReference = createMessageReference(1);
int notificationIndex = 0;
LocalMessage message = createLocalMessage();
NotificationContent content = createNotificationContent();
NotificationHolder holder = createNotificationHolder(content, notificationIndex);
addToNotificationContentCreator(message, content);
whenAddingContentReturn(content, AddNotificationResult.newNotification(holder));
Notification summaryNotification = createNotification();
addToDeviceNotifications(summaryNotification);
newMailNotifications.addNewMailNotification(account, message, 23);
whenRemovingContentReturn(messageReference, RemoveNotificationResult.unknownNotification());
newMailNotifications.removeNewMailNotification(account, messageReference);
verify(notificationManager, never()).cancel(anyInt());
}
Aggregations