Loading tests/src/com/android/contacts/ContactLoaderTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -301,6 +301,7 @@ public class ContactLoaderTest extends LoaderTestCase { Contacts.SEND_TO_VOICEMAIL, Contacts.CUSTOM_RINGTONE, Contacts.IS_USER_PROFILE, }) .withSortOrder(Contacts.Entity.RAW_CONTACT_ID) .returnRow( Loading Loading @@ -337,7 +338,8 @@ public class ContactLoaderTest extends LoaderTestCase { "content:some.photo.uri", 0, null null, 0 ); } Loading tests/src/com/android/contacts/PhoneCallDetailsHelperTest.java +14 −17 Original line number Diff line number Diff line Loading @@ -175,34 +175,25 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { } public void testSetPhoneCallDetails_Geocode() { setPhoneCallDetailsWithNumber("+14125555555", "1-412-555-5555"); setPhoneCallDetailsWithNumberAndGeocode("+14125555555", "1-412-555-5555", "Pennsylvania"); assertNameEquals("1-412-555-5555"); // The phone number is shown as the name. assertNumberEquals("Pennsylvania"); // The geocode is shown as the number. } public void testSetPhoneCallDetails_NoGeocode() { setPhoneCallDetailsWithNumber("+0", "+0"); assertNameEquals("+0"); // The phone number is shown as the name. assertNumberEquals("-"); // The empty geocode is shown as the number. } public void testSetPhoneCallDetails_NoGeocodeForUnknown() { setPhoneCallDetailsWithNumber(CallerInfo.UNKNOWN_NUMBER, ""); assertNumberEquals("-"); // The empty geocode is shown as the number. } public void testSetPhoneCallDetails_NoGeocodeForPrivate() { setPhoneCallDetailsWithNumber(CallerInfo.PRIVATE_NUMBER, ""); setPhoneCallDetailsWithNumberAndGeocode("+14125555555", "1-412-555-5555", null); assertNameEquals("1-412-555-5555"); // The phone number is shown as the name. assertNumberEquals("-"); // The empty geocode is shown as the number. } public void testSetPhoneCallDetails_NoGeocodeForPayphone() { setPhoneCallDetailsWithNumber(CallerInfo.PAYPHONE_NUMBER, ""); public void testSetPhoneCallDetails_EmptyGeocode() { setPhoneCallDetailsWithNumberAndGeocode("+14125555555", "1-412-555-5555", ""); assertNameEquals("1-412-555-5555"); // The phone number is shown as the name. assertNumberEquals("-"); // The empty geocode is shown as the number. } public void testSetPhoneCallDetails_NoGeocodeForVoicemail() { setPhoneCallDetailsWithNumber(TEST_VOICEMAIL_NUMBER, ""); setPhoneCallDetailsWithNumberAndGeocode(TEST_VOICEMAIL_NUMBER, "", "United States"); assertNumberEquals("-"); // The empty geocode is shown as the number. } Loading Loading @@ -269,8 +260,14 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { /** Sets the phone call details with default values and the given number. */ private void setPhoneCallDetailsWithNumber(String number, String formattedNumber) { setPhoneCallDetailsWithNumberAndGeocode(number, formattedNumber, TEST_GEOCODE); } /** Sets the phone call details with default values and the given number. */ private void setPhoneCallDetailsWithNumberAndGeocode(String number, String formattedNumber, String geocodedLocation) { mHelper.setPhoneCallDetails(mViews, new PhoneCallDetails(number, formattedNumber, TEST_COUNTRY_ISO, TEST_GEOCODE, new PhoneCallDetails(number, formattedNumber, TEST_COUNTRY_ISO, geocodedLocation, new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION), true); } Loading tests/src/com/android/contacts/activities/CallLogActivityTests.java +3 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ public class CallLogActivityTests Calls.TYPE, Calls.COUNTRY_ISO, Calls.VOICEMAIL_URI, Calls.GEOCODED_LOCATION, CallLogFragment.CallLogQuery.SECTION_NAME, }; private static final int RAND_DURATION = -1; Loading Loading @@ -505,6 +506,7 @@ public class CallLogActivityTests row.add(type); // type row.add(TEST_COUNTRY_ISO); // country ISO row.add(null); // voicemail_uri row.add(null); // geocoded_location row.add(CallLogFragment.CallLogQuery.SECTION_OLD_ITEM); // section } Loading Loading @@ -535,6 +537,7 @@ public class CallLogActivityTests row.add(Calls.VOICEMAIL_TYPE); // type row.add(TEST_COUNTRY_ISO); // country ISO row.add(voicemailUri); // voicemail_uri row.add(null); // geocoded_location row.add(CallLogFragment.CallLogQuery.SECTION_OLD_ITEM); // section } Loading tests/src/com/android/contacts/calllog/CallLogGroupBuilderTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -224,7 +224,7 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { } mCursor.moveToNext(); mCursor.addRow(new Object[]{ mCursor.getPosition(), number, 0L, 0L, type, "", "", section mCursor.getPosition(), number, 0L, 0L, type, "", "", "", section }); } Loading @@ -245,7 +245,7 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { throw new IllegalArgumentException("not a header section: " + section); } mCursor.moveToNext(); mCursor.addRow(new Object[]{ mCursor.getPosition(), "", 0L, 0L, 0, "", "", section }); mCursor.addRow(new Object[]{ mCursor.getPosition(), "", 0L, 0L, 0, "", "", "", section }); } /** Asserts that the group matches the given values. */ Loading tests/src/com/android/contacts/format/DisplayNameFormatterTest.java +12 −12 Original line number Diff line number Diff line Loading @@ -53,32 +53,32 @@ public class DisplayNameFormatterTest extends AndroidTestCase { public void testSetDisplayName_Simple() { setNames("John Doe", "Doe John"); setDisplayName(); SpannedTestUtils.checkHtmlText("<b>John </b>Doe", mView); SpannedTestUtils.checkHtmlText("John Doe", mView); setNames("Jean Pierre Doe", "Doe Jean Pierre"); setDisplayName(); SpannedTestUtils.checkHtmlText("<b>Jean Pierre </b>Doe", mView); SpannedTestUtils.checkHtmlText("Jean Pierre Doe", mView); setNames("John Doe Smith", "Doe Smith John"); setDisplayName(); SpannedTestUtils.checkHtmlText("<b>John </b>Doe Smith", mView); SpannedTestUtils.checkHtmlText("John Doe Smith", mView); } public void testSetDisplayName_AccidentalOverlap() { // This is probably not what we want, but we assume that the two names differ only in the // order in which the two components are listed. setNames("Johnson John", "Johnson Smith"); setDisplayName(); SpannedTestUtils.checkHtmlText("<b>Johnson </b>John", mView); SpannedTestUtils.checkHtmlText("Johnson John", mView); } public void testSetDisplayName_Reversed() { setNames("John Doe", "Doe John"); setDisplayNameReversed(); SpannedTestUtils.checkHtmlText("John <b>Doe</b>", mView); SpannedTestUtils.checkHtmlText("John Doe", mView); setNames("Jean Pierre Doe", "Doe Jean Pierre"); setDisplayNameReversed(); SpannedTestUtils.checkHtmlText("Jean Pierre <b>Doe</b>", mView); SpannedTestUtils.checkHtmlText("Jean Pierre Doe", mView); setNames("John Doe Smith", "Doe Smith John"); setDisplayNameReversed(); SpannedTestUtils.checkHtmlText("John <b>Doe Smith</b>", mView); SpannedTestUtils.checkHtmlText("John Doe Smith", mView); } public void testSetDisplayName_NoOverlap() { Loading @@ -90,26 +90,26 @@ public class DisplayNameFormatterTest extends AndroidTestCase { public void testSetDisplayName_Prefix() { setNames("John Doe", "Doe John"); setDisplayNameWithPrefix("DO"); SpannedTestUtils.checkHtmlText("<b>John </b>" + START + "Do" + END + "e", mView); SpannedTestUtils.checkHtmlText("John " + START + "Do" + END + "e", mView); } public void testSetDisplayName_PrefixFirstName() { setNames("John Doe", "Doe John"); setDisplayNameWithPrefix("JO"); SpannedTestUtils.checkHtmlText(START + "<b>Jo</b>" + END + "<b>hn </b>Doe", mView); SpannedTestUtils.checkHtmlText(START + "Jo" + END + "hn Doe", mView); } public void testSetDisplayName_PrefixMiddleName() { setNames("John Paul Doe", "Doe John Paul"); setDisplayNameWithPrefix("PAU"); SpannedTestUtils.checkHtmlText("<b>John </b>" + START + "<b>Pau</b>" + END + "<b>l </b>Doe", SpannedTestUtils.checkHtmlText("John " + START + "Pau" + END + "l Doe", mView); } public void testSetDisplayName_ReversedPrefix() { setNames("John Doe", "Doe John"); setDisplayNameReversedWithPrefix("DO"); SpannedTestUtils.checkHtmlText("John " + START + "<b>Do</b>" + END + "<b>e</b>", mView); SpannedTestUtils.checkHtmlText("John " + START + "Do" + END + "e", mView); } public void testSetDisplayName_Empty() { Loading @@ -136,7 +136,7 @@ public class DisplayNameFormatterTest extends AndroidTestCase { mDisplayNameFormatter.setTextWithHighlightingFactory(new TestTextWithHighlightingFactory()); setNames("John Doe", "Doe John"); setDisplayNameWithHighlighting(); SpannedTestUtils.checkHtmlText("<i><b>John </b></i><i>Doe</i> <i>Doe John</i>", mView); SpannedTestUtils.checkHtmlText("<i>John Doe</i> <i>Doe John</i>", mView); } /** Loading Loading
tests/src/com/android/contacts/ContactLoaderTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -301,6 +301,7 @@ public class ContactLoaderTest extends LoaderTestCase { Contacts.SEND_TO_VOICEMAIL, Contacts.CUSTOM_RINGTONE, Contacts.IS_USER_PROFILE, }) .withSortOrder(Contacts.Entity.RAW_CONTACT_ID) .returnRow( Loading Loading @@ -337,7 +338,8 @@ public class ContactLoaderTest extends LoaderTestCase { "content:some.photo.uri", 0, null null, 0 ); } Loading
tests/src/com/android/contacts/PhoneCallDetailsHelperTest.java +14 −17 Original line number Diff line number Diff line Loading @@ -175,34 +175,25 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { } public void testSetPhoneCallDetails_Geocode() { setPhoneCallDetailsWithNumber("+14125555555", "1-412-555-5555"); setPhoneCallDetailsWithNumberAndGeocode("+14125555555", "1-412-555-5555", "Pennsylvania"); assertNameEquals("1-412-555-5555"); // The phone number is shown as the name. assertNumberEquals("Pennsylvania"); // The geocode is shown as the number. } public void testSetPhoneCallDetails_NoGeocode() { setPhoneCallDetailsWithNumber("+0", "+0"); assertNameEquals("+0"); // The phone number is shown as the name. assertNumberEquals("-"); // The empty geocode is shown as the number. } public void testSetPhoneCallDetails_NoGeocodeForUnknown() { setPhoneCallDetailsWithNumber(CallerInfo.UNKNOWN_NUMBER, ""); assertNumberEquals("-"); // The empty geocode is shown as the number. } public void testSetPhoneCallDetails_NoGeocodeForPrivate() { setPhoneCallDetailsWithNumber(CallerInfo.PRIVATE_NUMBER, ""); setPhoneCallDetailsWithNumberAndGeocode("+14125555555", "1-412-555-5555", null); assertNameEquals("1-412-555-5555"); // The phone number is shown as the name. assertNumberEquals("-"); // The empty geocode is shown as the number. } public void testSetPhoneCallDetails_NoGeocodeForPayphone() { setPhoneCallDetailsWithNumber(CallerInfo.PAYPHONE_NUMBER, ""); public void testSetPhoneCallDetails_EmptyGeocode() { setPhoneCallDetailsWithNumberAndGeocode("+14125555555", "1-412-555-5555", ""); assertNameEquals("1-412-555-5555"); // The phone number is shown as the name. assertNumberEquals("-"); // The empty geocode is shown as the number. } public void testSetPhoneCallDetails_NoGeocodeForVoicemail() { setPhoneCallDetailsWithNumber(TEST_VOICEMAIL_NUMBER, ""); setPhoneCallDetailsWithNumberAndGeocode(TEST_VOICEMAIL_NUMBER, "", "United States"); assertNumberEquals("-"); // The empty geocode is shown as the number. } Loading Loading @@ -269,8 +260,14 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { /** Sets the phone call details with default values and the given number. */ private void setPhoneCallDetailsWithNumber(String number, String formattedNumber) { setPhoneCallDetailsWithNumberAndGeocode(number, formattedNumber, TEST_GEOCODE); } /** Sets the phone call details with default values and the given number. */ private void setPhoneCallDetailsWithNumberAndGeocode(String number, String formattedNumber, String geocodedLocation) { mHelper.setPhoneCallDetails(mViews, new PhoneCallDetails(number, formattedNumber, TEST_COUNTRY_ISO, TEST_GEOCODE, new PhoneCallDetails(number, formattedNumber, TEST_COUNTRY_ISO, geocodedLocation, new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION), true); } Loading
tests/src/com/android/contacts/activities/CallLogActivityTests.java +3 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ public class CallLogActivityTests Calls.TYPE, Calls.COUNTRY_ISO, Calls.VOICEMAIL_URI, Calls.GEOCODED_LOCATION, CallLogFragment.CallLogQuery.SECTION_NAME, }; private static final int RAND_DURATION = -1; Loading Loading @@ -505,6 +506,7 @@ public class CallLogActivityTests row.add(type); // type row.add(TEST_COUNTRY_ISO); // country ISO row.add(null); // voicemail_uri row.add(null); // geocoded_location row.add(CallLogFragment.CallLogQuery.SECTION_OLD_ITEM); // section } Loading Loading @@ -535,6 +537,7 @@ public class CallLogActivityTests row.add(Calls.VOICEMAIL_TYPE); // type row.add(TEST_COUNTRY_ISO); // country ISO row.add(voicemailUri); // voicemail_uri row.add(null); // geocoded_location row.add(CallLogFragment.CallLogQuery.SECTION_OLD_ITEM); // section } Loading
tests/src/com/android/contacts/calllog/CallLogGroupBuilderTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -224,7 +224,7 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { } mCursor.moveToNext(); mCursor.addRow(new Object[]{ mCursor.getPosition(), number, 0L, 0L, type, "", "", section mCursor.getPosition(), number, 0L, 0L, type, "", "", "", section }); } Loading @@ -245,7 +245,7 @@ public class CallLogGroupBuilderTest extends AndroidTestCase { throw new IllegalArgumentException("not a header section: " + section); } mCursor.moveToNext(); mCursor.addRow(new Object[]{ mCursor.getPosition(), "", 0L, 0L, 0, "", "", section }); mCursor.addRow(new Object[]{ mCursor.getPosition(), "", 0L, 0L, 0, "", "", "", section }); } /** Asserts that the group matches the given values. */ Loading
tests/src/com/android/contacts/format/DisplayNameFormatterTest.java +12 −12 Original line number Diff line number Diff line Loading @@ -53,32 +53,32 @@ public class DisplayNameFormatterTest extends AndroidTestCase { public void testSetDisplayName_Simple() { setNames("John Doe", "Doe John"); setDisplayName(); SpannedTestUtils.checkHtmlText("<b>John </b>Doe", mView); SpannedTestUtils.checkHtmlText("John Doe", mView); setNames("Jean Pierre Doe", "Doe Jean Pierre"); setDisplayName(); SpannedTestUtils.checkHtmlText("<b>Jean Pierre </b>Doe", mView); SpannedTestUtils.checkHtmlText("Jean Pierre Doe", mView); setNames("John Doe Smith", "Doe Smith John"); setDisplayName(); SpannedTestUtils.checkHtmlText("<b>John </b>Doe Smith", mView); SpannedTestUtils.checkHtmlText("John Doe Smith", mView); } public void testSetDisplayName_AccidentalOverlap() { // This is probably not what we want, but we assume that the two names differ only in the // order in which the two components are listed. setNames("Johnson John", "Johnson Smith"); setDisplayName(); SpannedTestUtils.checkHtmlText("<b>Johnson </b>John", mView); SpannedTestUtils.checkHtmlText("Johnson John", mView); } public void testSetDisplayName_Reversed() { setNames("John Doe", "Doe John"); setDisplayNameReversed(); SpannedTestUtils.checkHtmlText("John <b>Doe</b>", mView); SpannedTestUtils.checkHtmlText("John Doe", mView); setNames("Jean Pierre Doe", "Doe Jean Pierre"); setDisplayNameReversed(); SpannedTestUtils.checkHtmlText("Jean Pierre <b>Doe</b>", mView); SpannedTestUtils.checkHtmlText("Jean Pierre Doe", mView); setNames("John Doe Smith", "Doe Smith John"); setDisplayNameReversed(); SpannedTestUtils.checkHtmlText("John <b>Doe Smith</b>", mView); SpannedTestUtils.checkHtmlText("John Doe Smith", mView); } public void testSetDisplayName_NoOverlap() { Loading @@ -90,26 +90,26 @@ public class DisplayNameFormatterTest extends AndroidTestCase { public void testSetDisplayName_Prefix() { setNames("John Doe", "Doe John"); setDisplayNameWithPrefix("DO"); SpannedTestUtils.checkHtmlText("<b>John </b>" + START + "Do" + END + "e", mView); SpannedTestUtils.checkHtmlText("John " + START + "Do" + END + "e", mView); } public void testSetDisplayName_PrefixFirstName() { setNames("John Doe", "Doe John"); setDisplayNameWithPrefix("JO"); SpannedTestUtils.checkHtmlText(START + "<b>Jo</b>" + END + "<b>hn </b>Doe", mView); SpannedTestUtils.checkHtmlText(START + "Jo" + END + "hn Doe", mView); } public void testSetDisplayName_PrefixMiddleName() { setNames("John Paul Doe", "Doe John Paul"); setDisplayNameWithPrefix("PAU"); SpannedTestUtils.checkHtmlText("<b>John </b>" + START + "<b>Pau</b>" + END + "<b>l </b>Doe", SpannedTestUtils.checkHtmlText("John " + START + "Pau" + END + "l Doe", mView); } public void testSetDisplayName_ReversedPrefix() { setNames("John Doe", "Doe John"); setDisplayNameReversedWithPrefix("DO"); SpannedTestUtils.checkHtmlText("John " + START + "<b>Do</b>" + END + "<b>e</b>", mView); SpannedTestUtils.checkHtmlText("John " + START + "Do" + END + "e", mView); } public void testSetDisplayName_Empty() { Loading @@ -136,7 +136,7 @@ public class DisplayNameFormatterTest extends AndroidTestCase { mDisplayNameFormatter.setTextWithHighlightingFactory(new TestTextWithHighlightingFactory()); setNames("John Doe", "Doe John"); setDisplayNameWithHighlighting(); SpannedTestUtils.checkHtmlText("<i><b>John </b></i><i>Doe</i> <i>Doe John</i>", mView); SpannedTestUtils.checkHtmlText("<i>John Doe</i> <i>Doe John</i>", mView); } /** Loading