[evolution-data-server/openismus-work-3-8: 42/116] Added test-sqlite-cursor-change-locale.c



commit 1500fd1dcd1ca7e6f0907eeebaed72b59e4af69b
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Mon May 27 20:20:33 2013 +0900

    Added test-sqlite-cursor-change-locale.c
    
    This new test changes the locale dynamically and then checks new
    sort order of the converted addressbook between every locale
    change.

 tests/libedata-book/Makefile.am                    |    6 ++-
 .../test-sqlite-cursor-change-locale.c             |   52 ++++++++++++++++++++
 2 files changed, 56 insertions(+), 2 deletions(-)
---
diff --git a/tests/libedata-book/Makefile.am b/tests/libedata-book/Makefile.am
index 2fadc32..75324f4 100644
--- a/tests/libedata-book/Makefile.am
+++ b/tests/libedata-book/Makefile.am
@@ -63,8 +63,8 @@ TESTS =                                               \
        test-sqlite-cursor-en-US-migrated       \
        test-sqlite-cursor-fr-CA-migrated       \
        test-sqlite-cursor-de-DE-migrated       \
-       test-sqlite-cursor-posix-migrated
-
+       test-sqlite-cursor-posix-migrated       \
+       test-sqlite-cursor-change-locale
 
 noinst_PROGRAMS = $(TESTS)
 
@@ -108,5 +108,7 @@ test_sqlite_cursor_de_DE_migrated_LDADD=$(TEST_LIBS)
 test_sqlite_cursor_de_DE_migrated_CPPFLAGS=$(TEST_CPPFLAGS)
 test_sqlite_cursor_posix_migrated_LDADD=$(TEST_LIBS)
 test_sqlite_cursor_posix_migrated_CPPFLAGS=$(TEST_CPPFLAGS)
+test_sqlite_cursor_change_locale_LDADD=$(TEST_LIBS)
+test_sqlite_cursor_change_locale_CPPFLAGS=$(TEST_CPPFLAGS)
 
 -include $(top_srcdir)/git.mk
diff --git a/tests/libedata-book/test-sqlite-cursor-change-locale.c 
b/tests/libedata-book/test-sqlite-cursor-change-locale.c
new file mode 100644
index 0000000..c11502d
--- /dev/null
+++ b/tests/libedata-book/test-sqlite-cursor-change-locale.c
@@ -0,0 +1,52 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <locale.h>
+#include <libebook/libebook.h>
+
+#include "data-test-utils.h"
+
+gint
+main (gint argc,
+      gchar **argv)
+{
+       MoveByData *data;
+
+#if !GLIB_CHECK_VERSION (2, 35, 1)
+       g_type_init ();
+#endif
+       g_test_init (&argc, &argv, NULL);
+
+       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, 10, 19, 20, 1,  5);
+       move_by_test_add_assertion (data, 5, 4,  7,  15, 17, 16);
+       move_by_test_add_assertion (data, 5, 18, 14, 12, 13, 9);
+       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);
+
+       /* On this case, we want to delete the work directory and start afresh */
+       return e_test_server_utils_run ();
+}


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