Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be15e099 authored by Flavio Lerda's avatar Flavio Lerda
Browse files

Partial fix for tests.

Change Ia0eb5bdd33c5bcebcf6267ce01f7d36c53396c30 added a new field to
the CallLogQuery: add it in the tests as well.

Change I45615616e03a603759888d9e7169a853b3328b14 added a new field to
ContactLoader: add it in the tests as well.

Change Ife8d494c19e2daef7e59d819ded52638dc9f2b6f removed bold first
names: remove from the tests the checks for bold in the names.

This helps getting further, but it does not actually fix all the tests.
The other errors might need a bit more investigation.

In the meanwhile this should not hurt.

Change-Id: Ib116b9a24002f1ee05b9246cbe985302b88a955b
parent 82651347
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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(
@@ -337,7 +338,8 @@ public class ContactLoaderTest extends LoaderTestCase {
                        "content:some.photo.uri",

                        0,
                        null
                        null,
                        0
                    );
        }

+14 −17
Original line number Diff line number Diff line
@@ -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.
    }

@@ -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);
    }
+3 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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
    }

@@ -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
    }

+2 −2
Original line number Diff line number Diff line
@@ -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
        });
    }

@@ -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. */
+12 −12
Original line number Diff line number Diff line
@@ -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() {
@@ -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() {
@@ -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