X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=tests%2Fcheck_modest-conf.c;h=668a1469658922ad472d155c9fd48859ff316851;hp=0cba48db51fd610aba4379666ac6ccec2d864a94;hb=0e377cfc61f7e67a47e50096e1ad4a3dead53731;hpb=3b6a17e70f502ccdd48e31a1b13ec753f2c90713 diff --git a/tests/check_modest-conf.c b/tests/check_modest-conf.c index 0cba48d..668a146 100644 --- a/tests/check_modest-conf.c +++ b/tests/check_modest-conf.c @@ -28,8 +28,23 @@ */ #include +#include #include +#include #include +#include + +static void +fx_setup_modest_conf () +{ + fail_unless (gtk_init_check (NULL, NULL)); + + fail_unless (g_setenv (MODEST_DIR_ENV, ".modesttest", TRUE)); + fail_unless (g_setenv (MODEST_NAMESPACE_ENV, "/apps/modesttest", TRUE)); + + fail_unless (modest_init (0, NULL), "Failed running modest_init"); + +} START_TEST (test_modest_conf_new) { @@ -45,8 +60,8 @@ END_TEST START_TEST (test_modest_conf_store_retrieve_string) { ModestConf *conf = modest_conf_new (); - const gchar *key = MODEST_CONF_NAMESPACE "/teststring"; - const gchar *key2 = MODEST_CONF_NAMESPACE "/teststring2"; + const gchar *key = modest_defs_namespace ("/teststring"); + const gchar *key2 = modest_defs_namespace ("/teststring2"); const gchar *data = "hello in Korean: 안녕하세요"; gchar *data2; @@ -85,8 +100,8 @@ END_TEST START_TEST (test_modest_conf_store_retrieve_bool) { ModestConf *conf = modest_conf_new (); - const gchar *key = MODEST_CONF_NAMESPACE "/teststring"; - const gchar *key2 = MODEST_CONF_NAMESPACE "/teststring2"; + const gchar *key = modest_defs_namespace ("/teststring"); + const gchar *key2 = modest_defs_namespace ("/teststring2"); gboolean data = TRUE, data2; @@ -120,8 +135,8 @@ END_TEST START_TEST (test_modest_conf_store_retrieve_int) { ModestConf *conf = modest_conf_new (); - const gchar *key = MODEST_CONF_NAMESPACE "/teststring"; - const gchar *key2 = MODEST_CONF_NAMESPACE "/teststring2"; + const gchar *key = modest_defs_namespace ("/teststring"); + const gchar *key2 = modest_defs_namespace ("/teststring2"); gint data = 99, data2; @@ -159,6 +174,9 @@ modest_conf_suite (void) Suite *suite = suite_create ("ModestConf"); TCase *tc_core = tcase_create ("core"); + tcase_add_checked_fixture (tc_core, + fx_setup_modest_conf, + NULL); tcase_add_test (tc_core, test_modest_conf_new); tcase_add_test (tc_core, test_modest_conf_store_retrieve_string); tcase_add_test (tc_core, test_modest_conf_store_retrieve_bool); @@ -182,7 +200,7 @@ main () suite = modest_conf_suite (); srunner = srunner_create (suite); - srunner_run_all (srunner, CK_NORMAL); + srunner_run_all (srunner, CK_ENV); failures = srunner_ntests_failed (srunner); srunner_free (srunner);