From 5619f2ed87cb207352c0ff5578348baeb69ee202 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Tue, 15 Jul 2014 12:40:28 -0700 Subject: Various call log / call details video call changes. Requires cl/501841. Call log: 1. Add video call affordance. 2. Add accessibility text for calls, video call afforance. 3. Fixed unit test Call details: 1. Showing video icon when a call had video. 2. Changing call headings to indicate they were video calls. Bug: 16013879 Bug: 16013344 Bug: 16013684 Change-Id: I53b5bf9b0b1a63f9d119318d59f690d310cca7c8 --- .../android/dialer/PhoneCallDetailsHelperTest.java | 33 ++++++++++++++++++++++ .../dialer/calllog/CallLogListItemHelperTest.java | 15 ++++++++++ .../dialer/calllog/CallLogQueryTestUtils.java | 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java index 147201bcb..d0c13eeb6 100644 --- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java +++ b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java @@ -159,6 +159,22 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { assertCallTypeIconsEquals(Calls.VOICEMAIL_TYPE); } + /** + * Tests a case where the video call feature is present. + */ + public void testSetPhoneCallDetails_Video() { + setPhoneCallDetailsWithFeatures(Calls.FEATURES_VIDEO); + assertIsVideoCall(true); + } + + /** + * Tests a case where the video call feature is not present. + */ + public void testSetPhoneCallDetails_NoVideo() { + setPhoneCallDetailsWithFeatures(Calls.FEATURES_NONE); + assertIsVideoCall(false); + } + public void testSetPhoneCallDetails_MultipleCallTypeIcons() { setPhoneCallDetailsWithCallTypeIcons(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE); assertCallTypeIconsEquals(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE); @@ -258,6 +274,11 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { assertTrue(mViews.callLocationAndDate.getText().toString().contains(text)); } + /** Asserts that the video icon is shown. */ + private void assertIsVideoCall(boolean isVideoCall) { + assertEquals(isVideoCall, mViews.callTypeIcons.isVideoShown()); + } + /** Asserts that the call type contains the images with the given drawables. */ private void assertCallTypeIconsEquals(int... ids) { assertEquals(ids.length, mViews.callTypeIcons.getCount()); @@ -325,6 +346,18 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { ); } + /** + * Sets the phone call details with default values and the given call features. + */ + private void setPhoneCallDetailsWithFeatures(int features) { + mHelper.setPhoneCallDetails(mViews, + new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, + TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, + new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null, + features, null) + ); + } + private void setCallDetailsHeaderWithNumber(String number, int presentation) { mHelper.setCallDetailsHeader(mNameView, new PhoneCallDetails(number, presentation, diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java index 8fbda1596..4c9d92cfc 100644 --- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java @@ -327,6 +327,21 @@ public class CallLogListItemHelperTest extends AndroidTestCase { .contains(this.mResources.getString(R.string.description_num_calls, 2))); } + /** + * Test getCallDescription method used to get the accessibility description for calls. + * Test that the "Video call." message is present if the call had video capability. + */ + public void testGetCallDescription_Video() { + PhoneCallDetails details = new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, + TEST_FORMATTED_NUMBER, + TEST_COUNTRY_ISO, TEST_GEOCODE, + new int[]{Calls.INCOMING_TYPE, Calls.INCOMING_TYPE}, TEST_DATE, TEST_DURATION, + null, Calls.FEATURES_VIDEO, null); + CharSequence description = mHelper.getCallDescription(details); + assertTrue(description.toString() + .contains(this.mResources.getString(R.string.description_video_call, 2))); + } + /** Asserts that the primary action view does not have a call intent. */ private void assertNoCallIntent() { Object intentProvider = (IntentProvider)mViews.primaryActionView.getTag(); diff --git a/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java b/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java index c13b936e5..dc3f525d8 100644 --- a/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java +++ b/tests/src/com/android/dialer/calllog/CallLogQueryTestUtils.java @@ -29,7 +29,7 @@ public class CallLogQueryTestUtils { public static Object[] createTestValues() { Object[] values = new Object[]{ 0L, "", 0L, 0L, Calls.INCOMING_TYPE, "", "", "", null, 0, null, null, null, null, - 0L, null, 0, Calls.PRESENTATION_ALLOWED, + 0L, null, 0, Calls.PRESENTATION_ALLOWED, null, null, Calls.FEATURES_NONE, null }; assertEquals(CallLogQuery._PROJECTION.length, values.length); return values; -- cgit v1.2.3