[evolution-data-server/openismus-work-master: 130/150] Low level cursor tests: updated to use new cursor step() API



commit 0e3d4582a136fe482fa699e74afdea4e57987db2
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Fri Oct 18 22:42:34 2013 +0200

    Low level cursor tests: updated to use new cursor step() API

 tests/libedata-book/data-test-utils.c              |  173 ++++++++++++--------
 tests/libedata-book/data-test-utils.h              |   22 ++--
 tests/libedata-book/test-sqlite-cursor-calculate.c |  124 ++++++++-------
 .../test-sqlite-cursor-change-locale.c             |   56 +++---
 .../test-sqlite-cursor-de-DE-migrated.c            |   14 +-
 .../test-sqlite-cursor-en-US-migrated.c            |   14 +-
 .../test-sqlite-cursor-fr-CA-migrated.c            |   14 +-
 .../test-sqlite-cursor-move-by-de-DE.c             |   50 +++---
 .../test-sqlite-cursor-move-by-en-US.c             |   65 ++++----
 .../test-sqlite-cursor-move-by-fr-CA.c             |   50 +++---
 .../test-sqlite-cursor-move-by-posix.c             |   50 +++---
 .../test-sqlite-cursor-posix-initial.c             |   14 +-
 .../test-sqlite-cursor-posix-migrated.c            |   14 +-
 tests/libedata-book/test-sqlite-cursor-set-sexp.c  |    9 +-
 .../libedata-book/test-sqlite-cursor-set-target.c  |   36 +++--
 15 files changed, 375 insertions(+), 330 deletions(-)
---
diff --git a/tests/libedata-book/data-test-utils.c b/tests/libedata-book/data-test-utils.c
index 827f17c..f917f0b 100644
--- a/tests/libedata-book/data-test-utils.c
+++ b/tests/libedata-book/data-test-utils.c
@@ -484,12 +484,12 @@ print_results (GSList      *results)
  ********************************************/
 #define DEBUG_FIXTURE        0
 
-static MoveByData *
-move_by_test_new_internal (const gchar *test_path,
-                          const gchar *locale,
-                          gsize        struct_size)
+static StepData *
+step_test_new_internal (const gchar *test_path,
+                       const gchar *locale,
+                       gsize        struct_size)
 {
-       MoveByData *data;
+       StepData *data;
 
        data = g_slice_alloc0 (struct_size);
        data->parent.parent.type = E_TEST_SERVER_ADDRESS_BOOK;
@@ -507,28 +507,28 @@ move_by_test_new_internal (const gchar *test_path,
 }
 
 static void
-move_by_test_free (MoveByData *data)
+step_test_free (StepData *data)
 {
        g_free (data->path);
        g_free ((gchar *)data->parent.locale);
        g_slice_free1 (data->struct_size, data);
 }
 
-MoveByData *
-move_by_test_new (const gchar *test_path,
-                 const gchar *locale)
+StepData *
+step_test_new (const gchar *test_path,
+              const gchar *locale)
 {
-       return move_by_test_new_internal (test_path, locale, sizeof (MoveByData));
+       return step_test_new_internal (test_path, locale, sizeof (StepData));
 }
 
-MoveByData *
-move_by_test_new_full (const gchar         *test_path,
-                      const gchar         *locale,
-                      EBookCursorSortType  sort_type)
+StepData *
+step_test_new_full (const gchar         *test_path,
+                   const gchar         *locale,
+                   EBookCursorSortType  sort_type)
 {
-       MoveByData *data;
+       StepData *data;
 
-       data = move_by_test_new_internal (test_path, locale, sizeof (MoveByData));
+       data = step_test_new_internal (test_path, locale, sizeof (StepData));
        data->parent.sort_type = sort_type;
 
        return data;
@@ -538,25 +538,24 @@ static void
 test_cursor_move_teardown (EbSdbCursorFixture *fixture,
                           gconstpointer  user_data)
 {
-       MoveByData *data = (MoveByData *)user_data;
+       StepData *data = (StepData *)user_data;
 
        e_sqlitedb_cursor_fixture_teardown (fixture, user_data);
 
-       move_by_test_free (data);
+       step_test_free (data);
 }
 
 static void
-assert_move_by (EbSdbCursorFixture *fixture,
-               MoveByData *data,
-               gint i,
-               GSList *results,
-               gint n_results)
+assert_step (EbSdbCursorFixture *fixture,
+            StepData *data,
+            gint i,
+            GSList *results,
+            gint n_results,
+            gboolean expect_results)
 {
        GSList *uids = NULL;
        gint j, expected = 0;
 
-       g_assert_cmpint (g_slist_length (results), ==, n_results);
-
        /* Count the number of really expected results */
        for (j = 0; j < ABS (data->counts[i]); j++) {
                gint index = data->expected[i][j];
@@ -567,6 +566,12 @@ assert_move_by (EbSdbCursorFixture *fixture,
                expected++;
        }
 
+       g_assert_cmpint (n_results, ==, expected);
+       if (!expect_results) {
+               g_assert_cmpint (g_slist_length (results), ==, 0);
+               return;
+       }
+
        /* Assert the exact amount of requested results */
        g_assert_cmpint (g_slist_length (results), ==, expected);
 
@@ -598,22 +603,33 @@ assert_move_by (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_move_by (EbSdbCursorFixture *fixture,
-             gconstpointer  user_data)
+test_step (EbSdbCursorFixture *fixture,
+          gconstpointer  user_data)
 {
-       MoveByData *data = (MoveByData *)user_data;
+       StepData *data = (StepData *)user_data;
        GSList *results = NULL;
        GError *error = NULL;
        gint i;
-       gint expected_position = 0, position;
+       gint expected_position = 0, last_expected_position = 0, position;
        gint total;
        gint n_results;
+       EbSdbCursorOrigin origin;
 
        total = data->filtered ? N_FILTERED_CONTACTS : N_SORTED_CONTACTS;
 
-       for (i = 0; i < MAX_MOVE_BY_COUNTS && data->counts[i] != 0; i++) {
+       for (i = 0; i < MAX_STEP_COUNTS && data->counts[i] != 0; i++) {
+
+               /* For the first call to e_book_backend_sqlitedb_cursor_step(),
+                * set the origin accordingly.
+                */
+               if (i == 0) {
+                       if (data->counts[i] < 0)
+                               origin = EBSDB_CURSOR_ORIGIN_END;
+                       else
+                               origin = EBSDB_CURSOR_ORIGIN_BEGIN;
+               } else
+                       origin = EBSDB_CURSOR_ORIGIN_CURRENT;
 
-               /* From the 0 position, a negative move starts from the end */
                if (expected_position == 0 && data->counts[i] < 0)
                        expected_position = (total + 1) - ABS (data->counts[i]);
                else
@@ -622,17 +638,18 @@ test_move_by (EbSdbCursorFixture *fixture,
                if (expected_position > total || expected_position < 1)
                        expected_position = 0;
 
-               /* Try normal order */
-               n_results = e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                                   fixture->cursor,
-                                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                                   data->counts[i],
-                                                                   &results, &error);
+               /* 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);
                if (n_results < 0)
                        g_error ("Error fetching cursor results: %s", error->message);
 
                print_results (results);
-               assert_move_by (fixture, data, i, results, n_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_free (results);
                results = NULL;
@@ -640,19 +657,26 @@ test_move_by (EbSdbCursorFixture *fixture,
                if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
                                                               fixture->cursor, NULL, &position, &error))
                        g_error ("Error calculating cursor: %s", error->message);
-               g_assert_cmpint (expected_position, ==, position);
 
-               /* Try repeat last query */
-               n_results = e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                                   fixture->cursor,
-                                                                   EBSDB_CURSOR_ORIGIN_PREVIOUS,
-                                                                   data->counts[i],
-                                                                   &results, &error);
+               /* We only fetched but didn't move.
+                *
+                * Check that we are still at the previously expected position.
+                */
+               g_assert_cmpint (last_expected_position, ==, position);
+               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);
                if (n_results < 0)
                        g_error ("Error fetching cursor results: %s", error->message);
 
                print_results (results);
-               assert_move_by (fixture, data, i, results, n_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_free (results);
                results = NULL;
@@ -660,30 +684,37 @@ test_move_by (EbSdbCursorFixture *fixture,
                if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
                                                               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
+                */
                g_assert_cmpint (expected_position, ==, position);
        }
 
-       /* One more, test reset API, the first batch from the beginning */
-       n_results = e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                           fixture->cursor,
-                                                           EBSDB_CURSOR_ORIGIN_RESET,
-                                                           data->counts[0],
-                                                           &results, &error);
+       if (data->counts[0] < 0) {
+               expected_position = (total + 1) - ABS (data->counts[0]);
+               origin = EBSDB_CURSOR_ORIGIN_END;
+       } else {
+               expected_position = data->counts[0];
+               origin = EBSDB_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);
        if (n_results < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        print_results (results);
-       assert_move_by (fixture, data, 0, results, n_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_free (results);
        results = NULL;
 
-       /* From the 0 position, a negative move starts from the end */
-       if (data->counts[0] < 0)
-               expected_position = (total + 1) - ABS (data->counts[0]);
-       else
-               expected_position = data->counts[0];
-
        if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
                                                       fixture->cursor, NULL, &position, &error))
                g_error ("Error calculating cursor: %s", error->message);
@@ -691,14 +722,14 @@ test_move_by (EbSdbCursorFixture *fixture,
 }
 
 static void
-move_by_test_add_assertion_va_list (MoveByData *data,
-                                   gint        count,
-                                   va_list     args)
+step_test_add_assertion_va_list (StepData *data,
+                                gint      count,
+                                va_list   args)
 {
        gint i, j;
        gint expected;
 
-       for (i = 0; i < MAX_MOVE_BY_COUNTS; i++) {
+       for (i = 0; i < MAX_STEP_COUNTS; i++) {
 
                /* Find the next available test slot */
                if (data->counts[i] == 0) {
@@ -724,7 +755,7 @@ move_by_test_add_assertion_va_list (MoveByData *data,
                }
        }
 
-       g_assert (i < MAX_MOVE_BY_COUNTS);
+       g_assert (i < MAX_STEP_COUNTS);
 }
 
 /* A positive of negative 'count' value
@@ -735,21 +766,21 @@ move_by_test_add_assertion_va_list (MoveByData *data,
  * in data-test-utils.h
  */
 void
-move_by_test_add_assertion (MoveByData *data,
-                           gint        count,
-                           ...)
+step_test_add_assertion (StepData *data,
+                        gint      count,
+                        ...)
 {
 
        va_list args;
 
        va_start (args, count);
-       move_by_test_add_assertion_va_list (data, count, args);
+       step_test_add_assertion_va_list (data, count, args);
        va_end (args);
 }
 
 void
-move_by_test_add (MoveByData  *data,
-                 gboolean     filtered)
+step_test_add (StepData  *data,
+              gboolean   filtered)
 {
        data->filtered = filtered;
 
@@ -757,7 +788,7 @@ move_by_test_add (MoveByData  *data,
                    filtered ?
                    e_sqlitedb_cursor_fixture_filtered_setup :
                    e_sqlitedb_cursor_fixture_setup,
-                   test_move_by,
+                   test_step,
                    test_cursor_move_teardown);
 }
 
diff --git a/tests/libedata-book/data-test-utils.h b/tests/libedata-book/data-test-utils.h
index 10108a6..5015cdd 100644
--- a/tests/libedata-book/data-test-utils.h
+++ b/tests/libedata-book/data-test-utils.h
@@ -68,7 +68,7 @@
 
 #define SQLITEDB_FOLDER_ID   "folder_id"
 #define N_SORTED_CONTACTS    20
-#define MAX_MOVE_BY_COUNTS   5
+#define MAX_STEP_COUNTS   5
 
 /* 13 contacts in the test data have an email address ending with ".com" */
 #define N_FILTERED_CONTACTS  13
@@ -103,17 +103,17 @@ typedef struct {
        gchar *path;
 
        /* array of counts to move by, terminated with 0 or MAX_COUNTS */
-       gint counts[MAX_MOVE_BY_COUNTS];
+       gint counts[MAX_STEP_COUNTS];
 
-       /* For each move_by() command, an array of 'ABS (counts[i])' expected contacts */
-       gint expected[MAX_MOVE_BY_COUNTS][N_SORTED_CONTACTS];
+       /* For each step() command, an array of 'ABS (counts[i])' expected contacts */
+       gint expected[MAX_STEP_COUNTS][N_SORTED_CONTACTS];
 
        /* Whether this is a filtered test */
        gboolean filtered;
 
        /* Private detail */
        gsize struct_size;
-} MoveByData;
+} StepData;
 
 void     e_sqlitedb_fixture_setup          (ESqliteDBFixture *fixture,
                                            gconstpointer     user_data);
@@ -149,16 +149,16 @@ void     assert_contacts_order             (GSList      *results,
 
 void     print_results                     (GSList      *results);
 
-/*  MoveBy test helpers */
-void        move_by_test_add_assertion     (MoveByData  *data,
+/*  Step test helpers */
+void      step_test_add_assertion          (StepData    *data,
                                            gint         count,
                                            ...);
-MoveByData *move_by_test_new               (const gchar *test_path,
+StepData *step_test_new                    (const gchar *test_path,
                                            const gchar *locale);
-MoveByData *move_by_test_new_full          (const gchar   *test_path,
-                                           const gchar   *locale,
+StepData *step_test_new_full               (const gchar *test_path,
+                                           const gchar *locale,
                                            EBookCursorSortType sort_type);
-void        move_by_test_add               (MoveByData  *data,
+void      step_test_add                    (StepData    *data,
                                            gboolean     filtered);
 
 #endif /* DATA_TEST_UTILS_H */
diff --git a/tests/libedata-book/test-sqlite-cursor-calculate.c 
b/tests/libedata-book/test-sqlite-cursor-calculate.c
index 2ecdb4b..cb2cbe0 100644
--- a/tests/libedata-book/test-sqlite-cursor-calculate.c
+++ b/tests/libedata-book/test-sqlite-cursor-calculate.c
@@ -42,11 +42,12 @@ test_cursor_calculate_move_forward (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor,
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   5,
-                                                   &results, &error) < 0)
+       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)
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Assert the first 5 contacts in en_US order */
@@ -80,11 +81,12 @@ test_cursor_calculate_move_backwards (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor,
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   -5,
-                                                   &results, &error) < 0)
+       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)
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Assert the last 5 contacts in en_US order */
@@ -118,13 +120,14 @@ test_cursor_calculate_back_and_forth (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor, 
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   7,
-                                                   &results, &error) < 0)
+       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)
                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_free (results);
@@ -140,11 +143,12 @@ test_cursor_calculate_back_and_forth (EbSdbCursorFixture *fixture,
        g_assert_cmpint (total, ==, 20);
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor,
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   -4,
-                                                   &results, &error) < 0)
+       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)
                g_error ("Error fetching cursor results: %s", error->message);
 
        g_assert_cmpint (g_slist_length (results), ==, 4);
@@ -162,11 +166,12 @@ test_cursor_calculate_back_and_forth (EbSdbCursorFixture *fixture,
        g_assert_cmpint (total, ==, 20);
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor,
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   5,
-                                                   &results, &error) < 0)
+       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)
                g_error ("Error fetching cursor results: %s", error->message);
 
        g_assert_cmpint (g_slist_length (results), ==, 5);
@@ -225,10 +230,11 @@ 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_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor,
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   12, NULL, &error) < 0)
+       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
+                                                fixture->cursor,
+                                                EBSDB_CURSOR_STEP_MOVE,
+                                                EBSDB_CURSOR_ORIGIN_CURRENT,
+                                                12, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Check new position */
@@ -286,10 +292,11 @@ test_cursor_calculate_filtered_move_forward (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor,
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   5, &results, &error) < 0)
+       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)
                g_error ("Error fetching cursor results: %s", error->message);
 
        g_assert_cmpint (g_slist_length (results), ==, 5);
@@ -316,11 +323,12 @@ test_cursor_calculate_filtered_move_backwards (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor,
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   -5,
-                                                   &results, &error) < 0)
+       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)
                g_error ("Error fetching cursor results: %s", error->message);
 
        g_assert_cmpint (g_slist_length (results), ==, 5);
@@ -379,10 +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_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor,
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   8, NULL, &error) < 0)
+       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
+                                                fixture->cursor,
+                                                EBSDB_CURSOR_STEP_MOVE,
+                                                EBSDB_CURSOR_ORIGIN_BEGIN,
+                                                8, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* 'blackbirds' -> Jacob Appelbaum */
@@ -416,11 +425,12 @@ test_cursor_calculate_descending_move_forward (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor,
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   5,
-                                                   &results, &error) < 0)
+       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)
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Assert the first 5 contacts in en_US order */
@@ -455,10 +465,11 @@ test_cursor_calculate_descending_move_backwards (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor,
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   -5, &results, &error) < 0)
+       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)
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Assert the last 5 contacts in en_US order */
@@ -526,10 +537,11 @@ 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_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor,
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   12, NULL, &error) < 0)
+       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
+                                                fixture->cursor,
+                                                EBSDB_CURSOR_STEP_MOVE,
+                                                EBSDB_CURSOR_ORIGIN_BEGIN,
+                                                12, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Check new position */
diff --git a/tests/libedata-book/test-sqlite-cursor-change-locale.c 
b/tests/libedata-book/test-sqlite-cursor-change-locale.c
index fd322ab..ba23074 100644
--- a/tests/libedata-book/test-sqlite-cursor-change-locale.c
+++ b/tests/libedata-book/test-sqlite-cursor-change-locale.c
@@ -10,7 +10,7 @@ gint
 main (gint argc,
       gchar **argv)
 {
-       MoveByData *data;
+       StepData *data;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
@@ -19,33 +19,33 @@ main (gint argc,
 
        g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
 
-       data = move_by_test_new ("/EbSdbCursor/ChangeLocale/POSIX", "POSIX");
-       move_by_test_add_assertion (data, 5, 11, 2,  6,  3,  8);
-       move_by_test_add_assertion (data, 5, 1,  5,  4,  7,  15);
-       move_by_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
-       move_by_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
-       move_by_test_add (data, FALSE);
-
-       data = move_by_test_new ("/EbSdbCursor/ChangeLocale/en_US", "en_US.UTF-8");
-       move_by_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
-       move_by_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
-       move_by_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
-       move_by_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
-       move_by_test_add (data, FALSE);
-
-       data = move_by_test_new ("/EbSdbCursor/ChangeLocale/fr_CA", "fr_CA.UTF-8");
-       move_by_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
-       move_by_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
-       move_by_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
-       move_by_test_add_assertion (data, 5, 13, 12, 9,  19, 20);
-       move_by_test_add (data, FALSE);
-
-       data = move_by_test_new ("/EbSdbCursor/ChangeLocale/de_DE", "de_DE.UTF-8");
-       move_by_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
-       move_by_test_add_assertion (data, 5, 7,  8,  4,  3,  15);
-       move_by_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
-       move_by_test_add_assertion (data, 5, 12, 13, 9,  20, 19);
-       move_by_test_add (data, FALSE);
+       data = step_test_new ("/EbSdbCursor/ChangeLocale/POSIX", "POSIX");
+       step_test_add_assertion (data, 5, 11, 2,  6,  3,  8);
+       step_test_add_assertion (data, 5, 1,  5,  4,  7,  15);
+       step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+       step_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
+       step_test_add (data, FALSE);
+
+       data = step_test_new ("/EbSdbCursor/ChangeLocale/en_US", "en_US.UTF-8");
+       step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
+       step_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
+       step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+       step_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
+       step_test_add (data, FALSE);
+
+       data = step_test_new ("/EbSdbCursor/ChangeLocale/fr_CA", "fr_CA.UTF-8");
+       step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
+       step_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
+       step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+       step_test_add_assertion (data, 5, 13, 12, 9,  19, 20);
+       step_test_add (data, FALSE);
+
+       data = step_test_new ("/EbSdbCursor/ChangeLocale/de_DE", "de_DE.UTF-8");
+       step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
+       step_test_add_assertion (data, 5, 7,  8,  4,  3,  15);
+       step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+       step_test_add_assertion (data, 5, 12, 13, 9,  20, 19);
+       step_test_add (data, FALSE);
 
        /* On this case, we want to delete the work directory and start afresh */
        return e_test_server_utils_run ();
diff --git a/tests/libedata-book/test-sqlite-cursor-de-DE-migrated.c 
b/tests/libedata-book/test-sqlite-cursor-de-DE-migrated.c
index 9944ddc..f1f1c32 100644
--- a/tests/libedata-book/test-sqlite-cursor-de-DE-migrated.c
+++ b/tests/libedata-book/test-sqlite-cursor-de-DE-migrated.c
@@ -10,7 +10,7 @@ gint
 main (gint argc,
       gchar **argv)
 {
-       MoveByData *data;
+       StepData *data;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
@@ -20,12 +20,12 @@ main (gint argc,
        /* Ensure that the client and server get the same locale */
        g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
 
-       data = move_by_test_new ("/EbSdbCursor/Locale/de_DE/Migrated", "de_DE.UTF-8");
-       move_by_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
-       move_by_test_add_assertion (data, 5, 7,  8,  4,  3,  15);
-       move_by_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
-       move_by_test_add_assertion (data, 5, 12, 13, 9,  20, 19);
-       move_by_test_add (data, FALSE);
+       data = step_test_new ("/EbSdbCursor/Locale/de_DE/Migrated", "de_DE.UTF-8");
+       step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
+       step_test_add_assertion (data, 5, 7,  8,  4,  3,  15);
+       step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+       step_test_add_assertion (data, 5, 12, 13, 9,  20, 19);
+       step_test_add (data, FALSE);
 
        /* On this case, we are using the migrated addressbook, don't delete it first */
        return e_test_server_utils_run_full (E_TEST_SERVER_KEEP_WORK_DIRECTORY);
diff --git a/tests/libedata-book/test-sqlite-cursor-en-US-migrated.c 
b/tests/libedata-book/test-sqlite-cursor-en-US-migrated.c
index 7e2f969..9ca486e 100644
--- a/tests/libedata-book/test-sqlite-cursor-en-US-migrated.c
+++ b/tests/libedata-book/test-sqlite-cursor-en-US-migrated.c
@@ -11,7 +11,7 @@ gint
 main (gint argc,
       gchar **argv)
 {
-       MoveByData *data;
+       StepData *data;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
@@ -21,12 +21,12 @@ main (gint argc,
        /* Ensure that the client and server get the same locale */
        g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
 
-       data = move_by_test_new ("/EbSdbCursor/Locale/en_US/Migrated", "en_US.UTF-8");
-       move_by_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
-       move_by_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
-       move_by_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
-       move_by_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
-       move_by_test_add (data, FALSE);
+       data = step_test_new ("/EbSdbCursor/Locale/en_US/Migrated", "en_US.UTF-8");
+       step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
+       step_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
+       step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+       step_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
+       step_test_add (data, FALSE);
 
        /* On this case, we are using the migrated addressbook, don't delete it first */
        return e_test_server_utils_run_full (E_TEST_SERVER_KEEP_WORK_DIRECTORY);
diff --git a/tests/libedata-book/test-sqlite-cursor-fr-CA-migrated.c 
b/tests/libedata-book/test-sqlite-cursor-fr-CA-migrated.c
index bc1cc9b..e8eebf7 100644
--- a/tests/libedata-book/test-sqlite-cursor-fr-CA-migrated.c
+++ b/tests/libedata-book/test-sqlite-cursor-fr-CA-migrated.c
@@ -10,7 +10,7 @@ gint
 main (gint argc,
       gchar **argv)
 {
-       MoveByData *data;
+       StepData *data;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
@@ -20,12 +20,12 @@ main (gint argc,
        /* Ensure that the client and server get the same locale */
        g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
 
-       data = move_by_test_new ("/EbSdbCursor/Locale/fr_CA/Migrated", "fr_CA.UTF-8");
-       move_by_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
-       move_by_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
-       move_by_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
-       move_by_test_add_assertion (data, 5, 13, 12, 9,  19, 20);
-       move_by_test_add (data, FALSE);
+       data = step_test_new ("/EbSdbCursor/Locale/fr_CA/Migrated", "fr_CA.UTF-8");
+       step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
+       step_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
+       step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+       step_test_add_assertion (data, 5, 13, 12, 9,  19, 20);
+       step_test_add (data, FALSE);
 
        /* On this case, we are using the migrated addressbook, don't delete it first */
        return e_test_server_utils_run_full (E_TEST_SERVER_KEEP_WORK_DIRECTORY);
diff --git a/tests/libedata-book/test-sqlite-cursor-move-by-de-DE.c 
b/tests/libedata-book/test-sqlite-cursor-move-by-de-DE.c
index d3fac4e..e1e6a98 100644
--- a/tests/libedata-book/test-sqlite-cursor-move-by-de-DE.c
+++ b/tests/libedata-book/test-sqlite-cursor-move-by-de-DE.c
@@ -10,37 +10,37 @@ gint
 main (gint argc,
       gchar **argv)
 {
-       MoveByData *data;
+       StepData *data;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       data = move_by_test_new ("/EbSdbCursor/de_DE/Move/Forward", "de_DE.UTF-8");
-       move_by_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
-       move_by_test_add_assertion (data, 6, 7, 8, 4, 3, 15, 17);
-       move_by_test_add (data, FALSE);
-
-       data = move_by_test_new ("/EbSdbCursor/de_DE/Move/ForwardOnNameless", "de_DE.UTF-8");
-       move_by_test_add_assertion (data, 1, 11);
-       move_by_test_add_assertion (data, 3, 1, 2, 5);
-       move_by_test_add (data, FALSE);
-
-       data = move_by_test_new ("/EbSdbCursor/de_DE/Move/Backwards", "de_DE.UTF-8");
-       move_by_test_add_assertion (data, -5, 19, 20, 9, 13, 12);
-       move_by_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 3, 4);
-       move_by_test_add (data, FALSE);
-
-       data = move_by_test_new ("/EbSdbCursor/de_DE/Filtered/Move/Forward", "de_DE.UTF-8");
-       move_by_test_add_assertion (data, 5, 11, 1, 2, 5, 8);
-       move_by_test_add_assertion (data, 8, 3, 17, 16, 18, 10, 14, 12, 9);
-       move_by_test_add (data, TRUE);
-
-       data = move_by_test_new ("/EbSdbCursor/de_DE/Filtered/Move/Backwards", "de_DE.UTF-8");
-       move_by_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
-       move_by_test_add_assertion (data, -8, 16, 17, 3, 8, 5, 2, 1, 11);
-       move_by_test_add (data, TRUE);
+       data = step_test_new ("/EbSdbCursor/de_DE/Move/Forward", "de_DE.UTF-8");
+       step_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
+       step_test_add_assertion (data, 6, 7, 8, 4, 3, 15, 17);
+       step_test_add (data, FALSE);
+
+       data = step_test_new ("/EbSdbCursor/de_DE/Move/ForwardOnNameless", "de_DE.UTF-8");
+       step_test_add_assertion (data, 1, 11);
+       step_test_add_assertion (data, 3, 1, 2, 5);
+       step_test_add (data, FALSE);
+
+       data = step_test_new ("/EbSdbCursor/de_DE/Move/Backwards", "de_DE.UTF-8");
+       step_test_add_assertion (data, -5, 19, 20, 9, 13, 12);
+       step_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 3, 4);
+       step_test_add (data, FALSE);
+
+       data = step_test_new ("/EbSdbCursor/de_DE/Filtered/Move/Forward", "de_DE.UTF-8");
+       step_test_add_assertion (data, 5, 11, 1, 2, 5, 8);
+       step_test_add_assertion (data, 8, 3, 17, 16, 18, 10, 14, 12, 9);
+       step_test_add (data, TRUE);
+
+       data = step_test_new ("/EbSdbCursor/de_DE/Filtered/Move/Backwards", "de_DE.UTF-8");
+       step_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
+       step_test_add_assertion (data, -8, 16, 17, 3, 8, 5, 2, 1, 11);
+       step_test_add (data, TRUE);
 
        return e_test_server_utils_run ();
 }
diff --git a/tests/libedata-book/test-sqlite-cursor-move-by-en-US.c 
b/tests/libedata-book/test-sqlite-cursor-move-by-en-US.c
index 2876a16..233b10d 100644
--- a/tests/libedata-book/test-sqlite-cursor-move-by-en-US.c
+++ b/tests/libedata-book/test-sqlite-cursor-move-by-en-US.c
@@ -10,54 +10,51 @@ gint
 main (gint argc,
       gchar **argv)
 {
-       MoveByData *data;
+       StepData *data;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       data = move_by_test_new ("/EbSdbCursor/en_US/Move/Forward", "en_US.UTF-8");
-       move_by_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
-       move_by_test_add_assertion (data, 6, 4, 3, 7, 8, 15, 17);
-       move_by_test_add (data, FALSE);
+       data = step_test_new ("/EbSdbCursor/en_US/Move/Forward", "en_US.UTF-8");
+       step_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
+       step_test_add_assertion (data, 6, 4, 3, 7, 8, 15, 17);
+       step_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/en_US/Move/ForwardOnNameless", "en_US.UTF-8");
-       move_by_test_add_assertion (data, 1, 11);
-       move_by_test_add_assertion (data, 3, 1, 2, 5);
-       move_by_test_add (data, FALSE);
+       data = step_test_new ("/EbSdbCursor/en_US/Move/ForwardOnNameless", "en_US.UTF-8");
+       step_test_add_assertion (data, 1, 11);
+       step_test_add_assertion (data, 3, 1, 2, 5);
+       step_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/en_US/Move/Backwards", "en_US.UTF-8");
-       move_by_test_add_assertion (data, -5, 20, 19, 9, 13, 12);
-       move_by_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 8, 7);
-       move_by_test_add (data, FALSE);
+       data = step_test_new ("/EbSdbCursor/en_US/Move/Backwards", "en_US.UTF-8");
+       step_test_add_assertion (data, -5, 20, 19, 9, 13, 12);
+       step_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 8, 7);
+       step_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/en_US/Filtered/Move/Forward", "en_US.UTF-8");
-       move_by_test_add_assertion (data, 5, 11, 1, 2, 5, 3);
-       move_by_test_add_assertion (data, 8, 8, 17, 16, 18, 10, 14, 12, 9);
-       move_by_test_add (data, TRUE);
+       data = step_test_new ("/EbSdbCursor/en_US/Filtered/Move/Forward", "en_US.UTF-8");
+       step_test_add_assertion (data, 5, 11, 1, 2, 5, 3);
+       step_test_add_assertion (data, 8, 8, 17, 16, 18, 10, 14, 12, 9);
+       step_test_add (data, TRUE);
 
-       data = move_by_test_new ("/EbSdbCursor/en_US/Filtered/Move/Backwards", "en_US.UTF-8");
-       move_by_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
-       move_by_test_add_assertion (data, -8, 16, 17, 8, 3, 5, 2, 1, 11);
-       move_by_test_add (data, TRUE);
+       data = step_test_new ("/EbSdbCursor/en_US/Filtered/Move/Backwards", "en_US.UTF-8");
+       step_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
+       step_test_add_assertion (data, -8, 16, 17, 8, 3, 5, 2, 1, 11);
+       step_test_add (data, TRUE);
 
-       data = move_by_test_new_full ("/EbSdbCursor/en_US/Move/Descending/Forward", "en_US.UTF-8",
+       data = step_test_new_full ("/EbSdbCursor/en_US/Move/Descending/Forward", "en_US.UTF-8",
                                      E_BOOK_CURSOR_SORT_DESCENDING);
-       move_by_test_add_assertion (data, 5, 20, 19, 9,  13, 12);
-       move_by_test_add_assertion (data, 5, 14, 10, 18, 16, 17);
-       move_by_test_add_assertion (data, 5, 15, 8,  7,  3,  4);
-       move_by_test_add_assertion (data, 5, 6,  5,  2,  1,  11);
-       move_by_test_add (data, FALSE);
+       step_test_add_assertion (data, 5, 20, 19, 9,  13, 12);
+       step_test_add_assertion (data, 5, 14, 10, 18, 16, 17);
+       step_test_add_assertion (data, 5, 15, 8,  7,  3,  4);
+       step_test_add_assertion (data, 5, 6,  5,  2,  1,  11);
+       step_test_add (data, FALSE);
 
-       data = move_by_test_new_full ("/EbSdbCursor/en_US/Move/Descending/Forward/Loop", "en_US.UTF-8",
+       data = step_test_new_full ("/EbSdbCursor/en_US/Move/Descending/Backwards", "en_US.UTF-8",
                                      E_BOOK_CURSOR_SORT_DESCENDING);
-       move_by_test_add_assertion (data, 10, 20, 19, 9,  13, 12, 14, 10, 18, 16, 17);
-       move_by_test_add_assertion (data, 11, 15, 8,  7,  3,  4, 6,  5,  2,  1,  11, 0);
-
-       move_by_test_add_assertion (data, 10, 20, 19, 9,  13, 12, 14, 10, 18, 16, 17);
-       move_by_test_add_assertion (data, 10, 15, 8,  7,  3,  4, 6,  5,  2,  1,  11);
-       move_by_test_add (data, FALSE);
+       step_test_add_assertion (data, -10, 11, 1,  2,  5,  6,  4,  3,  7,  8, 15);
+       step_test_add_assertion (data, -10, 17, 16, 18, 10, 14, 12, 13, 9, 19, 20);
+       step_test_add (data, FALSE);
 
        return e_test_server_utils_run ();
 }
diff --git a/tests/libedata-book/test-sqlite-cursor-move-by-fr-CA.c 
b/tests/libedata-book/test-sqlite-cursor-move-by-fr-CA.c
index 4d13e24..6b1b1a1 100644
--- a/tests/libedata-book/test-sqlite-cursor-move-by-fr-CA.c
+++ b/tests/libedata-book/test-sqlite-cursor-move-by-fr-CA.c
@@ -10,37 +10,37 @@ gint
 main (gint argc,
       gchar **argv)
 {
-       MoveByData *data;
+       StepData *data;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       data = move_by_test_new ("/EbSdbCursor/fr_CA/Move/Forward", "fr_CA.UTF-8");
-       move_by_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
-       move_by_test_add_assertion (data, 6, 4, 3, 7, 8, 15, 17);
-       move_by_test_add (data, FALSE);
-
-       data = move_by_test_new ("/EbSdbCursor/fr_CA/Move/ForwardOnNameless", "fr_CA.UTF-8");
-       move_by_test_add_assertion (data, 1, 11);
-       move_by_test_add_assertion (data, 3, 1, 2, 5);
-       move_by_test_add (data, FALSE);
-
-       data = move_by_test_new ("/EbSdbCursor/fr_CA/Move/Backwards", "fr_CA.UTF-8");
-       move_by_test_add_assertion (data, -5, 20, 19, 9, 12, 13);
-       move_by_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 8, 7);
-       move_by_test_add (data, FALSE);
-
-       data = move_by_test_new ("/EbSdbCursor/fr_CA/Filtered/Move/Forward", "fr_CA.UTF-8");
-       move_by_test_add_assertion (data, 5, 11, 1, 2, 5, 3);
-       move_by_test_add_assertion (data, 8, 8, 17, 16, 18, 10, 14, 12, 9);
-       move_by_test_add (data, TRUE);
-
-       data = move_by_test_new ("/EbSdbCursor/fr_CA/Filtered/Move/Backwards", "fr_CA.UTF-8");
-       move_by_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
-       move_by_test_add_assertion (data, -8, 16, 17, 8, 3, 5, 2, 1, 11);
-       move_by_test_add (data, TRUE);
+       data = step_test_new ("/EbSdbCursor/fr_CA/Move/Forward", "fr_CA.UTF-8");
+       step_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
+       step_test_add_assertion (data, 6, 4, 3, 7, 8, 15, 17);
+       step_test_add (data, FALSE);
+
+       data = step_test_new ("/EbSdbCursor/fr_CA/Move/ForwardOnNameless", "fr_CA.UTF-8");
+       step_test_add_assertion (data, 1, 11);
+       step_test_add_assertion (data, 3, 1, 2, 5);
+       step_test_add (data, FALSE);
+
+       data = step_test_new ("/EbSdbCursor/fr_CA/Move/Backwards", "fr_CA.UTF-8");
+       step_test_add_assertion (data, -5, 20, 19, 9, 12, 13);
+       step_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 8, 7);
+       step_test_add (data, FALSE);
+
+       data = step_test_new ("/EbSdbCursor/fr_CA/Filtered/Move/Forward", "fr_CA.UTF-8");
+       step_test_add_assertion (data, 5, 11, 1, 2, 5, 3);
+       step_test_add_assertion (data, 8, 8, 17, 16, 18, 10, 14, 12, 9);
+       step_test_add (data, TRUE);
+
+       data = step_test_new ("/EbSdbCursor/fr_CA/Filtered/Move/Backwards", "fr_CA.UTF-8");
+       step_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
+       step_test_add_assertion (data, -8, 16, 17, 8, 3, 5, 2, 1, 11);
+       step_test_add (data, TRUE);
 
        return e_test_server_utils_run ();
 }
diff --git a/tests/libedata-book/test-sqlite-cursor-move-by-posix.c 
b/tests/libedata-book/test-sqlite-cursor-move-by-posix.c
index 01eed6a..314dad0 100644
--- a/tests/libedata-book/test-sqlite-cursor-move-by-posix.c
+++ b/tests/libedata-book/test-sqlite-cursor-move-by-posix.c
@@ -10,37 +10,37 @@ gint
 main (gint argc,
       gchar **argv)
 {
-       MoveByData *data;
+       StepData *data;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       data = move_by_test_new ("/EbSdbCursor/POSIX/Move/Forward", "POSIX");
-       move_by_test_add_assertion (data, 5, 11, 2, 6, 3, 8);
-       move_by_test_add_assertion (data, 6, 1,  5,  4,  7,  15, 17);
-       move_by_test_add (data, FALSE);
-
-       data = move_by_test_new ("/EbSdbCursor/POSIX/Move/ForwardOnNameless", "POSIX");
-       move_by_test_add_assertion (data, 1, 11);
-       move_by_test_add_assertion (data, 3, 2, 6, 3);
-       move_by_test_add (data, FALSE);
-
-       data = move_by_test_new ("/EbSdbCursor/POSIX/Move/Backwards", "POSIX");
-       move_by_test_add_assertion (data, -5, 20, 19, 9, 13, 12);
-       move_by_test_add_assertion (data, -12, 14, 10, 18, 16, 17, 15, 7, 4, 5, 1, 8, 3);
-       move_by_test_add (data, FALSE);
-
-       data = move_by_test_new ("/EbSdbCursor/POSIX/Filtered/Move/Forward", "POSIX");
-       move_by_test_add_assertion (data, 5, 11, 2, 3, 8, 1);
-       move_by_test_add_assertion (data, 8, 5, 17, 16, 18, 10, 14, 12, 9);
-       move_by_test_add (data, TRUE);
-
-       data = move_by_test_new ("/EbSdbCursor/POSIX/Filtered/Move/Backwards", "POSIX");
-       move_by_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
-       move_by_test_add_assertion (data, -8, 16, 17, 5, 1, 8, 3, 2, 11);
-       move_by_test_add (data, TRUE);
+       data = step_test_new ("/EbSdbCursor/POSIX/Move/Forward", "POSIX");
+       step_test_add_assertion (data, 5, 11, 2, 6, 3, 8);
+       step_test_add_assertion (data, 6, 1,  5,  4,  7,  15, 17);
+       step_test_add (data, FALSE);
+
+       data = step_test_new ("/EbSdbCursor/POSIX/Move/ForwardOnNameless", "POSIX");
+       step_test_add_assertion (data, 1, 11);
+       step_test_add_assertion (data, 3, 2, 6, 3);
+       step_test_add (data, FALSE);
+
+       data = step_test_new ("/EbSdbCursor/POSIX/Move/Backwards", "POSIX");
+       step_test_add_assertion (data, -5, 20, 19, 9, 13, 12);
+       step_test_add_assertion (data, -12, 14, 10, 18, 16, 17, 15, 7, 4, 5, 1, 8, 3);
+       step_test_add (data, FALSE);
+
+       data = step_test_new ("/EbSdbCursor/POSIX/Filtered/Move/Forward", "POSIX");
+       step_test_add_assertion (data, 5, 11, 2, 3, 8, 1);
+       step_test_add_assertion (data, 8, 5, 17, 16, 18, 10, 14, 12, 9);
+       step_test_add (data, TRUE);
+
+       data = step_test_new ("/EbSdbCursor/POSIX/Filtered/Move/Backwards", "POSIX");
+       step_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
+       step_test_add_assertion (data, -8, 16, 17, 5, 1, 8, 3, 2, 11);
+       step_test_add (data, TRUE);
 
        return e_test_server_utils_run ();
 }
diff --git a/tests/libedata-book/test-sqlite-cursor-posix-initial.c 
b/tests/libedata-book/test-sqlite-cursor-posix-initial.c
index 0703fa1..7283c6f 100644
--- a/tests/libedata-book/test-sqlite-cursor-posix-initial.c
+++ b/tests/libedata-book/test-sqlite-cursor-posix-initial.c
@@ -10,7 +10,7 @@ gint
 main (gint argc,
       gchar **argv)
 {
-       MoveByData *data;
+       StepData *data;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
@@ -23,12 +23,12 @@ main (gint argc,
         * recreate the contacts but rely on the addressbook to have migrated the sort keys
         * into the new locales
         */
-       data = move_by_test_new ("/EbSdbCursor/Locale/POSIX/Initial", "POSIX");
-       move_by_test_add_assertion (data, 5, 11, 2,  6,  3,  8);
-       move_by_test_add_assertion (data, 5, 1,  5,  4,  7,  15);
-       move_by_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
-       move_by_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
-       move_by_test_add (data, FALSE);
+       data = step_test_new ("/EbSdbCursor/Locale/POSIX/Initial", "POSIX");
+       step_test_add_assertion (data, 5, 11, 2,  6,  3,  8);
+       step_test_add_assertion (data, 5, 1,  5,  4,  7,  15);
+       step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+       step_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
+       step_test_add (data, FALSE);
 
        /* On this case, we want to delete the work directory and start afresh */
        return e_test_server_utils_run ();
diff --git a/tests/libedata-book/test-sqlite-cursor-posix-migrated.c 
b/tests/libedata-book/test-sqlite-cursor-posix-migrated.c
index 31a5cb9..00cc67d 100644
--- a/tests/libedata-book/test-sqlite-cursor-posix-migrated.c
+++ b/tests/libedata-book/test-sqlite-cursor-posix-migrated.c
@@ -10,7 +10,7 @@ gint
 main (gint argc,
       gchar **argv)
 {
-       MoveByData *data;
+       StepData *data;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
@@ -20,12 +20,12 @@ main (gint argc,
        /* Ensure that the client and server get the same locale */
        g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
 
-       data = move_by_test_new ("/EbSdbCursor/Locale/POSIX/Migrated", "POSIX");
-       move_by_test_add_assertion (data, 5, 11, 2,  6,  3,  8);
-       move_by_test_add_assertion (data, 5, 1,  5,  4,  7,  15);
-       move_by_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
-       move_by_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
-       move_by_test_add (data, FALSE);
+       data = step_test_new ("/EbSdbCursor/Locale/POSIX/Migrated", "POSIX");
+       step_test_add_assertion (data, 5, 11, 2,  6,  3,  8);
+       step_test_add_assertion (data, 5, 1,  5,  4,  7,  15);
+       step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+       step_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
+       step_test_add (data, FALSE);
 
        /* On this case, we are using the migrated addressbook, don't delete it first */
        return e_test_server_utils_run_full (E_TEST_SERVER_KEEP_WORK_DIRECTORY);
diff --git a/tests/libedata-book/test-sqlite-cursor-set-sexp.c 
b/tests/libedata-book/test-sqlite-cursor-set-sexp.c
index 05dcc7f..4427009 100644
--- a/tests/libedata-book/test-sqlite-cursor-set-sexp.c
+++ b/tests/libedata-book/test-sqlite-cursor-set-sexp.c
@@ -40,10 +40,11 @@ test_cursor_sexp_calculate_position (EbSdbCursorFixture *fixture,
        EbSdbSearchData *data;
 
        /* Set the cursor to point exactly to 'blackbirds', which is the 12th contact in en_US */
-       if (!e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                    fixture->cursor,
-                                                    EBSDB_CURSOR_ORIGIN_RESET,
-                                                    12, &results, &error))
+       if (!e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
+                                                 fixture->cursor,
+                                                 EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
+                                                 EBSDB_CURSOR_ORIGIN_BEGIN,
+                                                 12, &results, &error))
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Ensure we moved to the right contact */
diff --git a/tests/libedata-book/test-sqlite-cursor-set-target.c 
b/tests/libedata-book/test-sqlite-cursor-set-target.c
index 19b4ae8..c26ed75 100644
--- a/tests/libedata-book/test-sqlite-cursor-set-target.c
+++ b/tests/libedata-book/test-sqlite-cursor-set-target.c
@@ -19,10 +19,11 @@ test_cursor_set_target_reset_cursor (EbSdbCursorFixture *fixture,
        GError *error = NULL;
 
        /* First batch */
-       if (e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor,
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   5, &results, &error) < 0)
+       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)
                g_error ("Error fetching cursor results: %s", error->message);
 
        print_results (results);
@@ -42,10 +43,11 @@ test_cursor_set_target_reset_cursor (EbSdbCursorFixture *fixture,
        results = NULL;
 
        /* Second batch reset (same results) */
-       if (e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor,
-                                                   EBSDB_CURSOR_ORIGIN_RESET,
-                                                   5, &results, &error) < 0)
+       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)
                g_error ("Error fetching cursor results: %s", error->message);
 
        print_results (results);
@@ -87,10 +89,11 @@ test_cursor_set_target_c_next_results (EbSdbCursorFixture *fixture,
        e_book_backend_sqlitedb_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsdb,
                                                                    fixture->cursor, 3);
 
-       if (e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor,
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   5, &results, &error) < 0)
+       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)
                g_error ("Error fetching cursor results: %s", error->message);
 
        print_results (results);
@@ -132,10 +135,11 @@ test_cursor_set_target_c_prev_results (EbSdbCursorFixture *fixture,
        e_book_backend_sqlitedb_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsdb,
                                                                    fixture->cursor, 3);
 
-       if (e_book_backend_sqlitedb_cursor_move_by (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                   fixture->cursor, 
-                                                   EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                   -5, &results, &error) < 0)
+       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)
                g_error ("Error fetching cursor results: %s", error->message);
 
        print_results (results);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]