Extending test-client-custom-summary.c
authorTristan Van Berkom <tristanvb@openismus.com>
Wed, 20 Feb 2013 11:45:24 +0000 (20:45 +0900)
committerTristan Van Berkom <tristanvb@openismus.com>
Wed, 20 Feb 2013 11:45:24 +0000 (20:45 +0900)
Added test to ensure that phone numbers are not accidentally normalized,
and that we dont get a result for ENDS_WITH "8899" if a phone number
ending with "88 99" exists in the addressbook.

tests/libebook/client/test-client-custom-summary.c
tests/libebook/data/vcards/custom-7.vcf [new file with mode: 0644]

index 4b24fb3..d7ff03f 100644 (file)
@@ -36,7 +36,7 @@ typedef struct {
 
 typedef struct {
        ETestServerFixture parent;
-       EContact *contacts[6];
+       EContact *contacts[7];
 } ClientTestFixture;
 
 static void
@@ -138,7 +138,8 @@ setup_book (ClientTestFixture *fixture)
            !add_contact_from_test_case_verify (book_client, "custom-3", it++) ||
            !add_contact_from_test_case_verify (book_client, "custom-4", it++) ||
            !add_contact_from_test_case_verify (book_client, "custom-5", it++) ||
-           !add_contact_from_test_case_verify (book_client, "custom-6", it++)) {
+           !add_contact_from_test_case_verify (book_client, "custom-6", it++) ||
+           !add_contact_from_test_case_verify (book_client, "custom-7", it++)) {
                g_error ("Failed to add contacts");
        }
 
@@ -282,6 +283,14 @@ main (gint argc,
                                 e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_ENDS_WITH, "999"),
                                 2, suites[i].direct);
 
+               /* This test proves that we do not get any results for custom-7.vcf, which contains
+                * a phone number ending with "88 99", if this were accidentally normalized, we would
+                * get a result for it.
+                */
+               add_client_test (suites[i].prefix, "/Suffix/Phone/NotNormalized", suites[i].func,
+                                e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_ENDS_WITH, "8899"),
+                                0, suites[i].direct);
+
                add_client_test (suites[i].prefix, "/Suffix/Email", suites[i].func,
                                 e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_ENDS_WITH, "jackson.com"),
                                 2, suites[i].direct);
diff --git a/tests/libebook/data/vcards/custom-7.vcf b/tests/libebook/data/vcards/custom-7.vcf
new file mode 100644 (file)
index 0000000..f691637
--- /dev/null
@@ -0,0 +1,4 @@
+BEGIN:VCARD
+FN:Purple Goose
+TEL;HOME:+49-89-7888 99
+END:VCARD