use of android.app.people.ConversationChannel in project android_packages_apps_Settings by omnirom.
the class RecentConversationsPreferenceControllerTest method getSummary_withGroup.
@Test
public void getSummary_withGroup() {
ShortcutInfo si = mock(ShortcutInfo.class);
when(si.getLabel()).thenReturn("person");
ConversationChannel ccw = new ConversationChannel(mock(ShortcutInfo.class), 6, new NotificationChannel("hi", "channel", 4), new NotificationChannelGroup("hi", "group"), 7, true);
assertThat(mController.getSummary(ccw).toString()).contains(ccw.getNotificationChannelGroup().getName());
assertThat(mController.getSummary(ccw).toString()).contains(ccw.getNotificationChannel().getName());
}
use of android.app.people.ConversationChannel in project android_packages_apps_Settings by omnirom.
the class RecentConversationsPreferenceControllerTest method testSpans.
@Test
public void testSpans() {
ShortcutInfo si = mock(ShortcutInfo.class);
when(si.getLabel()).thenReturn(new SpannedString("hello"));
ConversationChannel ccw = new ConversationChannel(si, 6, new NotificationChannel("hi", "hi", 4), null, 7, true);
ShortcutInfo si2 = mock(ShortcutInfo.class);
when(si2.getLabel()).thenReturn("hello");
ConversationChannel ccw2 = new ConversationChannel(si2, 6, new NotificationChannel("hi2", "hi2", 4), null, 7, true);
// no crash
mController.mConversationComparator.compare(ccw, ccw2);
}
use of android.app.people.ConversationChannel in project android_packages_apps_Settings by omnirom.
the class RecentConversationsPreferenceControllerTest method testRemoveConversations.
@Test
public void testRemoveConversations() throws Exception {
ShortcutInfo si = mock(ShortcutInfo.class);
when(si.getId()).thenReturn("person");
when(si.getPackage()).thenReturn("pkg");
ConversationChannel ccw = new ConversationChannel(si, 6, new NotificationChannel("hi", "hi", 4), new NotificationChannelGroup("hi", "group"), 7, false);
ConversationChannel ccw2 = new ConversationChannel(si, 6, new NotificationChannel("bye", "bye", 4), new NotificationChannelGroup("hi", "group"), 7, true);
PreferenceCategory group = new PreferenceCategory(mContext);
PreferenceScreen screen = new PreferenceManager(mContext).createPreferenceScreen(mContext);
screen.addPreference(group);
RecentConversationPreference pref = mController.createConversationPref(new PreferenceCategory(mContext), ccw, 100);
final View view = View.inflate(mContext, pref.getLayoutResource(), null);
PreferenceViewHolder holder = spy(PreferenceViewHolder.createInstanceForTests(view));
View delete = View.inflate(mContext, pref.getSecondTargetResId(), null);
when(holder.findViewById(pref.getClearId())).thenReturn(delete);
group.addPreference(pref);
RecentConversationPreference pref2 = mController.createConversationPref(new PreferenceCategory(mContext), ccw2, 100);
final View view2 = View.inflate(mContext, pref2.getLayoutResource(), null);
PreferenceViewHolder holder2 = spy(PreferenceViewHolder.createInstanceForTests(view2));
View delete2 = View.inflate(mContext, pref2.getSecondTargetResId(), null);
when(holder2.findViewById(pref.getClearId())).thenReturn(delete2);
group.addPreference(pref2);
LayoutPreference clearAll = mController.getClearAll(group);
group.addPreference(clearAll);
clearAll.findViewById(R.id.conversation_settings_clear_recents).performClick();
verify(mPs).removeAllRecentConversations();
assertThat((Preference) group.findPreference("hi:person")).isNull();
assertThat((Preference) group.findPreference("bye:person")).isNotNull();
}
use of android.app.people.ConversationChannel in project android_packages_apps_Settings by omnirom.
the class RecentConversationsPreferenceControllerTest method testGetSubSettingLauncher.
@Test
public void testGetSubSettingLauncher() {
ShortcutInfo si = mock(ShortcutInfo.class);
when(si.getId()).thenReturn("person");
when(si.getPackage()).thenReturn("pkg");
ConversationChannel ccw = new ConversationChannel(si, 6, new NotificationChannel("hi", "channel", 4), new NotificationChannelGroup("hi", "group"), 7, true);
Intent intent = mController.getSubSettingLauncher(ccw, "title").toIntent();
Bundle extras = intent.getExtras();
assertThat(extras.getString(AppInfoBase.ARG_PACKAGE_NAME)).isEqualTo(ccw.getShortcutInfo().getPackage());
assertThat(extras.getInt(AppInfoBase.ARG_PACKAGE_UID)).isEqualTo(ccw.getUid());
assertThat(extras.getString(Settings.EXTRA_CHANNEL_ID)).isEqualTo(ccw.getNotificationChannel().getId());
assertThat(extras.getString(Settings.EXTRA_CONVERSATION_ID)).isEqualTo(ccw.getShortcutInfo().getId());
}
use of android.app.people.ConversationChannel in project android_packages_apps_Settings by omnirom.
the class RecentConversationsPreferenceControllerTest method getTitle_withShortcut.
@Test
public void getTitle_withShortcut() {
ShortcutInfo si = mock(ShortcutInfo.class);
when(si.getLabel()).thenReturn("person");
ConversationChannel ccw = new ConversationChannel(si, 6, new NotificationChannel("hi", "channel", 4), new NotificationChannelGroup("hi", "group"), 7, true);
assertThat(mController.getTitle(ccw).toString()).isEqualTo(si.getLabel());
}
Aggregations