*/
#include <check.h>
+#include <modest-defs.h>
#include <modest-conf.h>
+#include <gtk/gtk.h>
+#include <string.h>
+#include <modest-init.h>
+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)
{
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;
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;
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;
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);
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);