From: Tristan Van Berkom Date: Fri, 7 Dec 2012 09:00:42 +0000 (+0900) Subject: Fixed test-client-custom-summary to actually pass X-Git-Tag: upstream/3.7.4~145 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=30f3f1f4452a62669169f45359f6a92f4fd354b6;p=platform%2Fupstream%2Fevolution-data-server.git Fixed test-client-custom-summary to actually pass Was missing a vcard modification to test for EVC_N component, also enhanced test case to test both apis for each case and added one case to check the special '%' escape char is working. --- diff --git a/tests/libebook/client/test-client-custom-summary.c b/tests/libebook/client/test-client-custom-summary.c index b2fbbea..d308253 100644 --- a/tests/libebook/client/test-client-custom-summary.c +++ b/tests/libebook/client/test-client-custom-summary.c @@ -138,7 +138,9 @@ client_test_data_free (gpointer p) { ClientTestData *const data = p; g_object_unref (data->client); - e_book_query_unref (data->query); + + if (data->query) + e_book_query_unref (data->query); g_slice_free (ClientTestData, data); } @@ -235,23 +237,12 @@ main (gint argc, } /* Add contacts */ - if (!add_contact_from_test_case_verify (book_client, "custom-1", &contact_final)) { - g_object_unref (book_client); - return 1; - } - if (!add_contact_from_test_case_verify (book_client, "custom-2", &contact_final)) { - g_object_unref (book_client); - return 1; - } - if (!add_contact_from_test_case_verify (book_client, "custom-3", &contact_final)) { - g_object_unref (book_client); - return 1; - } - if (!add_contact_from_test_case_verify (book_client, "custom-4", &contact_final)) { - g_object_unref (book_client); - return 1; - } - if (!add_contact_from_test_case_verify (book_client, "custom-5", &contact_final)) { + if (!add_contact_from_test_case_verify (book_client, "custom-1", &contact_final) || + !add_contact_from_test_case_verify (book_client, "custom-2", &contact_final) || + !add_contact_from_test_case_verify (book_client, "custom-3", &contact_final) || + !add_contact_from_test_case_verify (book_client, "custom-4", &contact_final) || + !add_contact_from_test_case_verify (book_client, "custom-5", &contact_final) || + !add_contact_from_test_case_verify (book_client, "custom-6", &contact_final)) { g_object_unref (book_client); return 1; } @@ -260,21 +251,39 @@ main (gint argc, add_client_test ("/client/search/exact/fn", search_test, book_client, e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, "James Brown"), 1); + add_client_test ("/client/search/exact/name", search_test, book_client, + e_book_query_vcard_field_test(EVC_N, E_BOOK_QUERY_IS, "Janet"), + 1); add_client_test ("/client/search/prefix/fn", search_test, book_client, e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_BEGINS_WITH, "B"), 2); + add_client_test ("/client/search/prefix/fn/percent", search_test, book_client, + e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_BEGINS_WITH, "%"), + 1); add_client_test ("/client/search/suffix/phone", search_test, book_client, e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_ENDS_WITH, "999"), 2); add_client_test ("/client/search/suffix/email", search_test, book_client, e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_ENDS_WITH, "jackson.com"), 2); - add_client_test ("/client/search/exact/name", search_test, book_client, - e_book_query_vcard_field_test(EVC_N, E_BOOK_QUERY_IS, "Janet"), - 1); /* Add search tests that fetch uids */ + add_client_test ("/client/search-uid/exact/fn", uid_test, book_client, + e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, "James Brown"), + 1); add_client_test ("/client/search-uid/exact/name", uid_test, book_client, + e_book_query_vcard_field_test(EVC_N, E_BOOK_QUERY_IS, "Janet"), + 1); + add_client_test ("/client/search-uid/prefix/fn", uid_test, book_client, + e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_BEGINS_WITH, "B"), + 2); + add_client_test ("/client/search-uid/prefix/fn/percent", uid_test, book_client, + e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_BEGINS_WITH, "%"), + 1); + add_client_test ("/client/search-uid/suffix/phone", uid_test, book_client, + e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_ENDS_WITH, "999"), + 2); + add_client_test ("/client/search-uid/suffix/email", uid_test, book_client, e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_ENDS_WITH, "jackson.com"), 2); diff --git a/tests/libebook/data/vcards/custom-2.vcf b/tests/libebook/data/vcards/custom-2.vcf index c267827..56c5dd6 100644 --- a/tests/libebook/data/vcards/custom-2.vcf +++ b/tests/libebook/data/vcards/custom-2.vcf @@ -1,5 +1,6 @@ BEGIN:VCARD FN:Janet Jackson +N:Janet TEL;HOME:+7654321 EMAIL:janet@jackson.com EMAIL:janny@jackson.com diff --git a/tests/libebook/data/vcards/custom-6.vcf b/tests/libebook/data/vcards/custom-6.vcf new file mode 100644 index 0000000..d64650e --- /dev/null +++ b/tests/libebook/data/vcards/custom-6.vcf @@ -0,0 +1,3 @@ +BEGIN:VCARD +FN:%Strange Name +END:VCARD