summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2012-07-06 16:39:51 -0400
committerRyan Lortie <desrt@desrt.ca>2012-07-06 16:39:51 -0400
commit6446f68be122c988af772fa878861db7fb250379 (patch)
treeb5121c0dad1d9cc3dd6c2b0086a74dc9569e8db1 /tests
parent0f5906d6491444dbe90de806b0e73a4f83078785 (diff)
downloaddconf-6446f68be122c988af772fa878861db7fb250379.tar.gz
tests/: check changeset reset functionality
Diffstat (limited to 'tests')
-rw-r--r--tests/changeset.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/changeset.c b/tests/changeset.c
index 687feff..c5ee932 100644
--- a/tests/changeset.c
+++ b/tests/changeset.c
@@ -277,6 +277,45 @@ test_describe (void)
dconf_changeset_unref (changeset);
}
+static void
+test_reset (void)
+{
+ DConfChangeset *changeset;
+
+ changeset = dconf_changeset_new ();
+ g_assert (!dconf_changeset_get (changeset, "/value/a", NULL));
+
+ /* set a value */
+ dconf_changeset_set (changeset, "/value/a", g_variant_new_boolean (TRUE));
+ g_assert (dconf_changeset_get (changeset, "/value/a", NULL));
+
+ /* record the reset */
+ dconf_changeset_set (changeset, "/value/", NULL);
+ g_assert (!dconf_changeset_get (changeset, "/value/a", NULL));
+
+ /* write it back */
+ dconf_changeset_set (changeset, "/value/a", g_variant_new_boolean (TRUE));
+ g_assert (dconf_changeset_get (changeset, "/value/a", NULL));
+
+ /* reset again */
+ dconf_changeset_set (changeset, "/value/", NULL);
+ g_assert (!dconf_changeset_get (changeset, "/value/a", NULL));
+
+ /* write again */
+ dconf_changeset_set (changeset, "/value/a", g_variant_new_boolean (TRUE));
+ g_assert (dconf_changeset_get (changeset, "/value/a", NULL));
+
+ /* reset a different way */
+ dconf_changeset_set (changeset, "/value/a", g_variant_new_boolean (TRUE));
+ g_assert (dconf_changeset_get (changeset, "/value/a", NULL));
+
+ /* write last time */
+ dconf_changeset_set (changeset, "/value/a", g_variant_new_boolean (TRUE));
+ g_assert (dconf_changeset_get (changeset, "/value/a", NULL));
+
+ dconf_changeset_unref (changeset);
+}
+
int
main (int argc, char **argv)
{
@@ -285,6 +324,7 @@ main (int argc, char **argv)
g_test_add_func ("/changeset/basic", test_basic);
g_test_add_func ("/changeset/similarity", test_similarity);
g_test_add_func ("/changeset/describe", test_describe);
+ g_test_add_func ("/changeset/reset", test_reset);
return g_test_run ();
}