[evolution-data-server] Fixed test-client-custom-summary to actually pass
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Fixed test-client-custom-summary to actually pass
- Date: Fri, 7 Dec 2012 09:02:09 +0000 (UTC)
commit 30f3f1f4452a62669169f45359f6a92f4fd354b6
Author: Tristan Van Berkom <tristanvb openismus com>
Date: Fri Dec 7 18:00:42 2012 +0900
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.
tests/libebook/client/test-client-custom-summary.c | 51 ++++++++++++--------
tests/libebook/data/vcards/custom-2.vcf | 1 +
tests/libebook/data/vcards/custom-6.vcf | 3 +
3 files changed, 34 insertions(+), 21 deletions(-)
---
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]