typedef struct {
ETestServerFixture parent;
- EContact *contacts[7];
+ EContact *contacts[9];
} ClientTestFixture;
static void
!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-7", it++)) {
+ !add_contact_from_test_case_verify (book_client, "custom-7", it++) ||
+ !add_contact_from_test_case_verify (book_client, "custom-8", it++) ||
+ !add_contact_from_test_case_verify (book_client, "custom-9", it++)) {
g_error ("Failed to add contacts");
}
#ifdef ENABLE_PHONENUMBER
- /* field based phone number queries do an index lookup */
- add_client_test (suites[i].prefix, "/EqPhone/Exact/Phone", suites[i].func,
+ /* These queries will do an index lookup with a custom summary, and a full table scan
+ * matching with EBookBackendSexp when the default summary is used
+ */
+ add_client_test (suites[i].prefix, "/EqPhone/Exact", suites[i].func,
e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_EQUALS_PHONE_NUMBER, "+1 221.542.3789"),
1, suites[i].direct, suites[i].custom);
- add_client_test (suites[i].prefix, "/EqPhone/National/Phone", suites[i].func,
+ /*********************************************
+ * E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER *
+ *********************************************/
+
+ /* Test that a query term with no specified country returns only vCards that
+ * are specifically in the active country code.
+ *
+ * | Active Country Code: +1 | Query: 221.542.3789 | vCard Data: +1-221-5423789 | Matches: yes |
+ * | Active Country Code: +1 | Query: 221.542.3789 | vCard Data: +3-221-5423789 | Matches: no |
+ */
+ add_client_test (suites[i].prefix, "/EqPhone/National", suites[i].func,
e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER, "221.542.3789"),
1, suites[i].direct, suites[i].custom);
- add_client_test (suites[i].prefix, "/EqPhone/Short/Phone", suites[i].func,
- e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER, "5423789"),
- 1, suites[i].direct, suites[i].custom);
+ /* Test that a query term with a specified country returns only vCards that
+ * are specifically in the specified country code.
+ *
+ * | Active Country Code: +1 | Query: +49 221.542.3789 | vCard Data: +1-221-5423789 | Matches: no |
+ * | Active Country Code: +1 | Query: +49 221.542.3789 | vCard Data: +3-221-5423789 | Matches: no |
+ */
+ add_client_test (suites[i].prefix, "/EqPhone/National/CountryMismatch", suites[i].func,
+ e_book_query_field_test (E_CONTACT_TEL,
+ E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER, "+49 221.542.3789"),
+ 0, suites[i].direct, suites[i].custom);
- /* vCard based phone number queries do a table scan */
- add_client_test (suites[i].prefix, "/EqPhone/Exact/Tel", suites[i].func,
- e_book_query_vcard_field_test (EVC_TEL, E_BOOK_QUERY_EQUALS_PHONE_NUMBER, "+1 221.542.3789"),
- 1, suites[i].direct, suites[i].custom);
- add_client_test (suites[i].prefix, "/EqPhone/National/Tel", suites[i].func,
- e_book_query_vcard_field_test (EVC_TEL, E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER, "221.542.3789"),
+
+ /* Test that a query term with the active country code specified returns a vCard with an unspecified
+ * country code.
+ *
+ * | Active Country Code: +1 | Query: +1 514-845-8436 | vCard Data: 514-845-8436 | Matches: yes |
+ */
+ add_client_test (suites[i].prefix, "/EqPhone/National/CountryAbsent/QueryWithCountry", suites[i].func,
+ e_book_query_field_test (E_CONTACT_TEL,
+ E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER, "+1 514-845-8436"),
1, suites[i].direct, suites[i].custom);
- add_client_test (suites[i].prefix, "/EqPhone/Short/Tel", suites[i].func,
- e_book_query_vcard_field_test(EVC_TEL, E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER, "5423789"),
+
+#if 0
+ /* FIXME: This test passes with the default summary, but fails in the custom summary.
+ *
+ * Because EBookBackendSexp uses a straiht-forward e_phone_number_compare_strings() method
+ * of comparison, it's my feeling that the method used in EBookBackendSqliteDB needs to be
+ * fixed (possibly by just using e_phone_number_compare_strings() directly in it's collation rule).
+ */
+
+ /* Test that a query term with an arbitrary country code specified returns a vCard with an unspecified
+ * country code.
+ *
+ * | Active Country Code: +1 | Query: +49 514-845-8436 | vCard Data: 514-845-8436 | Matches: yes |
+ */
+ add_client_test (suites[i].prefix, "/EqPhone/National/CountryAbsent/QueryOtherCountry", suites[i].func,
+ e_book_query_field_test (E_CONTACT_TEL,
+ E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER, "+49 514-845-8436"),
1, suites[i].direct, suites[i].custom);
+#endif
+
+ add_client_test (suites[i].prefix, "/EqPhone/Short", suites[i].func,
+ e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER, "5423789"),
+ 2, suites[i].direct, suites[i].custom);
#endif /* ENABLE_PHONENUMBER */