Fixes tests.
For the case of more than 3 calls, we show the total count.
Bug: 5112288
Change-Id: I9ebb518b35f600a783023ba764319b33237b4cd4
diff --git a/tests/src/com/android/contacts/PhoneCallDetailsHelperTest.java b/tests/src/com/android/contacts/PhoneCallDetailsHelperTest.java
index 1e5d879..0d371d8 100644
--- a/tests/src/com/android/contacts/PhoneCallDetailsHelperTest.java
+++ b/tests/src/com/android/contacts/PhoneCallDetailsHelperTest.java
@@ -148,7 +148,9 @@
public void testSetPhoneCallDetails_MultipleCallTypeIconsLastOneDropped() {
setPhoneCallDetailsWithCallTypeIcons(Calls.MISSED_TYPE, Calls.MISSED_TYPE,
Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE);
- assertCallTypeIconsEquals(Calls.MISSED_TYPE, Calls.MISSED_TYPE, Calls.INCOMING_TYPE);
+ assertCallTypeIconsEqualsPlusOverflow(
+ getContext().getString(R.string.call_log_item_count, 4),
+ Calls.MISSED_TYPE, Calls.MISSED_TYPE, Calls.INCOMING_TYPE);
}
public void testSetPhoneCallDetails_CallTypeText() {
@@ -234,6 +236,22 @@
assertEquals(View.GONE, mViews.callTypeSeparator.getVisibility());
}
+ /**
+ * Asserts that the call type contains the images with the given drawables and shows the given
+ * text next to the icons.
+ */
+ private void assertCallTypeIconsEqualsPlusOverflow(String overflowText, int... ids) {
+ assertEquals(ids.length, mViews.callTypeIcons.getCount());
+ for (int index = 0; index < ids.length; ++index) {
+ int id = ids[index];
+ assertEquals(id, mViews.callTypeIcons.getCallType(index));
+ }
+ assertEquals(View.VISIBLE, mViews.callTypeIcons.getVisibility());
+ assertEquals(View.VISIBLE, mViews.callTypeText.getVisibility());
+ assertEquals(overflowText, mViews.callTypeText.getText().toString());
+ assertEquals(View.VISIBLE, mViews.callTypeSeparator.getVisibility());
+ }
+
/** Asserts that the call type contains the given text. */
private void assertCallTypeTextEquals(String text) {
assertEquals(text, mViews.callTypeText.getText().toString());