diff options
author | Tyler Gunn <tgunn@google.com> | 2014-05-06 17:04:56 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-06 17:04:56 +0000 |
commit | 3d3ff68ffb5f0f30e03d4456892cf3e1912e39d4 (patch) | |
tree | 9ddccf18a740b4e4189de825d6eaf1df17310715 /tests | |
parent | eed2e4fbcbc614aad8f62b9a4ba78f161a2fd06a (diff) | |
parent | 146a4cdf57f0d4d0cd85e808f1df2bdea639b24c (diff) |
Merge "Adding support for expandable call log entries."
Diffstat (limited to 'tests')
4 files changed, 34 insertions, 115 deletions
diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java index 9b7d9de13..626ff1686 100644 --- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java +++ b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java @@ -22,6 +22,7 @@ import android.provider.CallLog.Calls; import android.test.AndroidTestCase; import android.text.Html; import android.text.Spanned; +import android.util.Log; import android.view.View; import android.widget.TextView; @@ -111,9 +112,9 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { public void testSetPhoneCallDetails_Normal() { setPhoneCallDetailsWithNumber("14125551212", Calls.PRESENTATION_ALLOWED, "1-412-555-1212"); - assertEquals("Yesterday", mViews.callTypeAndDate.getText().toString()); - assertEqualsHtml("<font color='#33b5e5'><b>Yesterday</b></font>", - mViews.callTypeAndDate.getText()); + assertTrue(mViews.callLocationAndDate.getText().toString().contains("Yesterday")); + assertTrue(mViews.callLocationAndDate.getText().toString().contains( + "<font color='#33b5e5'><b>Yesterday</b></font>")); } /** Asserts that a char sequence is actually a Spanned corresponding to the expected HTML. */ @@ -252,12 +253,12 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { /** Asserts that the label text field contains the given string value. */ private void assertLabelEquals(String text) { - assertEquals(text, mViews.labelView.getText().toString()); + assertTrue(mViews.callLocationAndDate.getText().toString().contains(text)); } /** Asserts that the date text field contains the given string value. */ private void assertDateEquals(String text) { - assertEquals(text, mViews.callTypeAndDate.getText().toString()); + assertTrue(mViews.callLocationAndDate.getText().toString().contains(text)); } /** Asserts that the call type contains the images with the given drawables. */ @@ -268,7 +269,7 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { assertEquals(id, mViews.callTypeIcons.getCallType(index)); } assertEquals(View.VISIBLE, mViews.callTypeIcons.getVisibility()); - assertEquals("Yesterday", mViews.callTypeAndDate.getText().toString()); + assertTrue(mViews.callLocationAndDate.getText().toString().contains("Yesterday")); } /** @@ -282,7 +283,8 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { assertEquals(id, mViews.callTypeIcons.getCallType(index)); } assertEquals(View.VISIBLE, mViews.callTypeIcons.getVisibility()); - assertEquals(overflowText + " Yesterday", mViews.callTypeAndDate.getText().toString()); + assertTrue(mViews.callLocationAndDate.getText().toString().contains(overflowText)); + assertTrue(mViews.callLocationAndDate.getText().toString().contains("Yesterday")); } /** Sets the phone call details with default values and the given number. */ diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java index 12cdb2b99..55e422498 100644 --- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java @@ -212,7 +212,7 @@ public class CallLogAdapterTest extends AndroidTestCase { public TestCallLogAdapter(Context context, CallFetcher callFetcher, ContactInfoHelper contactInfoHelper) { - super(context, callFetcher, contactInfoHelper, false, false); + super(context, callFetcher, contactInfoHelper, false); } @Override diff --git a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java index 25f53790b..a423cde21 100644 --- a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java @@ -35,6 +35,7 @@ import android.telephony.TelephonyManager; import android.test.ActivityInstrumentationTestCase2; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.MediumTest; +import android.util.Log; import android.view.View; import android.widget.FrameLayout; @@ -174,7 +175,6 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme insertPrivate(NOW, 0); View view = mAdapter.newGroupView(getActivity(), mParentView); mAdapter.bindGroupView(view, getActivity(), mCursor, 3, false); - assertNotNull(view.findViewById(R.id.secondary_action_icon)); } @MediumTest @@ -183,7 +183,6 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme insertPrivate(NOW, 0); View view = mAdapter.newStandAloneView(getActivity(), mParentView); mAdapter.bindStandAloneView(view, getActivity(), mCursor); - assertNotNull(view.findViewById(R.id.secondary_action_icon)); } @MediumTest @@ -192,7 +191,6 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme insertPrivate(NOW, 0); View view = mAdapter.newChildView(getActivity(), mParentView); mAdapter.bindChildView(view, getActivity(), mCursor); - assertNotNull(view.findViewById(R.id.secondary_action_icon)); } @MediumTest @@ -328,7 +326,7 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme // {@link com.android.dialer.calllog.CallLogAdapter#bindView} method. If it is possible // to place a call to the phone number, a call intent will have been created for the // primaryActionView. - IntentProvider intentProvider = (IntentProvider) views.primaryActionView.getTag(); + IntentProvider intentProvider = (IntentProvider) views.callBackButtonView.getTag(); Intent intent = intentProvider.getIntent(mActivity); // Starts a call. assertEquals(Intent.ACTION_CALL_PRIVILEGED, intent.getAction()); @@ -344,7 +342,7 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme mAdapter.bindStandAloneView(view, getActivity(), mCursor); CallLogListItemViews views = (CallLogListItemViews) view.getTag(); - IntentProvider intentProvider = (IntentProvider) views.secondaryActionButtonView.getTag(); + IntentProvider intentProvider = (IntentProvider) views.voicemailButtonView.getTag(); Intent intent = intentProvider.getIntent(mActivity); // Starts the call detail activity. assertEquals(new ComponentName(mActivity, CallDetailActivity.class), @@ -384,12 +382,12 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme if (presentation == Calls.PRESENTATION_RESTRICTED || presentation == Calls.PRESENTATION_UNKNOWN) { //If number is not callable, the primary action view should have a null tag. - assertNull(mItem.primaryActionView.getTag()); + assertNull(mItem.callBackButtonView.getTag()); } else { //If the number is callable, the primary action view should have a non-null tag. - assertNotNull(mItem.primaryActionView.getTag()); + assertNotNull(mItem.callBackButtonView.getTag()); - IntentProvider intentProvider = (IntentProvider)mItem.primaryActionView.getTag(); + IntentProvider intentProvider = (IntentProvider)mItem.callBackButtonView.getTag(); Intent callIntent = intentProvider.getIntent(mActivity); //The intent should be to make the call @@ -650,10 +648,9 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme /** Asserts that the label text view contains the given text. */ private void assertLabel(CallLogListItemViews views, CharSequence number, CharSequence label) { - assertEquals(label == null ? View.GONE : View.VISIBLE, - views.phoneCallDetailsViews.labelView.getVisibility()); if (label != null) { - assertEquals(label, views.phoneCallDetailsViews.labelView.getText().toString()); + assertTrue(views.phoneCallDetailsViews.callLocationAndDate.getText().toString() + .contains(label)); } } } diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java index 7e4736e35..15c16767c 100644 --- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java @@ -81,13 +81,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { public void testSetPhoneCallDetails() { setPhoneCallDetailsWithNumber("12125551234", Calls.PRESENTATION_ALLOWED, "1-212-555-1234"); - assertEquals(View.VISIBLE, mViews.secondaryActionButtonView.getVisibility()); - } - - public void testSetPhoneCallDetailsInFavorites() { - setPhoneCallDetailsWithNumberInFavorites("12125551234", Calls.PRESENTATION_ALLOWED, - "1-212-555-1234"); - assertNoCallIntent(); + assertEquals(View.VISIBLE, mViews.callBackButtonView.getVisibility()); } public void testSetPhoneCallDetails_Unknown() { @@ -95,73 +89,36 @@ public class CallLogListItemHelperTest extends AndroidTestCase { assertNoCallIntent(); } - public void testSetPhoneCallDetailsInFavorites_Unknown() { - setPhoneCallDetailsWithNumberInFavorites("", Calls.PRESENTATION_UNKNOWN, ""); - assertNoCallIntent(); - } - public void testSetPhoneCallDetails_Private() { setPhoneCallDetailsWithNumber("", Calls.PRESENTATION_RESTRICTED, ""); assertNoCallIntent(); } - public void testSetPhoneCallDetailsInFavorites_Private() { - setPhoneCallDetailsWithNumberInFavorites("", Calls.PRESENTATION_RESTRICTED, ""); - assertNoCallIntent(); - } - public void testSetPhoneCallDetails_Payphone() { setPhoneCallDetailsWithNumber("", Calls.PRESENTATION_PAYPHONE, ""); assertNoCallIntent(); } - public void testSetPhoneCallDetailsInFavorites_Payphone() { - setPhoneCallDetailsWithNumberInFavorites("", Calls.PRESENTATION_PAYPHONE, ""); - assertNoCallIntent(); - } - public void testSetPhoneCallDetails_VoicemailNumber() { setPhoneCallDetailsWithNumber(TEST_VOICEMAIL_NUMBER, Calls.PRESENTATION_ALLOWED, TEST_VOICEMAIL_NUMBER); - assertEquals(View.VISIBLE, mViews.secondaryActionButtonView.getVisibility()); + assertEquals(View.VISIBLE, mViews.voicemailButtonView.getVisibility()); } public void testSetPhoneCallDetails_ReadVoicemail() { setPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE); - assertEquals(View.VISIBLE, mViews.secondaryActionButtonView.getVisibility()); + assertEquals(View.VISIBLE, mViews.voicemailButtonView.getVisibility()); } public void testSetPhoneCallDetails_UnreadVoicemail() { setUnreadPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE); - assertEquals(View.VISIBLE, mViews.secondaryActionButtonView.getVisibility()); + assertEquals(View.VISIBLE, mViews.voicemailButtonView.getVisibility()); } public void testSetPhoneCallDetails_VoicemailFromUnknown() { setPhoneCallDetailsWithNumberAndType("", Calls.PRESENTATION_UNKNOWN, "", Calls.VOICEMAIL_TYPE); - assertEquals(View.VISIBLE, mViews.secondaryActionButtonView.getVisibility()); - } - - public void testSetPhoneCallDetailsInFavorites_VoicemailNumber() { - setPhoneCallDetailsWithNumberInFavorites(TEST_VOICEMAIL_NUMBER, - Calls.PRESENTATION_ALLOWED, TEST_VOICEMAIL_NUMBER); - assertNoCallIntent(); - } - - public void testSetPhoneCallDetailsInFavorites_ReadVoicemail() { - setPhoneCallDetailsWithTypesInFavorites(Calls.VOICEMAIL_TYPE); - assertEquals(View.VISIBLE, mViews.secondaryActionButtonView.getVisibility()); - } - - public void testSetPhoneCallDetailsInFavorites_UnreadVoicemail() { - setUnreadPhoneCallDetailsWithTypesInFavorites(Calls.VOICEMAIL_TYPE); - assertEquals(View.VISIBLE, mViews.secondaryActionButtonView.getVisibility()); - } - - public void testSetPhoneCallDetailsInFavorites_VoicemailFromUnknown() { - setPhoneCallDetailsWithNumberAndTypeInFavorites("", Calls.PRESENTATION_UNKNOWN, - "", Calls.VOICEMAIL_TYPE); - assertEquals(View.VISIBLE, mViews.secondaryActionButtonView.getVisibility()); + assertEquals(View.VISIBLE, mViews.voicemailButtonView.getVisibility()); } /** @@ -172,7 +129,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { PhoneCallDetails details = new PhoneCallDetails("", Calls.PRESENTATION_UNKNOWN, "", TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.INCOMING_TYPE}, TEST_DATE, TEST_DURATION); - assertEquals(R.string.description_unknown_answered_call, + assertEquals(R.string.description_incoming_answered_call, mHelper.getCallDescriptionStringID(details)); } @@ -184,7 +141,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { PhoneCallDetails details = new PhoneCallDetails("", Calls.PRESENTATION_UNKNOWN, "", TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.MISSED_TYPE}, TEST_DATE, TEST_DURATION); - assertEquals(R.string.description_unknown_missed_call, + assertEquals(R.string.description_incoming_missed_call, mHelper.getCallDescriptionStringID(details)); } @@ -196,7 +153,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { PhoneCallDetails details = new PhoneCallDetails("", Calls.PRESENTATION_UNKNOWN, "", TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.VOICEMAIL_TYPE}, TEST_DATE, TEST_DURATION); - assertEquals(R.string.description_unknown_missed_call, + assertEquals(R.string.description_incoming_missed_call, mHelper.getCallDescriptionStringID(details)); } @@ -209,7 +166,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.INCOMING_TYPE}, TEST_DATE, TEST_DURATION); - assertEquals(R.string.description_return_answered_call, + assertEquals(R.string.description_incoming_answered_call, mHelper.getCallDescriptionStringID(details)); } @@ -222,7 +179,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.MISSED_TYPE}, TEST_DATE, TEST_DURATION); - assertEquals(R.string.description_return_missed_call, + assertEquals(R.string.description_incoming_missed_call, mHelper.getCallDescriptionStringID(details)); } @@ -235,7 +192,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.VOICEMAIL_TYPE}, TEST_DATE, TEST_DURATION); - assertEquals(R.string.description_return_missed_call, + assertEquals(R.string.description_incoming_missed_call, mHelper.getCallDescriptionStringID(details)); } @@ -249,7 +206,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION); - assertEquals(R.string.description_call_last, + assertEquals(R.string.description_outgoing_call, mHelper.getCallDescriptionStringID(details)); } @@ -263,7 +220,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE}, TEST_DATE, TEST_DURATION); - assertEquals(R.string.description_call_last_multiple, + assertEquals(R.string.description_outgoing_call, mHelper.getCallDescriptionStringID(details)); } @@ -370,13 +327,6 @@ public class CallLogListItemHelperTest extends AndroidTestCase { formattedNumber, Calls.INCOMING_TYPE); } - /** Sets the details of a phone call in the favorite screen using the specified phone number. */ - private void setPhoneCallDetailsWithNumberInFavorites(String number, - int presentation, String formattedNumber) { - setPhoneCallDetailsWithNumberAndTypeInFavorites(number, presentation, - formattedNumber, Calls.INCOMING_TYPE); - } - /** Sets the details of a phone call using the specified phone number. */ private void setPhoneCallDetailsWithNumberAndType(String number, int presentation, String formattedNumber, int callType) { @@ -384,17 +334,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { new PhoneCallDetails(number, presentation, formattedNumber, TEST_COUNTRY_ISO, TEST_GEOCODE, new int[]{ callType }, TEST_DATE, TEST_DURATION), - false, false); - } - - /** Sets the details of a phone call in the favorite screen using the specified phone number. */ - private void setPhoneCallDetailsWithNumberAndTypeInFavorites(String number, - int presentation, String formattedNumber, int callType) { - mHelper.setPhoneCallDetails(mViews, - new PhoneCallDetails(number, presentation, formattedNumber, - TEST_COUNTRY_ISO, TEST_GEOCODE, - new int[]{ callType }, TEST_DATE, TEST_DURATION), - false, true); + false); } /** Sets the details of a phone call using the specified call type. */ @@ -403,16 +343,7 @@ public class CallLogListItemHelperTest extends AndroidTestCase { new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, types, TEST_DATE, TEST_DURATION), - false, false); - } - - /** Sets the details of a phone call in the favorite screen using the specified call type. */ - private void setPhoneCallDetailsWithTypesInFavorites(int... types) { - mHelper.setPhoneCallDetails(mViews, - new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, - TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, - types, TEST_DATE, TEST_DURATION), - false, true); + false); } /** Sets the details of an unread phone call using the specified call type. */ @@ -421,17 +352,6 @@ public class CallLogListItemHelperTest extends AndroidTestCase { new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, types, TEST_DATE, TEST_DURATION), - true, false); - } - - /** Sets the details of an unread phone call in the favorite screen using the specified call - * type. - */ - private void setUnreadPhoneCallDetailsWithTypesInFavorites(int... types) { - mHelper.setPhoneCallDetails(mViews, - new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, - TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, - types, TEST_DATE, TEST_DURATION), - true, true); + true); } } |