Commit a796c679 authored by Tristan Van Berkom's avatar Tristan Van Berkom
Browse files

Migrated sqlite cursor test cases to not specify any specific collation rule.

parent b15225b7
......@@ -216,12 +216,6 @@ e_sqlitedb_cursor_fixture_setup_book (ESource *scratch,
E_CONTACT_GIVEN_NAME, E_BOOK_INDEX_PREFIX,
E_CONTACT_EMAIL, E_BOOK_INDEX_PREFIX,
0);
if (data->phonebook_order)
e_source_backend_summary_setup_set_collations (setup,
E_CONTACT_FAMILY_NAME, "phonebook",
E_CONTACT_GIVEN_NAME, "phonebook",
0);
}
void
......@@ -399,7 +393,6 @@ print_results (GSList *results)
static MoveByData *
move_by_test_new_internal (const gchar *test_path,
gboolean phonebook_order,
gsize struct_size)
{
MoveByData *data;
......@@ -407,7 +400,6 @@ move_by_test_new_internal (const gchar *test_path,
data = g_slice_alloc0 (struct_size);
data->parent.parent.type = E_TEST_SERVER_ADDRESS_BOOK;
data->parent.parent.customize = e_sqlitedb_cursor_fixture_setup_book;
data->parent.phonebook_order = phonebook_order;
data->path = g_strdup (test_path);
data->struct_size = struct_size;
......@@ -426,12 +418,9 @@ move_by_test_free (MoveByData *data)
}
MoveByData *
move_by_test_new (const gchar *test_path,
gboolean phonebook_order)
move_by_test_new (const gchar *test_path)
{
return move_by_test_new_internal (test_path,
phonebook_order,
sizeof (MoveByData));
return move_by_test_new_internal (test_path, sizeof (MoveByData));
}
static void
......
......@@ -87,7 +87,6 @@ typedef struct {
typedef struct {
ETestServerClosure parent;
gboolean phonebook_order;
} EbSdbCursorClosure;
typedef struct {
......@@ -140,8 +139,7 @@ void print_results (GSList *results);
void move_by_test_add_assertion (MoveByData *data,
gint count,
...);
MoveByData *move_by_test_new (const gchar *test_path,
gboolean phonebook_order);
MoveByData *move_by_test_new (const gchar *test_path);
void move_by_test_add (MoveByData *data,
gboolean filtered);
......
......@@ -21,18 +21,7 @@ main (gint argc,
g_assert (g_setenv ("EDS_COLLATE", "de_DE.UTF-8", TRUE));
g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
/* Here we rely on the initial addressbook book created by
* test-sqlite-cursor-posix-initial, which created the addressbook
* with the phonebook collation rule.
*
* Here we assert that the SQLite introspection works properly after
* a migration, and the recorded SQLite collation names are used instead of the
* parameters when opening the addressbook (since we pass FALSE here
* to move_by_test_new(), we create our addressbook with no special collation rule).
*/
data = move_by_test_new ("/EbSdbCursor/Locale/de_DE/Migrated", FALSE);
/* Assert the whole set of contacts */
data = move_by_test_new ("/EbSdbCursor/Locale/de_DE/Migrated");
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);
......
......@@ -22,8 +22,7 @@ main (gint argc,
g_assert (g_setenv ("EDS_COLLATE", "en_US.UTF-8", TRUE));
g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
/* Try them all once in the normal base locale */
data = move_by_test_new ("/EbSdbCursor/Locale/en_US/Migrated", FALSE);
data = move_by_test_new ("/EbSdbCursor/Locale/en_US/Migrated");
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);
......
......@@ -21,8 +21,7 @@ main (gint argc,
g_assert (g_setenv ("EDS_COLLATE", "fr_CA.UTF-8", TRUE));
g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
/* Assert the whole set of contacts */
data = move_by_test_new ("/EbSdbCursor/Locale/fr_CA/Migrated", FALSE);
data = move_by_test_new ("/EbSdbCursor/Locale/fr_CA/Migrated");
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);
......
......@@ -20,55 +20,27 @@ main (gint argc,
/* Ensure that the client and server get the same locale */
g_assert (g_setenv ("EDS_COLLATE", "de_DE.UTF-8", TRUE));
/* Try them all once in the normal base locale */
data = move_by_test_new ("/EbSdbCursor/de_DE/Move/Forward", FALSE);
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/de_DE/Move/ForwardOnNameless", FALSE);
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", FALSE);
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 = move_by_test_new ("/EbSdbCursor/de_DE/Filtered/Move/Forward", FALSE);
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/de_DE/Filtered/Move/Backwards", FALSE);
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);
/* Try them all again with collation = phonebook */
data = move_by_test_new ("/EbSdbCursor/de_DE@collation=phonebook/Move/Forward", TRUE);
data = move_by_test_new ("/EbSdbCursor/de_DE/Move/Forward");
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@collation=phonebook/Move/ForwardOnNameless", TRUE);
data = move_by_test_new ("/EbSdbCursor/de_DE/Move/ForwardOnNameless");
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@collation=phonebook/Move/Backwards", TRUE);
data = move_by_test_new ("/EbSdbCursor/de_DE/Move/Backwards");
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@collation=phonebook/Filtered/Move/Forward", TRUE);
data = move_by_test_new ("/EbSdbCursor/de_DE/Filtered/Move/Forward");
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@collation=phonebook/Filtered/Move/Backwards", TRUE);
data = move_by_test_new ("/EbSdbCursor/de_DE/Filtered/Move/Backwards");
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);
......
......@@ -20,55 +20,27 @@ main (gint argc,
/* Ensure that the client and server get the same locale */
g_assert (g_setenv ("EDS_COLLATE", "en_US.UTF-8", TRUE));
/* Try them all once in the normal base locale */
data = move_by_test_new ("/EbSdbCursor/en_US/Move/Forward", FALSE);
data = move_by_test_new ("/EbSdbCursor/en_US/Move/Forward");
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/en_US/Move/ForwardOnNameless", FALSE);
data = move_by_test_new ("/EbSdbCursor/en_US/Move/ForwardOnNameless");
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/en_US/Move/Backwards", FALSE);
data = move_by_test_new ("/EbSdbCursor/en_US/Move/Backwards");
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 = move_by_test_new ("/EbSdbCursor/en_US/Filtered/Move/Forward", FALSE);
data = move_by_test_new ("/EbSdbCursor/en_US/Filtered/Move/Forward");
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/en_US/Filtered/Move/Backwards", FALSE);
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);
/* Try them all again with collation = phonebook */
data = move_by_test_new ("/EbSdbCursor/en_US@collation=phonebook/Move/Forward", TRUE);
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/en_US@collation=phonebook/Move/ForwardOnNameless", TRUE);
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/en_US@collation=phonebook/Move/Backwards", TRUE);
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 = move_by_test_new ("/EbSdbCursor/en_US@collation=phonebook/Filtered/Move/Forward", TRUE);
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/en_US@collation=phonebook/Filtered/Move/Backwards", TRUE);
data = move_by_test_new ("/EbSdbCursor/en_US/Filtered/Move/Backwards");
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);
......
......@@ -20,55 +20,27 @@ main (gint argc,
/* Ensure that the client and server get the same locale */
g_assert (g_setenv ("EDS_COLLATE", "fr_CA.UTF-8", TRUE));
/* Try them all once in the normal base locale */
data = move_by_test_new ("/EbSdbCursor/fr_CA/Move/Forward", FALSE);
data = move_by_test_new ("/EbSdbCursor/fr_CA/Move/Forward");
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", FALSE);
data = move_by_test_new ("/EbSdbCursor/fr_CA/Move/ForwardOnNameless");
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", FALSE);
data = move_by_test_new ("/EbSdbCursor/fr_CA/Move/Backwards");
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", FALSE);
data = move_by_test_new ("/EbSdbCursor/fr_CA/Filtered/Move/Forward");
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", FALSE);
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);
/* Try them all again with collation = phonebook */
data = move_by_test_new ("/EbSdbCursor/fr_CA@collation=phonebook/Move/Forward", TRUE);
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@collation=phonebook/Move/ForwardOnNameless", TRUE);
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@collation=phonebook/Move/Backwards", TRUE);
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@collation=phonebook/Filtered/Move/Forward", TRUE);
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@collation=phonebook/Filtered/Move/Backwards", TRUE);
data = move_by_test_new ("/EbSdbCursor/fr_CA/Filtered/Move/Backwards");
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);
......
......@@ -20,59 +20,30 @@ main (gint argc,
/* Ensure that the client and server get the same locale */
g_assert (g_setenv ("EDS_COLLATE", "POSIX", TRUE));
/* Try them all once in the normal base locale */
data = move_by_test_new ("/EbSdbCursor/POSIX/Move/Forward", FALSE);
data = move_by_test_new ("/EbSdbCursor/POSIX/Move/Forward");
move_by_test_add_assertion (data, 5, 11, 2, 6, 3, 8);
move_by_test_add_assertion (data, 6, 10, 19, 20, 1, 5, 4);
move_by_test_add (data, FALSE);
data = move_by_test_new ("/EbSdbCursor/POSIX/Move/ForwardOnNameless", FALSE);
data = move_by_test_new ("/EbSdbCursor/POSIX/Move/ForwardOnNameless");
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", FALSE);
data = move_by_test_new ("/EbSdbCursor/POSIX/Move/Backwards");
move_by_test_add_assertion (data, -5, 9, 13, 12, 14, 18);
move_by_test_add_assertion (data, -12, 16, 17, 15, 7, 4, 5, 1, 20, 19, 10, 8, 3);
move_by_test_add (data, FALSE);
data = move_by_test_new ("/EbSdbCursor/POSIX/Filtered/Move/Forward", FALSE);
data = move_by_test_new ("/EbSdbCursor/POSIX/Filtered/Move/Forward");
move_by_test_add_assertion (data, 5, 11, 2, 3, 8, 10);
move_by_test_add_assertion (data, 8, 1, 5, 17, 16, 18, 14, 12, 9);
move_by_test_add (data, TRUE);
data = move_by_test_new ("/EbSdbCursor/POSIX/Filtered/Move/Backwards", FALSE);
data = move_by_test_new ("/EbSdbCursor/POSIX/Filtered/Move/Backwards");
move_by_test_add_assertion (data, -5, 9, 12, 14, 18, 16);
move_by_test_add_assertion (data, -8, 17, 5, 1, 10, 8, 3, 2, 11);
move_by_test_add (data, TRUE);
/* Try them all again with collation = phonebook */
data = move_by_test_new ("/EbSdbCursor/POSIX@collation=phonebook/Move/Forward", TRUE);
move_by_test_add_assertion (data, 5, 11, 2, 6, 3, 8);
move_by_test_add_assertion (data, 6, 10, 19, 20, 1, 5, 4);
move_by_test_add (data, FALSE);
data = move_by_test_new ("/EbSdbCursor/POSIX@collation=phonebook/Move/ForwardOnNameless", TRUE);
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@collation=phonebook/Move/Backwards", TRUE);
move_by_test_add_assertion (data, -5, 9, 13, 12, 14, 18);
move_by_test_add_assertion (data, -12, 16, 17, 15, 7, 4, 5, 1, 20, 19, 10, 8, 3);
move_by_test_add (data, FALSE);
data = move_by_test_new ("/EbSdbCursor/POSIX@collation=phonebook/Filtered/Move/Forward", TRUE);
move_by_test_add_assertion (data, 5, 11, 2, 3, 8, 10);
move_by_test_add_assertion (data, 8, 1, 5, 17, 16, 18, 14, 12, 9);
move_by_test_add (data, TRUE);
data = move_by_test_new ("/EbSdbCursor/POSIX@collation=phonebook/Filtered/Move/Backwards", TRUE);
move_by_test_add_assertion (data, -5, 9, 12, 14, 18, 16);
move_by_test_add_assertion (data, -8, 17, 5, 1, 10, 8, 3, 2, 11);
move_by_test_add (data, TRUE);
return e_test_server_utils_run ();
}
......@@ -21,16 +21,11 @@ main (gint argc,
g_assert (g_setenv ("EDS_COLLATE", "POSIX", TRUE));
g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
/* When creating the addressbook, declare it with collation_type = "phonebook",
* note that other tests dont specify this, however the de_DE needs phonebook collation.
*
* In this way, we also assert that the SQLite introspection works properly after
* a migration, and the recorded SQLite collation names are used instead of the
* parameters when opening the addressbook.
/* This test actually creates the addressbook, subsequent migration tests dont
* 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", TRUE);
/* Assert the whole set of contacts */
data = move_by_test_new ("/EbSdbCursor/Locale/POSIX/Initial");
move_by_test_add_assertion (data, 5, 11, 2, 6, 3, 8);
move_by_test_add_assertion (data, 5, 10, 19, 20, 1, 5);
move_by_test_add_assertion (data, 5, 4, 7, 15, 17, 16);
......
......@@ -21,8 +21,7 @@ main (gint argc,
g_assert (g_setenv ("EDS_COLLATE", "POSIX", TRUE));
g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
/* Assert the whole set of contacts */
data = move_by_test_new ("/EbSdbCursor/Locale/POSIX/Migrated", FALSE);
data = move_by_test_new ("/EbSdbCursor/Locale/POSIX/Migrated");
move_by_test_add_assertion (data, 5, 11, 2, 6, 3, 8);
move_by_test_add_assertion (data, 5, 10, 19, 20, 1, 5);
move_by_test_add_assertion (data, 5, 4, 7, 15, 17, 16);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment