summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@redhat.com>2015-10-13 13:32:00 +0100
committerAlberto Ruiz <aruiz@redhat.com>2015-10-13 14:04:28 +0100
commit482194788a4f1ce65a4a1e6691a3d561576ddc10 (patch)
tree7bad3194f4c91dc8d697b524604552786b39b242
parent7d6a894e4912460019763b0e5cb7304ead30f4cb (diff)
downloaddconf-482194788a4f1ce65a4a1e6691a3d561576ddc10.tar.gz
engine: add test case to check if engine picks up $XDG_RUNTIME_DIR/dconf.profile as default profile in the abscence of DCONF_PROFILE
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/engine.c32
-rw-r--r--tests/profile/dconf.profile5
3 files changed, 39 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ec09941..3e21fb3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -91,7 +91,8 @@ EXTRA_DIST += \
profile/many-sources \
profile/no-newline-longline \
profile/test-profile \
- profile/will-never-exist
+ profile/will-never-exist \
+ profile/dconf.profile
TEST_PROGS += client
client_CFLAGS = $(gio_CFLAGS) -DSRCDIR=\"$(abs_srcdir)\"
diff --git a/tests/engine.c b/tests/engine.c
index 09e89c2..8ce9784 100644
--- a/tests/engine.c
+++ b/tests/engine.c
@@ -1737,6 +1737,37 @@ test_sync (void)
dconf_mock_shm_reset ();
}
+void
+test_runtime_dir_profile (void)
+{
+ DConfEngineSource **sources;
+ gint n_sources;
+
+ /* Check behaviour in the abscence of $DCONF_PROFILE */
+
+ const gchar *expected_names_a[5] = {"user", "one", "two", "three", "four"};
+ const gchar *expected_names_b[2] = {"user", "site"};
+
+ g_unsetenv ("DCONF_PROFILE");
+
+ filename_to_replace = "/RUNTIME/dconf.profile";
+ filename_to_replace_it_with = SRCDIR "/profile/dconf.profile";
+
+ sources = dconf_engine_profile_open (NULL, &n_sources);
+ verify_and_free (sources, n_sources, expected_names_a, 5);
+
+ /* Check behaviour in the presence of $DCONF_PROFILE */
+
+ g_setenv ("DCONF_PROFILE", SRCDIR "/profile/dos" , TRUE);
+
+ sources = dconf_engine_profile_open (NULL, &n_sources);
+ verify_and_free (sources, n_sources, expected_names_b, 2);
+
+ g_unsetenv ("DCONF_PROFILE");
+
+ filename_to_replace = NULL;
+ filename_to_replace_it_with = NULL;
+}
int
main (int argc, char **argv)
@@ -1762,6 +1793,7 @@ main (int argc, char **argv)
g_test_add_func ("/engine/change/sync", test_change_sync);
g_test_add_func ("/engine/signals", test_signals);
g_test_add_func ("/engine/sync", test_sync);
+ g_test_add_func ("/engine/runtime-dir-profile", test_runtime_dir_profile);
return g_test_run ();
}
diff --git a/tests/profile/dconf.profile b/tests/profile/dconf.profile
new file mode 100644
index 0000000..af55d12
--- /dev/null
+++ b/tests/profile/dconf.profile
@@ -0,0 +1,5 @@
+user-db:user
+system-db:one
+system-db:two
+system-db:three
+system-db:four