[glib] More test coverage for settings backends



commit 3c873e7617695e8517deb1cfd1ee886af772135c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Dec 21 16:49:52 2013 -0500

    More test coverage for settings backends

 gio/tests/gsettings.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c
index d910b6d..17b76b3 100644
--- a/gio/tests/gsettings.c
+++ b/gio/tests/gsettings.c
@@ -1660,7 +1660,17 @@ test_keyfile (void)
   str = g_key_file_get_string (keyfile, "tests", "farewell", NULL);
   g_assert_cmpstr (str, ==, "'cheerio'");
   g_free (str);
+  g_key_file_free (keyfile);
 
+  g_settings_reset (settings, "greeting");
+  g_settings_apply (settings);
+  keyfile = g_key_file_new ();
+  g_assert (g_key_file_load_from_file (keyfile, "gsettings.store", 0, NULL));
+
+  str = g_key_file_get_string (keyfile, "tests", "greeting", NULL);
+  g_assert (str == NULL);
+
+  called = FALSE;
   g_signal_connect (settings, "changed::greeting", G_CALLBACK (key_changed_cb), &called);
 
   g_key_file_set_string (keyfile, "tests", "greeting", "howdy");
@@ -1670,6 +1680,13 @@ test_keyfile (void)
   while (!called)
     g_main_context_iteration (NULL, FALSE);
 
+  called = FALSE;
+  g_signal_connect (settings, "writable-changed::greeting", G_CALLBACK (key_changed_cb), &called);
+
+  g_chmod ("gsettings.store", 555);
+  while (!called)
+    g_main_context_iteration (NULL, FALSE);
+
   g_key_file_free (keyfile);
   g_free (data);
 


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