[dconf/wip/peruserprofile: 4/5] engine: add test case to check if engine picks up $XDG_RUNTIME_DIR/dconf.profile as default profile
- From: Alberto Ruiz <aruiz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf/wip/peruserprofile: 4/5] engine: add test case to check if engine picks up $XDG_RUNTIME_DIR/dconf.profile as default profile
- Date: Wed, 14 Oct 2015 17:07:58 +0000 (UTC)
commit 482194788a4f1ce65a4a1e6691a3d561576ddc10
Author: Alberto Ruiz <aruiz redhat com>
Date: Tue Oct 13 13:32:00 2015 +0100
engine: add test case to check if engine picks up $XDG_RUNTIME_DIR/dconf.profile as default profile in
the abscence of DCONF_PROFILE
tests/Makefile.am | 3 ++-
tests/engine.c | 32 ++++++++++++++++++++++++++++++++
tests/profile/dconf.profile | 5 +++++
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]