[evolution-data-server/sqlite-refactor: 8/17] Ported the lower level cursor tests to use EBookBackendSqlite.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/sqlite-refactor: 8/17] Ported the lower level cursor tests to use EBookBackendSqlite.
- Date: Tue, 26 Nov 2013 11:53:47 +0000 (UTC)
commit 19fe575c2b34903624e07ac83e8ebd09cd7217cf
Author: Tristan Van Berkom <tristanvb openismus com>
Date: Mon Nov 18 19:41:53 2013 +0900
Ported the lower level cursor tests to use EBookBackendSqlite.
Also, with the addition of E_BOOK_INDEX_SORT_KEY, customized books
need to specify that for fields they want to use as sort keys.
tests/libedata-book/data-test-utils.c | 134 ++++-----
tests/libedata-book/data-test-utils.h | 23 +-
tests/libedata-book/test-sqlite-create-cursor.c | 48 ++--
tests/libedata-book/test-sqlite-cursor-calculate.c | 324 ++++++++++----------
tests/libedata-book/test-sqlite-cursor-set-sexp.c | 54 ++--
.../libedata-book/test-sqlite-cursor-set-target.c | 54 ++--
tests/libedata-book/test-sqlite-get-contact.c | 12 +-
7 files changed, 322 insertions(+), 327 deletions(-)
---
diff --git a/tests/libedata-book/data-test-utils.c b/tests/libedata-book/data-test-utils.c
index f917f0b..f539d24 100644
--- a/tests/libedata-book/data-test-utils.c
+++ b/tests/libedata-book/data-test-utils.c
@@ -32,9 +32,6 @@
(g_type_class_unref (g_type_class_ref (type)))
-#define SQLITEDB_EMAIL_ID "addressbook localbackend com"
-#define SQLITEDB_FOLDER_NAME "folder"
-
gchar *
new_vcard_from_test_case (const gchar *case_name)
{
@@ -153,27 +150,25 @@ get_addressbook_directory (ESourceRegistry *registry,
return filename;
}
-static EBookBackendSqliteDB *
+static EBookBackendSqlite *
open_sqlitedb (ESourceRegistry *registry,
ESource *source)
{
- EBookBackendSqliteDB *ebsdb;
+ EBookBackendSqlite *ebsql;
GError *error = NULL;
- gchar *dirname;
+ gchar *dirname, *fullpath;
- dirname = get_addressbook_directory (registry, source);
- ebsdb = e_book_backend_sqlitedb_new (dirname,
- SQLITEDB_EMAIL_ID,
- SQLITEDB_FOLDER_ID,
- SQLITEDB_FOLDER_NAME,
- TRUE, &error);
+ dirname = get_addressbook_directory (registry, source);
+ fullpath = g_build_filename (dirname, "contacts.db", NULL);
+ ebsql = e_book_backend_sqlite_new (fullpath, TRUE, &error);
- if (!ebsdb)
+ if (!ebsql)
g_error ("Failed to open SQLite backend: %s", error->message);
g_free (dirname);
+ g_free (fullpath);
- return ebsdb;
+ return ebsql;
}
void
@@ -185,7 +180,7 @@ e_sqlitedb_fixture_setup (ESqliteDBFixture *fixture,
e_test_server_utils_setup ((ETestServerFixture *)fixture, user_data);
book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
- fixture->ebsdb = open_sqlitedb (((ETestServerFixture *)fixture)->registry,
+ fixture->ebsql = open_sqlitedb (((ETestServerFixture *)fixture)->registry,
e_client_get_source (E_CLIENT (book_client)));
}
@@ -193,7 +188,7 @@ void
e_sqlitedb_fixture_teardown (ESqliteDBFixture *fixture,
gconstpointer user_data)
{
- g_object_unref (fixture->ebsdb);
+ g_object_unref (fixture->ebsql);
e_test_server_utils_teardown ((ETestServerFixture *)fixture, user_data);
}
@@ -212,18 +207,20 @@ e_sqlitedb_cursor_fixture_setup_book (ESource *scratch,
0);
e_source_backend_summary_setup_set_indexed_fields (setup,
E_CONTACT_FAMILY_NAME, E_BOOK_INDEX_PREFIX,
+ E_CONTACT_FAMILY_NAME, E_BOOK_INDEX_SORT_KEY,
E_CONTACT_GIVEN_NAME, E_BOOK_INDEX_PREFIX,
+ E_CONTACT_GIVEN_NAME, E_BOOK_INDEX_SORT_KEY,
E_CONTACT_EMAIL, E_BOOK_INDEX_PREFIX,
0);
}
void
-e_sqlitedb_cursor_fixture_setup (EbSdbCursorFixture *fixture,
+e_sqlitedb_cursor_fixture_setup (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
ETestServerFixture *base_fixture = (ETestServerFixture *)fixture;
- ESqliteDBFixture *ebsdb_fixture = (ESqliteDBFixture *)fixture;
- EbSdbCursorClosure *data = (EbSdbCursorClosure *)user_data;
+ ESqliteDBFixture *ebsql_fixture = (ESqliteDBFixture *)fixture;
+ EbSqlCursorClosure *data = (EbSqlCursorClosure *)user_data;
EContactField sort_fields[] = { E_CONTACT_FAMILY_NAME, E_CONTACT_GIVEN_NAME };
EBookCursorSortType sort_types[] = { data->sort_type, data->sort_type };
EBookClient *book_client;
@@ -250,7 +247,7 @@ e_sqlitedb_cursor_fixture_setup (EbSdbCursorFixture *fixture,
e_sqlitedb_cursor_fixture_set_locale (fixture, "en_US.UTF-8");
/* Now open the EBookBackendSqliteDB */
- ebsdb_fixture->ebsdb = open_sqlitedb (((ETestServerFixture *)fixture)->registry,
+ ebsql_fixture->ebsql = open_sqlitedb (((ETestServerFixture *)fixture)->registry,
e_client_get_source (E_CLIENT (book_client)));
for (i = 0; i < N_SORTED_CONTACTS; i++) {
@@ -288,9 +285,8 @@ e_sqlitedb_cursor_fixture_setup (EbSdbCursorFixture *fixture,
fixture->query = NULL;
}
- fixture->cursor = e_book_backend_sqlitedb_cursor_new (((ESqliteDBFixture *) fixture)->ebsdb,
- SQLITEDB_FOLDER_ID,
- sexp, sort_fields, sort_types, 2, &error);
+ fixture->cursor = e_book_backend_sqlite_cursor_new (((ESqliteDBFixture *) fixture)->ebsql,
+ sexp, sort_fields, sort_types, 2, &error);
g_free (sexp);
@@ -298,7 +294,7 @@ e_sqlitedb_cursor_fixture_setup (EbSdbCursorFixture *fixture,
}
void
-e_sqlitedb_cursor_fixture_filtered_setup (EbSdbCursorFixture *fixture,
+e_sqlitedb_cursor_fixture_filtered_setup (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
fixture->query = e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_ENDS_WITH, ".com");
@@ -307,7 +303,7 @@ e_sqlitedb_cursor_fixture_filtered_setup (EbSdbCursorFixture *fixture,
}
void
-e_sqlitedb_cursor_fixture_teardown (EbSdbCursorFixture *fixture,
+e_sqlitedb_cursor_fixture_teardown (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
gint i;
@@ -323,12 +319,12 @@ e_sqlitedb_cursor_fixture_teardown (EbSdbCursorFixture *fixture,
if (fixture->own_id > 0)
g_bus_unown_name (fixture->own_id);
- e_book_backend_sqlitedb_cursor_free (((ESqliteDBFixture *) fixture)->ebsdb, fixture->cursor);
+ e_book_backend_sqlite_cursor_free (((ESqliteDBFixture *) fixture)->ebsql, fixture->cursor);
e_sqlitedb_fixture_teardown ((ESqliteDBFixture *)fixture, user_data);
}
typedef struct {
- EbSdbCursorFixture *fixture;
+ EbSqlCursorFixture *fixture;
const gchar *locale;
} ChangeLocaleData;
@@ -344,7 +340,7 @@ book_client_locale_change (EBookClient *book,
}
void
-e_sqlitedb_cursor_fixture_set_locale (EbSdbCursorFixture *fixture,
+e_sqlitedb_cursor_fixture_set_locale (EbSqlCursorFixture *fixture,
const gchar *locale)
{
ETestServerFixture *base_fixture = (ETestServerFixture *)fixture;
@@ -403,7 +399,7 @@ e_sqlitedb_cursor_fixture_set_locale (EbSdbCursorFixture *fixture,
}
static gint
-find_contact_data (EbSdbSearchData *data,
+find_contact_data (EbSqlSearchData *data,
const gchar *uid)
{
return g_strcmp0 (data->uid, uid);
@@ -471,7 +467,7 @@ print_results (GSList *results)
g_print ("\nPRINTING RESULTS:\n");
for (l = results; l; l = l->next) {
- EbSdbSearchData *data = l->data;
+ EbSqlSearchData *data = l->data;
g_print ("\n%s\n", data->vcard);
}
@@ -535,7 +531,7 @@ step_test_new_full (const gchar *test_path,
}
static void
-test_cursor_move_teardown (EbSdbCursorFixture *fixture,
+test_cursor_move_teardown (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
StepData *data = (StepData *)user_data;
@@ -546,7 +542,7 @@ test_cursor_move_teardown (EbSdbCursorFixture *fixture,
}
static void
-assert_step (EbSdbCursorFixture *fixture,
+assert_step (EbSqlCursorFixture *fixture,
StepData *data,
gint i,
GSList *results,
@@ -603,7 +599,7 @@ assert_step (EbSdbCursorFixture *fixture,
}
static void
-test_step (EbSdbCursorFixture *fixture,
+test_step (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
StepData *data = (StepData *)user_data;
@@ -613,22 +609,22 @@ test_step (EbSdbCursorFixture *fixture,
gint expected_position = 0, last_expected_position = 0, position;
gint total;
gint n_results;
- EbSdbCursorOrigin origin;
+ EbSqlCursorOrigin origin;
total = data->filtered ? N_FILTERED_CONTACTS : N_SORTED_CONTACTS;
for (i = 0; i < MAX_STEP_COUNTS && data->counts[i] != 0; i++) {
- /* For the first call to e_book_backend_sqlitedb_cursor_step(),
+ /* For the first call to e_book_backend_sqlite_cursor_step(),
* set the origin accordingly.
*/
if (i == 0) {
if (data->counts[i] < 0)
- origin = EBSDB_CURSOR_ORIGIN_END;
+ origin = EBSQL_CURSOR_ORIGIN_END;
else
- origin = EBSDB_CURSOR_ORIGIN_BEGIN;
+ origin = EBSQL_CURSOR_ORIGIN_BEGIN;
} else
- origin = EBSDB_CURSOR_ORIGIN_CURRENT;
+ origin = EBSQL_CURSOR_ORIGIN_CURRENT;
if (expected_position == 0 && data->counts[i] < 0)
expected_position = (total + 1) - ABS (data->counts[i]);
@@ -639,23 +635,23 @@ test_step (EbSdbCursorFixture *fixture,
expected_position = 0;
/* Try only fetching the contacts but not moving the cursor */
- n_results = e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_FETCH,
- origin,
- data->counts[i],
- &results, &error);
+ n_results = e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_FETCH,
+ origin,
+ data->counts[i],
+ &results, &error);
if (n_results < 0)
g_error ("Error fetching cursor results: %s", error->message);
print_results (results);
assert_step (fixture, data, i, results, n_results, TRUE);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
results = NULL;
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, NULL, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, NULL, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
/* We only fetched but didn't move.
@@ -666,23 +662,23 @@ test_step (EbSdbCursorFixture *fixture,
last_expected_position = expected_position;
/* Do it again, this time only moving the cursor */
- n_results = e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE,
- origin,
- data->counts[i],
- &results, &error);
+ n_results = e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_MOVE,
+ origin,
+ data->counts[i],
+ &results, &error);
if (n_results < 0)
g_error ("Error fetching cursor results: %s", error->message);
print_results (results);
assert_step (fixture, data, i, results, n_results, FALSE);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
results = NULL;
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, NULL, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, NULL, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
/* This time we moved the cursor but did not fetch, let's assert the new position
@@ -692,31 +688,31 @@ test_step (EbSdbCursorFixture *fixture,
if (data->counts[0] < 0) {
expected_position = (total + 1) - ABS (data->counts[0]);
- origin = EBSDB_CURSOR_ORIGIN_END;
+ origin = EBSQL_CURSOR_ORIGIN_END;
} else {
expected_position = data->counts[0];
- origin = EBSDB_CURSOR_ORIGIN_BEGIN;
+ origin = EBSQL_CURSOR_ORIGIN_BEGIN;
}
/* One more, test reset API, the first batch from the beginning, this time move & fetch results
together */
- n_results = e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE |
- EBSDB_CURSOR_STEP_FETCH,
- origin,
- data->counts[0],
- &results, &error);
+ n_results = e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_MOVE |
+ EBSQL_CURSOR_STEP_FETCH,
+ origin,
+ data->counts[0],
+ &results, &error);
if (n_results < 0)
g_error ("Error fetching cursor results: %s", error->message);
print_results (results);
assert_step (fixture, data, 0, results, n_results, TRUE);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
results = NULL;
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, NULL, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, NULL, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
g_assert_cmpint (expected_position, ==, position);
}
@@ -784,7 +780,7 @@ step_test_add (StepData *data,
{
data->filtered = filtered;
- g_test_add (data->path, EbSdbCursorFixture, data,
+ g_test_add (data->path, EbSqlCursorFixture, data,
filtered ?
e_sqlitedb_cursor_fixture_filtered_setup :
e_sqlitedb_cursor_fixture_setup,
diff --git a/tests/libedata-book/data-test-utils.h b/tests/libedata-book/data-test-utils.h
index 5015cdd..e9df458 100644
--- a/tests/libedata-book/data-test-utils.h
+++ b/tests/libedata-book/data-test-utils.h
@@ -66,40 +66,39 @@
* http://demo.icu-project.org/icu-bin/locexp?_=en_US&d_=en&x=col
*/
-#define SQLITEDB_FOLDER_ID "folder_id"
-#define N_SORTED_CONTACTS 20
-#define MAX_STEP_COUNTS 5
/* 13 contacts in the test data have an email address ending with ".com" */
#define N_FILTERED_CONTACTS 13
+#define N_SORTED_CONTACTS 20
+#define MAX_STEP_COUNTS 5
typedef struct {
ETestServerFixture parent_fixture;
- EBookBackendSqliteDB *ebsdb;
+ EBookBackendSqlite *ebsql;
} ESqliteDBFixture;
typedef struct {
ESqliteDBFixture parent_fixture;
- EbSdbCursor *cursor;
+ EbSqlCursor *cursor;
EContact *contacts[N_SORTED_CONTACTS];
EBookQuery *query;
EDBusLocale1 *locale1;
guint own_id;
-} EbSdbCursorFixture;
+} EbSqlCursorFixture;
typedef struct {
ETestServerClosure parent;
const gchar *locale;
EBookCursorSortType sort_type;
-} EbSdbCursorClosure;
+} EbSqlCursorClosure;
typedef struct {
- EbSdbCursorClosure parent;
+ EbSqlCursorClosure parent;
gchar *path;
/* array of counts to move by, terminated with 0 or MAX_COUNTS */
@@ -122,15 +121,15 @@ void e_sqlitedb_fixture_teardown (ESqliteDBFixture *fixture,
void e_sqlitedb_cursor_fixture_setup_book (ESource *scratch,
ETestServerClosure *closure);
-void e_sqlitedb_cursor_fixture_setup (EbSdbCursorFixture *fixture,
+void e_sqlitedb_cursor_fixture_setup (EbSqlCursorFixture *fixture,
gconstpointer user_data);
-void e_sqlitedb_cursor_fixture_teardown (EbSdbCursorFixture *fixture,
+void e_sqlitedb_cursor_fixture_teardown (EbSqlCursorFixture *fixture,
gconstpointer user_data);
-void e_sqlitedb_cursor_fixture_set_locale (EbSdbCursorFixture *fixture,
+void e_sqlitedb_cursor_fixture_set_locale (EbSqlCursorFixture *fixture,
const gchar *locale);
/* Filters contacts with E_CONTACT_EMAIL ending with '.com' */
-void e_sqlitedb_cursor_fixture_filtered_setup (EbSdbCursorFixture *fixture,
+void e_sqlitedb_cursor_fixture_filtered_setup (EbSqlCursorFixture *fixture,
gconstpointer user_data);
diff --git a/tests/libedata-book/test-sqlite-create-cursor.c b/tests/libedata-book/test-sqlite-create-cursor.c
index 399ad09..7d18b9d 100644
--- a/tests/libedata-book/test-sqlite-create-cursor.c
+++ b/tests/libedata-book/test-sqlite-create-cursor.c
@@ -12,23 +12,23 @@ static void
test_create_cursor_empty_query (ESqliteDBFixture *fixture,
gconstpointer user_data)
{
- EbSdbCursor *cursor;
+ EbSqlCursor *cursor;
EContactField sort_fields[] = { E_CONTACT_FAMILY_NAME, E_CONTACT_GIVEN_NAME };
EBookCursorSortType sort_types[] = { E_BOOK_CURSOR_SORT_ASCENDING, E_BOOK_CURSOR_SORT_ASCENDING };
GError *error = NULL;
- cursor = e_book_backend_sqlitedb_cursor_new (fixture->ebsdb, SQLITEDB_FOLDER_ID, NULL,
- sort_fields, sort_types, 2, &error);
+ cursor = e_book_backend_sqlite_cursor_new (fixture->ebsql, NULL,
+ sort_fields, sort_types, 2, &error);
g_assert (cursor != NULL);
- e_book_backend_sqlitedb_cursor_free (fixture->ebsdb, cursor);
+ e_book_backend_sqlite_cursor_free (fixture->ebsql, cursor);
}
static void
test_create_cursor_valid_query (ESqliteDBFixture *fixture,
gconstpointer user_data)
{
- EbSdbCursor *cursor;
+ EbSqlCursor *cursor;
EContactField sort_fields[] = { E_CONTACT_FAMILY_NAME, E_CONTACT_GIVEN_NAME };
EBookCursorSortType sort_types[] = { E_BOOK_CURSOR_SORT_ASCENDING, E_BOOK_CURSOR_SORT_ASCENDING };
EBookQuery *query;
@@ -38,11 +38,11 @@ test_create_cursor_valid_query (ESqliteDBFixture *fixture,
query = e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, "James Brown");
sexp = e_book_query_to_string (query);
- cursor = e_book_backend_sqlitedb_cursor_new (fixture->ebsdb, SQLITEDB_FOLDER_ID, sexp,
- sort_fields, sort_types, 2, &error);
+ cursor = e_book_backend_sqlite_cursor_new (fixture->ebsql, sexp,
+ sort_fields, sort_types, 2, &error);
g_assert (cursor != NULL);
- e_book_backend_sqlitedb_cursor_free (fixture->ebsdb, cursor);
+ e_book_backend_sqlite_cursor_free (fixture->ebsql, cursor);
g_free (sexp);
e_book_query_unref (query);
}
@@ -51,7 +51,7 @@ static void
test_create_cursor_invalid_query (ESqliteDBFixture *fixture,
gconstpointer user_data)
{
- EbSdbCursor *cursor;
+ EbSqlCursor *cursor;
EContactField sort_fields[] = { E_CONTACT_FAMILY_NAME, E_CONTACT_GIVEN_NAME };
EBookCursorSortType sort_types[] = { E_BOOK_CURSOR_SORT_ASCENDING, E_BOOK_CURSOR_SORT_ASCENDING };
EBookQuery *query;
@@ -61,12 +61,12 @@ test_create_cursor_invalid_query (ESqliteDBFixture *fixture,
query = e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_CONTAINS, "888");
sexp = e_book_query_to_string (query);
- cursor = e_book_backend_sqlitedb_cursor_new (fixture->ebsdb, SQLITEDB_FOLDER_ID, sexp,
- sort_fields, sort_types, 2, &error);
+ cursor = e_book_backend_sqlite_cursor_new (fixture->ebsql, sexp,
+ sort_fields, sort_types, 2, &error);
g_assert (cursor == NULL);
g_assert (error);
- g_assert (g_error_matches (error, E_BOOK_SDB_ERROR, E_BOOK_SDB_ERROR_INVALID_QUERY));
+ g_assert (g_error_matches (error, E_BOOK_SQL_ERROR, E_BOOK_SQL_ERROR_INVALID_QUERY));
g_free (sexp);
e_book_query_unref (query);
@@ -76,31 +76,31 @@ static void
test_create_cursor_invalid_sort (ESqliteDBFixture *fixture,
gconstpointer user_data)
{
- EbSdbCursor *cursor;
+ EbSqlCursor *cursor;
EContactField sort_fields[] = { E_CONTACT_TEL };
EBookCursorSortType sort_types[] = { E_BOOK_CURSOR_SORT_ASCENDING };
GError *error = NULL;
- cursor = e_book_backend_sqlitedb_cursor_new (fixture->ebsdb, SQLITEDB_FOLDER_ID, NULL,
- sort_fields, sort_types, 1, &error);
+ cursor = e_book_backend_sqlite_cursor_new (fixture->ebsql, NULL,
+ sort_fields, sort_types, 1, &error);
g_assert (cursor == NULL);
g_assert (error);
- g_assert (g_error_matches (error, E_BOOK_SDB_ERROR, E_BOOK_SDB_ERROR_INVALID_QUERY));
+ g_assert (g_error_matches (error, E_BOOK_SQL_ERROR, E_BOOK_SQL_ERROR_INVALID_QUERY));
}
static void
test_create_cursor_missing_sort (ESqliteDBFixture *fixture,
gconstpointer user_data)
{
- EbSdbCursor *cursor;
+ EbSqlCursor *cursor;
GError *error = NULL;
- cursor = e_book_backend_sqlitedb_cursor_new (fixture->ebsdb, SQLITEDB_FOLDER_ID, NULL, NULL, NULL, 0,
&error);
+ cursor = e_book_backend_sqlite_cursor_new (fixture->ebsql, NULL, NULL, NULL, 0, &error);
g_assert (cursor == NULL);
g_assert (error);
- g_assert (g_error_matches (error, E_BOOK_SDB_ERROR, E_BOOK_SDB_ERROR_INVALID_QUERY));
+ g_assert (g_error_matches (error, E_BOOK_SQL_ERROR, E_BOOK_SQL_ERROR_INVALID_QUERY));
}
gint
@@ -116,15 +116,15 @@ main (gint argc,
g_assert (g_setenv ("LC_ALL", "en_US.UTF-8", TRUE));
setlocale (LC_ALL, "");
- g_test_add ("/EbSdbCursor/Create/EmptyQuery", ESqliteDBFixture, &book_closure,
+ g_test_add ("/EbSqlCursor/Create/EmptyQuery", ESqliteDBFixture, &book_closure,
e_sqlitedb_fixture_setup, test_create_cursor_empty_query, e_sqlitedb_fixture_teardown);
- g_test_add ("/EbSdbCursor/Create/ValidQuery", ESqliteDBFixture, &book_closure,
+ g_test_add ("/EbSqlCursor/Create/ValidQuery", ESqliteDBFixture, &book_closure,
e_sqlitedb_fixture_setup, test_create_cursor_valid_query, e_sqlitedb_fixture_teardown);
- g_test_add ("/EbSdbCursor/Create/InvalidQuery", ESqliteDBFixture, &book_closure,
+ g_test_add ("/EbSqlCursor/Create/InvalidQuery", ESqliteDBFixture, &book_closure,
e_sqlitedb_fixture_setup, test_create_cursor_invalid_query, e_sqlitedb_fixture_teardown);
- g_test_add ("/EbSdbCursor/Create/InvalidSort", ESqliteDBFixture, &book_closure,
+ g_test_add ("/EbSqlCursor/Create/InvalidSort", ESqliteDBFixture, &book_closure,
e_sqlitedb_fixture_setup, test_create_cursor_invalid_sort, e_sqlitedb_fixture_teardown);
- g_test_add ("/EbSdbCursor/Create/MissingSort", ESqliteDBFixture, &book_closure,
+ g_test_add ("/EbSqlCursor/Create/MissingSort", ESqliteDBFixture, &book_closure,
e_sqlitedb_fixture_setup, test_create_cursor_missing_sort, e_sqlitedb_fixture_teardown);
return e_test_server_utils_run ();
diff --git a/tests/libedata-book/test-sqlite-cursor-calculate.c
b/tests/libedata-book/test-sqlite-cursor-calculate.c
index cb2cbe0..9b7aefd 100644
--- a/tests/libedata-book/test-sqlite-cursor-calculate.c
+++ b/tests/libedata-book/test-sqlite-cursor-calculate.c
@@ -6,27 +6,27 @@
#include "data-test-utils.h"
-static EbSdbCursorClosure ascending_closure = {
+static EbSqlCursorClosure ascending_closure = {
{ E_TEST_SERVER_ADDRESS_BOOK, e_sqlitedb_cursor_fixture_setup_book, 0 },
NULL,
E_BOOK_CURSOR_SORT_ASCENDING
};
-static EbSdbCursorClosure descending_closure = {
+static EbSqlCursorClosure descending_closure = {
{ E_TEST_SERVER_ADDRESS_BOOK, e_sqlitedb_cursor_fixture_setup_book, 0 },
NULL,
E_BOOK_CURSOR_SORT_DESCENDING
};
static void
-test_cursor_calculate_initial (EbSdbCursorFixture *fixture,
+test_cursor_calculate_initial (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GError *error = NULL;
gint position = 0, total = 0;
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
g_assert_cmpint (position, ==, 0);
@@ -34,7 +34,7 @@ test_cursor_calculate_initial (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_calculate_move_forward (EbSdbCursorFixture *fixture,
+test_cursor_calculate_move_forward (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GSList *results = NULL;
@@ -42,12 +42,12 @@ test_cursor_calculate_move_forward (EbSdbCursorFixture *fixture,
gint position = 0, total = 0;
/* Move cursor */
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_CURRENT,
- 5,
- &results, &error) < 0)
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_CURRENT,
+ 5,
+ &results, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
/* Assert the first 5 contacts in en_US order */
@@ -59,13 +59,13 @@ test_cursor_calculate_move_forward (EbSdbCursorFixture *fixture,
"sorted-5",
"sorted-6",
NULL);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
- g_error ("Error calculating cursor: %s", error->message);
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
+ g_error ("Error calculating cursor: %s", error->message);
/* results 0 + 5 = position 5, result index 4 (results[0, 1, 2, 3, 4]) */
g_assert_cmpint (position, ==, 5);
@@ -73,7 +73,7 @@ test_cursor_calculate_move_forward (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_calculate_move_backwards (EbSdbCursorFixture *fixture,
+test_cursor_calculate_move_backwards (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GSList *results = NULL;
@@ -81,12 +81,12 @@ test_cursor_calculate_move_backwards (EbSdbCursorFixture *fixture,
gint position = 0, total = 0;
/* Move cursor */
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_END,
- -5,
- &results, &error) < 0)
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_END,
+ -5,
+ &results, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
/* Assert the last 5 contacts in en_US order */
@@ -98,12 +98,12 @@ test_cursor_calculate_move_backwards (EbSdbCursorFixture *fixture,
"sorted-13",
"sorted-12",
NULL);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
/* results 20 - 5 = position 16 result index 15 (results[20, 19, 18, 17, 16]) */
@@ -112,7 +112,7 @@ test_cursor_calculate_move_backwards (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_calculate_back_and_forth (EbSdbCursorFixture *fixture,
+test_cursor_calculate_back_and_forth (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GSList *results = NULL;
@@ -120,69 +120,69 @@ test_cursor_calculate_back_and_forth (EbSdbCursorFixture *fixture,
gint position = 0, total = 0;
/* Move cursor */
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_BEGIN,
- 7,
- &results, &error) < 0)
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_BEGIN,
+ 7,
+ &results, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
g_assert_cmpint (g_slist_length (results), ==, 7);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
results = NULL;
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
- g_error ("Error calculating cursor: %s", error->message);
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
+ g_error ("Error calculating cursor: %s", error->message);
/* results 0 + 7 = position 7 result index 6 (results[0, 1, 2, 3, 4, 5, 6]) */
g_assert_cmpint (position, ==, 7);
g_assert_cmpint (total, ==, 20);
/* Move cursor */
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_CURRENT,
- -4,
- &results, &error) < 0)
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_CURRENT,
+ -4,
+ &results, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
g_assert_cmpint (g_slist_length (results), ==, 4);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
results = NULL;
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
- g_error ("Error calculating cursor: %s", error->message);
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
+ g_error ("Error calculating cursor: %s", error->message);
/* results 7 - 4 = position 3 result index 2 (results[5, 4, 3, 2]) */
g_assert_cmpint (position, ==, 3);
g_assert_cmpint (total, ==, 20);
/* Move cursor */
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_CURRENT,
- 5,
- &results, &error) < 0)
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_CURRENT,
+ 5,
+ &results, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
g_assert_cmpint (g_slist_length (results), ==, 5);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
results = NULL;
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
- g_error ("Error calculating cursor: %s", error->message);
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
+ g_error ("Error calculating cursor: %s", error->message);
/* results 3 + 5 = position 8 result index 7 (results[3, 4, 5, 6, 7]) */
g_assert_cmpint (position, ==, 8);
@@ -190,7 +190,7 @@ test_cursor_calculate_back_and_forth (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_calculate_partial_target (EbSdbCursorFixture *fixture,
+test_cursor_calculate_partial_target (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GError *error = NULL;
@@ -200,18 +200,18 @@ test_cursor_calculate_partial_target (EbSdbCursorFixture *fixture,
const gchar *const *labels;
/* First verify our test... in en_US locale the label 'C' should exist with the index 3 */
- collator = e_book_backend_sqlitedb_ref_collator (((ESqliteDBFixture *) fixture)->ebsdb);
+ collator = e_book_backend_sqlite_ref_collator (((ESqliteDBFixture *) fixture)->ebsql);
labels = e_collator_get_index_labels (collator, &n_labels, NULL, NULL, NULL);
g_assert_cmpstr (labels[3], ==, "C");
e_collator_unref (collator);
/* Set the cursor at the start of family names beginning with 'C' */
- e_book_backend_sqlitedb_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, 3);
+ e_book_backend_sqlite_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, 3);
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
/* Position is 13, there are 13 contacts before the letter 'C' in en_US locale */
@@ -220,7 +220,7 @@ test_cursor_calculate_partial_target (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_calculate_after_modification (EbSdbCursorFixture *fixture,
+test_cursor_calculate_after_modification (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
EBookClient *book_client;
@@ -230,16 +230,16 @@ test_cursor_calculate_after_modification (EbSdbCursorFixture *fixture,
book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
/* Set the cursor to point exactly 'blackbird' (which is the 12th contact) */
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE,
- EBSDB_CURSOR_ORIGIN_CURRENT,
- 12, NULL, &error) < 0)
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_MOVE,
+ EBSQL_CURSOR_ORIGIN_CURRENT,
+ 12, NULL, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
/* blackbird is at position 12 in en_US locale */
@@ -259,8 +259,8 @@ test_cursor_calculate_after_modification (EbSdbCursorFixture *fixture,
g_error ("modify contact sync: %s", error->message);
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
/* blackbird is now at position 14 after moving 2 later contacts to begin with 'A' */
@@ -269,14 +269,14 @@ test_cursor_calculate_after_modification (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_calculate_filtered_initial (EbSdbCursorFixture *fixture,
+test_cursor_calculate_filtered_initial (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GError *error = NULL;
gint position = 0, total = 0;
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
g_assert_cmpint (position, ==, 0);
@@ -284,7 +284,7 @@ test_cursor_calculate_filtered_initial (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_calculate_filtered_move_forward (EbSdbCursorFixture *fixture,
+test_cursor_calculate_filtered_move_forward (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GSList *results = NULL;
@@ -292,21 +292,21 @@ test_cursor_calculate_filtered_move_forward (EbSdbCursorFixture *fixture,
gint position = 0, total = 0;
/* Move cursor */
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_CURRENT,
- 5, &results, &error) < 0)
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_CURRENT,
+ 5, &results, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
g_assert_cmpint (g_slist_length (results), ==, 5);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
results = NULL;
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
/* results 0 + 5 = position 5, result index 4 (results[0, 1, 2, 3, 4]) */
@@ -315,7 +315,7 @@ test_cursor_calculate_filtered_move_forward (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_calculate_filtered_move_backwards (EbSdbCursorFixture *fixture,
+test_cursor_calculate_filtered_move_backwards (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GSList *results = NULL;
@@ -323,23 +323,23 @@ test_cursor_calculate_filtered_move_backwards (EbSdbCursorFixture *fixture,
gint position = 0, total = 0;
/* Move cursor */
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_END,
- -5,
- &results, &error) < 0)
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_END,
+ -5,
+ &results, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
g_assert_cmpint (g_slist_length (results), ==, 5);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
results = NULL;
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
- g_error ("Error calculating cursor: %s", error->message);
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
+ g_error ("Error calculating cursor: %s", error->message);
/* results 13 - 5 = position 9 (results[13, 12, 11, 10, 9]) */
g_assert_cmpint (position, ==, 9);
@@ -347,7 +347,7 @@ test_cursor_calculate_filtered_move_backwards (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_calculate_filtered_partial_target (EbSdbCursorFixture *fixture,
+test_cursor_calculate_filtered_partial_target (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GError *error = NULL;
@@ -357,18 +357,18 @@ test_cursor_calculate_filtered_partial_target (EbSdbCursorFixture *fixture,
const gchar *const *labels;
/* First verify our test... in en_US locale the label 'C' should exist with the index 3 */
- collator = e_book_backend_sqlitedb_ref_collator (((ESqliteDBFixture *) fixture)->ebsdb);
+ collator = e_book_backend_sqlite_ref_collator (((ESqliteDBFixture *) fixture)->ebsql);
labels = e_collator_get_index_labels (collator, &n_labels, NULL, NULL, NULL);
g_assert_cmpstr (labels[3], ==, "C");
e_collator_unref (collator);
/* Set the cursor at the start of family names beginning with 'C' */
- e_book_backend_sqlitedb_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, 3);
+ e_book_backend_sqlite_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, 3);
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
/* There are 9 contacts before the letter 'C' in the en_US locale */
@@ -377,7 +377,7 @@ test_cursor_calculate_filtered_partial_target (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_calculate_filtered_after_modification (EbSdbCursorFixture *fixture,
+test_cursor_calculate_filtered_after_modification (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
EBookClient *book_client;
@@ -387,11 +387,11 @@ test_cursor_calculate_filtered_after_modification (EbSdbCursorFixture *fixture,
book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
/* Set the cursor to point exactly 'blackbird' (which is the 8th contact when filtered) */
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE,
- EBSDB_CURSOR_ORIGIN_BEGIN,
- 8, NULL, &error) < 0)
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_MOVE,
+ EBSQL_CURSOR_ORIGIN_BEGIN,
+ 8, NULL, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
/* 'blackbirds' -> Jacob Appelbaum */
@@ -407,8 +407,8 @@ test_cursor_calculate_filtered_after_modification (EbSdbCursorFixture *fixture,
g_error ("modify contact sync: %s", error->message);
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
/* blackbird is now at position 11 after moving 2 later contacts to begin with 'A' */
@@ -417,7 +417,7 @@ test_cursor_calculate_filtered_after_modification (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_calculate_descending_move_forward (EbSdbCursorFixture *fixture,
+test_cursor_calculate_descending_move_forward (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GSList *results = NULL;
@@ -425,12 +425,12 @@ test_cursor_calculate_descending_move_forward (EbSdbCursorFixture *fixture,
gint position = 0, total = 0;
/* Move cursor */
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_BEGIN,
- 5,
- &results, &error) < 0)
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_BEGIN,
+ 5,
+ &results, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
/* Assert the first 5 contacts in en_US order */
@@ -442,13 +442,13 @@ test_cursor_calculate_descending_move_forward (EbSdbCursorFixture *fixture,
"sorted-13",
"sorted-12",
NULL);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
results = NULL;
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
/* results 0 + 5 = position 5, result index 4 (results[0, 1, 2, 3, 4]) */
@@ -457,7 +457,7 @@ test_cursor_calculate_descending_move_forward (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_calculate_descending_move_backwards (EbSdbCursorFixture *fixture,
+test_cursor_calculate_descending_move_backwards (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GSList *results = NULL;
@@ -465,11 +465,11 @@ test_cursor_calculate_descending_move_backwards (EbSdbCursorFixture *fixture,
gint position = 0, total = 0;
/* Move cursor */
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_END,
- -5, &results, &error) < 0)
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_END,
+ -5, &results, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
/* Assert the last 5 contacts in en_US order */
@@ -481,13 +481,13 @@ test_cursor_calculate_descending_move_backwards (EbSdbCursorFixture *fixture,
"sorted-5",
"sorted-6",
NULL);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
results = NULL;
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
/* results 20 - 5 = position 16 result index 15 (results[20, 19, 18, 17, 16]) */
@@ -496,7 +496,7 @@ test_cursor_calculate_descending_move_backwards (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_calculate_descending_partial_target (EbSdbCursorFixture *fixture,
+test_cursor_calculate_descending_partial_target (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GError *error = NULL;
@@ -506,18 +506,18 @@ test_cursor_calculate_descending_partial_target (EbSdbCursorFixture *fixture,
const gchar *const *labels;
/* First verify our test... in en_US locale the label 'C' should exist with the index 3 */
- collator = e_book_backend_sqlitedb_ref_collator (((ESqliteDBFixture *) fixture)->ebsdb);
+ collator = e_book_backend_sqlite_ref_collator (((ESqliteDBFixture *) fixture)->ebsql);
labels = e_collator_get_index_labels (collator, &n_labels, NULL, NULL, NULL);
g_assert_cmpstr (labels[3], ==, "C");
e_collator_unref (collator);
/* Set the cursor at the start of family names beginning with 'C' */
- e_book_backend_sqlitedb_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, 3);
+ e_book_backend_sqlite_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, 3);
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
/* Position is 7, there are 7 contacts leading up to the last 'C' in en_US locale
@@ -527,7 +527,7 @@ test_cursor_calculate_descending_partial_target (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_calculate_descending_after_modification (EbSdbCursorFixture *fixture,
+test_cursor_calculate_descending_after_modification (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
EBookClient *book_client;
@@ -537,16 +537,16 @@ test_cursor_calculate_descending_after_modification (EbSdbCursorFixture *fixture
book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
/* Set the cursor to point exactly 'Bät' (which is the 12th contact in descending order) */
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE,
- EBSDB_CURSOR_ORIGIN_BEGIN,
- 12, NULL, &error) < 0)
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor,
+ EBSQL_CURSOR_STEP_MOVE,
+ EBSQL_CURSOR_ORIGIN_BEGIN,
+ 12, NULL, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
/* 'Bät' is at position 12 in en_US locale (descending order) */
@@ -566,8 +566,8 @@ test_cursor_calculate_descending_after_modification (EbSdbCursorFixture *fixture
g_error ("modify contact sync: %s", error->message);
/* Check new position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
- fixture->cursor, &total, &position, &error))
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
+ fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
/* 'Bät' is now at position 10 in descending order after moving 2 contacts to begin with 'A' */
@@ -584,73 +584,73 @@ main (gint argc,
#endif
g_test_init (&argc, &argv, NULL);
- g_test_add ("/EbSdbCursor/Calculate/Initial", EbSdbCursorFixture, &ascending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/Initial", EbSqlCursorFixture, &ascending_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_calculate_initial,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/MoveForward", EbSdbCursorFixture, &ascending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/MoveForward", EbSqlCursorFixture, &ascending_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_calculate_move_forward,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/MoveBackwards", EbSdbCursorFixture, &ascending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/MoveBackwards", EbSqlCursorFixture, &ascending_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_calculate_move_backwards,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/BackAndForth", EbSdbCursorFixture, &ascending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/BackAndForth", EbSqlCursorFixture, &ascending_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_calculate_back_and_forth,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/AlphabeticTarget", EbSdbCursorFixture, &ascending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/AlphabeticTarget", EbSqlCursorFixture, &ascending_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_calculate_partial_target,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/AfterModification", EbSdbCursorFixture, &ascending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/AfterModification", EbSqlCursorFixture, &ascending_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_calculate_after_modification,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/Filtered/Initial", EbSdbCursorFixture, &ascending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/Filtered/Initial", EbSqlCursorFixture, &ascending_closure,
e_sqlitedb_cursor_fixture_filtered_setup,
test_cursor_calculate_filtered_initial,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/Filtered/MoveForward", EbSdbCursorFixture, &ascending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/Filtered/MoveForward", EbSqlCursorFixture, &ascending_closure,
e_sqlitedb_cursor_fixture_filtered_setup,
test_cursor_calculate_filtered_move_forward,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/Filtered/MoveBackwards", EbSdbCursorFixture, &ascending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/Filtered/MoveBackwards", EbSqlCursorFixture, &ascending_closure,
e_sqlitedb_cursor_fixture_filtered_setup,
test_cursor_calculate_filtered_move_backwards,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/Filtered/AlphabeticTarget", EbSdbCursorFixture,
&ascending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/Filtered/AlphabeticTarget", EbSqlCursorFixture,
&ascending_closure,
e_sqlitedb_cursor_fixture_filtered_setup,
test_cursor_calculate_filtered_partial_target,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/Filtered/AfterModification", EbSdbCursorFixture,
&ascending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/Filtered/AfterModification", EbSqlCursorFixture,
&ascending_closure,
e_sqlitedb_cursor_fixture_filtered_setup,
test_cursor_calculate_filtered_after_modification,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/Descending/Initial", EbSdbCursorFixture, &descending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/Descending/Initial", EbSqlCursorFixture, &descending_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_calculate_initial,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/Descending/MoveForward", EbSdbCursorFixture, &descending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/Descending/MoveForward", EbSqlCursorFixture, &descending_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_calculate_descending_move_forward,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/Descending/MoveBackwards", EbSdbCursorFixture,
&descending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/Descending/MoveBackwards", EbSqlCursorFixture,
&descending_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_calculate_descending_move_backwards,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/Descending/BackAndForth", EbSdbCursorFixture, &descending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/Descending/BackAndForth", EbSqlCursorFixture, &descending_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_calculate_back_and_forth,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/Descending/AlphabeticTarget", EbSdbCursorFixture,
&descending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/Descending/AlphabeticTarget", EbSqlCursorFixture,
&descending_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_calculate_descending_partial_target,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/Calculate/Descending/AfterModification", EbSdbCursorFixture,
&descending_closure,
+ g_test_add ("/EbSqlCursor/Calculate/Descending/AfterModification", EbSqlCursorFixture,
&descending_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_calculate_descending_after_modification,
e_sqlitedb_cursor_fixture_teardown);
diff --git a/tests/libedata-book/test-sqlite-cursor-set-sexp.c
b/tests/libedata-book/test-sqlite-cursor-set-sexp.c
index d0f3dbe..96660af 100644
--- a/tests/libedata-book/test-sqlite-cursor-set-sexp.c
+++ b/tests/libedata-book/test-sqlite-cursor-set-sexp.c
@@ -6,10 +6,10 @@
#include "data-test-utils.h"
-static EbSdbCursorClosure book_closure = { { E_TEST_SERVER_ADDRESS_BOOK,
e_sqlitedb_cursor_fixture_setup_book, 0 }, FALSE };
+static EbSqlCursorClosure book_closure = { { E_TEST_SERVER_ADDRESS_BOOK,
e_sqlitedb_cursor_fixture_setup_book, 0 }, FALSE };
static void
-test_cursor_sexp_invalid (EbSdbCursorFixture *fixture,
+test_cursor_sexp_invalid (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GError *error = NULL;
@@ -20,16 +20,16 @@ test_cursor_sexp_invalid (EbSdbCursorFixture *fixture,
sexp = e_book_query_to_string (query);
e_book_query_unref (query);
- if (e_book_backend_sqlitedb_cursor_set_sexp (((ESqliteDBFixture *) fixture)->ebsdb,
+ if (e_book_backend_sqlite_cursor_set_sexp (((ESqliteDBFixture *) fixture)->ebsql,
fixture->cursor, sexp, &error))
g_error ("Succeeded in setting non-summarized field in the cursor query expression");
g_assert (error);
- g_assert (g_error_matches (error, E_BOOK_SDB_ERROR, E_BOOK_SDB_ERROR_INVALID_QUERY));
+ g_assert (g_error_matches (error, E_BOOK_SQL_ERROR, E_BOOK_SQL_ERROR_INVALID_QUERY));
}
static void
-test_cursor_sexp_calculate_position (EbSdbCursorFixture *fixture,
+test_cursor_sexp_calculate_position (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GError *error = NULL;
@@ -37,13 +37,13 @@ test_cursor_sexp_calculate_position (EbSdbCursorFixture *fixture,
gint position = 0, total = 0;
gchar *sexp = NULL;
GSList *results = NULL, *node;
- EbSdbSearchData *data;
+ EbSqlSearchData *data;
/* Set the cursor to point exactly to 'blackbirds', which is the 12th contact in en_US */
- if (!e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
+ if (!e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_BEGIN,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_BEGIN,
12, &results, &error))
g_error ("Error fetching cursor results: %s", error->message);
@@ -52,11 +52,11 @@ test_cursor_sexp_calculate_position (EbSdbCursorFixture *fixture,
g_assert (node);
data = node->data;
g_assert_cmpstr (data->uid, ==, "sorted-16");
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
/* Check position */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
@@ -69,12 +69,12 @@ test_cursor_sexp_calculate_position (EbSdbCursorFixture *fixture,
sexp = e_book_query_to_string (query);
e_book_query_unref (query);
- if (!e_book_backend_sqlitedb_cursor_set_sexp (((ESqliteDBFixture *) fixture)->ebsdb,
+ if (!e_book_backend_sqlite_cursor_set_sexp (((ESqliteDBFixture *) fixture)->ebsql,
fixture->cursor, sexp, &error))
g_error ("Failed to set sexp: %s", error->message);
/* Check new position after modified sexp */
- if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
+ if (!e_book_backend_sqlite_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsql,
fixture->cursor, &total, &position, &error))
g_error ("Error calculating cursor: %s", error->message);
@@ -84,29 +84,29 @@ test_cursor_sexp_calculate_position (EbSdbCursorFixture *fixture,
}
static void
-test_cursor_sexp_and_step (EbSdbCursorFixture *fixture,
+test_cursor_sexp_and_step (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GError *error = NULL;
EBookQuery *query;
gchar *sexp = NULL;
GSList *results = NULL, *node;
- EbSdbSearchData *data;
+ EbSqlSearchData *data;
/* Set new sexp, only contacts with .com email addresses */
query = e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_ENDS_WITH, ".com");
sexp = e_book_query_to_string (query);
e_book_query_unref (query);
- if (!e_book_backend_sqlitedb_cursor_set_sexp (((ESqliteDBFixture *) fixture)->ebsdb,
+ if (!e_book_backend_sqlite_cursor_set_sexp (((ESqliteDBFixture *) fixture)->ebsql,
fixture->cursor, sexp, &error))
g_error ("Failed to set sexp: %s", error->message);
/* Step 6 results from the beginning of the filtered list, gets up to contact 'sorted-8' */
- if (!e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
+ if (!e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_BEGIN,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_BEGIN,
6, &results, &error))
g_error ("Error fetching cursor results: %s", error->message);
@@ -115,15 +115,15 @@ test_cursor_sexp_and_step (EbSdbCursorFixture *fixture,
g_assert (node);
data = node->data;
g_assert_cmpstr (data->uid, ==, "sorted-8");
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
results = NULL;
/* Step 6 results more, gets up to contact 'sorted-12' */
- if (!e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
+ if (!e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_CURRENT,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_CURRENT,
6, &results, &error))
g_error ("Error fetching cursor results: %s", error->message);
@@ -132,7 +132,7 @@ test_cursor_sexp_and_step (EbSdbCursorFixture *fixture,
g_assert (node);
data = node->data;
g_assert_cmpstr (data->uid, ==, "sorted-12");
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
}
@@ -145,15 +145,15 @@ main (gint argc,
#endif
g_test_init (&argc, &argv, NULL);
- g_test_add ("/EbSdbCursor/SetSexp/Invalid", EbSdbCursorFixture, &book_closure,
+ g_test_add ("/EbSqlCursor/SetSexp/Invalid", EbSqlCursorFixture, &book_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_sexp_invalid,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/SetSexp/CalculatePosition", EbSdbCursorFixture, &book_closure,
+ g_test_add ("/EbSqlCursor/SetSexp/CalculatePosition", EbSqlCursorFixture, &book_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_sexp_calculate_position,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/SetSexp/Step", EbSdbCursorFixture, &book_closure,
+ g_test_add ("/EbSqlCursor/SetSexp/Step", EbSqlCursorFixture, &book_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_sexp_and_step,
e_sqlitedb_cursor_fixture_teardown);
diff --git a/tests/libedata-book/test-sqlite-cursor-set-target.c
b/tests/libedata-book/test-sqlite-cursor-set-target.c
index c26ed75..b61ad94 100644
--- a/tests/libedata-book/test-sqlite-cursor-set-target.c
+++ b/tests/libedata-book/test-sqlite-cursor-set-target.c
@@ -6,23 +6,23 @@
#include "data-test-utils.h"
-static EbSdbCursorClosure book_closure = { { E_TEST_SERVER_ADDRESS_BOOK,
e_sqlitedb_cursor_fixture_setup_book, 0 }, FALSE };
+static EbSqlCursorClosure book_closure = { { E_TEST_SERVER_ADDRESS_BOOK,
e_sqlitedb_cursor_fixture_setup_book, 0 }, FALSE };
/*****************************************************
* Expect the same results twice *
*****************************************************/
static void
-test_cursor_set_target_reset_cursor (EbSdbCursorFixture *fixture,
+test_cursor_set_target_reset_cursor (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GSList *results = NULL;
GError *error = NULL;
/* First batch */
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_BEGIN,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_BEGIN,
5, &results, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
@@ -38,15 +38,15 @@ test_cursor_set_target_reset_cursor (EbSdbCursorFixture *fixture,
"sorted-6",
NULL);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
results = NULL;
/* Second batch reset (same results) */
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_BEGIN,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_BEGIN,
5, &results, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
@@ -62,7 +62,7 @@ test_cursor_set_target_reset_cursor (EbSdbCursorFixture *fixture,
"sorted-6",
NULL);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
}
@@ -70,7 +70,7 @@ test_cursor_set_target_reset_cursor (EbSdbCursorFixture *fixture,
* Expect results with family name starting with 'C' *
*****************************************************/
static void
-test_cursor_set_target_c_next_results (EbSdbCursorFixture *fixture,
+test_cursor_set_target_c_next_results (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GSList *results = NULL;
@@ -80,19 +80,19 @@ test_cursor_set_target_c_next_results (EbSdbCursorFixture *fixture,
const gchar *const *labels;
/* First verify our test... in en_US locale the label 'C' should exist with the index 3 */
- collator = e_book_backend_sqlitedb_ref_collator (((ESqliteDBFixture *) fixture)->ebsdb);
+ collator = e_book_backend_sqlite_ref_collator (((ESqliteDBFixture *) fixture)->ebsql);
labels = e_collator_get_index_labels (collator, &n_labels, NULL, NULL, NULL);
g_assert_cmpstr (labels[3], ==, "C");
e_collator_unref (collator);
/* Set the cursor at the start of family names beginning with 'C' */
- e_book_backend_sqlitedb_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsdb,
+ e_book_backend_sqlite_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsql,
fixture->cursor, 3);
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_CURRENT,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_CURRENT,
5, &results, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
@@ -108,7 +108,7 @@ test_cursor_set_target_c_next_results (EbSdbCursorFixture *fixture,
"sorted-9",
NULL);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
}
@@ -116,7 +116,7 @@ test_cursor_set_target_c_next_results (EbSdbCursorFixture *fixture,
* Expect results before the letter 'C' *
*****************************************************/
static void
-test_cursor_set_target_c_prev_results (EbSdbCursorFixture *fixture,
+test_cursor_set_target_c_prev_results (EbSqlCursorFixture *fixture,
gconstpointer user_data)
{
GSList *results = NULL;
@@ -126,19 +126,19 @@ test_cursor_set_target_c_prev_results (EbSdbCursorFixture *fixture,
const gchar *const *labels;
/* First verify our test... in en_US locale the label 'C' should exist with the index 3 */
- collator = e_book_backend_sqlitedb_ref_collator (((ESqliteDBFixture *) fixture)->ebsdb);
+ collator = e_book_backend_sqlite_ref_collator (((ESqliteDBFixture *) fixture)->ebsql);
labels = e_collator_get_index_labels (collator, &n_labels, NULL, NULL, NULL);
g_assert_cmpstr (labels[3], ==, "C");
e_collator_unref (collator);
/* Set the cursor at the start of family names beginning with 'C' */
- e_book_backend_sqlitedb_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsdb,
+ e_book_backend_sqlite_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsql,
fixture->cursor, 3);
- if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
+ if (e_book_backend_sqlite_cursor_step (((ESqliteDBFixture *) fixture)->ebsql,
fixture->cursor,
- EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
- EBSDB_CURSOR_ORIGIN_CURRENT,
+ EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+ EBSQL_CURSOR_ORIGIN_CURRENT,
-5, &results, &error) < 0)
g_error ("Error fetching cursor results: %s", error->message);
@@ -154,7 +154,7 @@ test_cursor_set_target_c_prev_results (EbSdbCursorFixture *fixture,
"sorted-8",
NULL);
- g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (results, (GFunc)e_book_backend_sqlite_search_data_free, NULL);
g_slist_free (results);
}
@@ -167,15 +167,15 @@ main (gint argc,
#endif
g_test_init (&argc, &argv, NULL);
- g_test_add ("/EbSdbCursor/SetTarget/ResetCursor", EbSdbCursorFixture, &book_closure,
+ g_test_add ("/EbSqlCursor/SetTarget/ResetCursor", EbSqlCursorFixture, &book_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_set_target_reset_cursor,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/SetTarget/Alphabetic/C/NextResults", EbSdbCursorFixture, &book_closure,
+ g_test_add ("/EbSqlCursor/SetTarget/Alphabetic/C/NextResults", EbSqlCursorFixture, &book_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_set_target_c_next_results,
e_sqlitedb_cursor_fixture_teardown);
- g_test_add ("/EbSdbCursor/SetTarget/Alphabetic/C/PreviousResults", EbSdbCursorFixture, &book_closure,
+ g_test_add ("/EbSqlCursor/SetTarget/Alphabetic/C/PreviousResults", EbSqlCursorFixture, &book_closure,
e_sqlitedb_cursor_fixture_setup,
test_cursor_set_target_c_prev_results,
e_sqlitedb_cursor_fixture_teardown);
diff --git a/tests/libedata-book/test-sqlite-get-contact.c b/tests/libedata-book/test-sqlite-get-contact.c
index 6736567..50b154d 100644
--- a/tests/libedata-book/test-sqlite-get-contact.c
+++ b/tests/libedata-book/test-sqlite-get-contact.c
@@ -14,7 +14,7 @@ test_get_contact (ESqliteDBFixture *fixture,
{
EBookClient *book_client;
EContact *contact = NULL;
- EContact *other;
+ EContact *other = NULL;
GError *error = NULL;
book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
@@ -23,11 +23,11 @@ test_get_contact (ESqliteDBFixture *fixture,
g_error ("Failed to get contact");
}
- other = e_book_backend_sqlitedb_get_contact (fixture->ebsdb, SQLITEDB_FOLDER_ID,
- (const gchar *)e_contact_get_const (contact,
E_CONTACT_UID),
- NULL, NULL, &error);
-
- if (!other)
+ if (!e_book_backend_sqlite_get_contact (fixture->ebsql,
+ (const gchar *)e_contact_get_const (contact, E_CONTACT_UID),
+ FALSE,
+ &other,
+ &error))
g_error ("Failed to get contact with uid '%s': %s",
(const gchar *)e_contact_get_const (contact, E_CONTACT_UID),
error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]