aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-01-06 10:32:54 -0600
committerTed Gould <ted@gould.cx>2011-01-06 10:32:54 -0600
commitbb9a2fed367273c305dc899c94e3a626779e5fd7 (patch)
treeefe388b61911c25f6303f8e04eb0c5bfe1d07ca5 /tests
parent13f405d76a1549715e153d5634dd82eb7dee0a82 (diff)
parentaa5fbb4484bf070d6569d6dbf17a250848a4d4ac (diff)
downloadlibdbusmenu-bb9a2fed367273c305dc899c94e3a626779e5fd7.tar.gz
libdbusmenu-bb9a2fed367273c305dc899c94e3a626779e5fd7.tar.bz2
libdbusmenu-bb9a2fed367273c305dc899c94e3a626779e5fd7.zip
* Upstream Merge
* Supporting removing properties
Diffstat (limited to 'tests')
-rw-r--r--tests/test-glib-objects.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c
index 7143814..9c99280 100644
--- a/tests/test-glib-objects.c
+++ b/tests/test-glib-objects.c
@@ -274,6 +274,37 @@ test_object_menuitem_props_boolstr (void)
return;
}
+/* Set and then remove a prop */
+static void
+test_object_menuitem_props_removal (void)
+{
+ /* Build a menu item */
+ DbusmenuMenuitem * item = dbusmenu_menuitem_new();
+
+ /* Test to make sure it's a happy object */
+ g_assert(item != NULL);
+
+ /* Set the property and ensure that it's set */
+ dbusmenu_menuitem_property_set_variant(item, "myprop", g_variant_new_int32(34));
+ g_assert(dbusmenu_menuitem_property_get_variant(item, "myprop") != NULL);
+
+ /* Remove the property and ensure it goes away */
+ dbusmenu_menuitem_property_set_variant(item, "myprop", NULL);
+ g_assert(dbusmenu_menuitem_property_get_variant(item, "myprop") == NULL);
+
+ /* Set the property again */
+ dbusmenu_menuitem_property_set_variant(item, "myprop", g_variant_new_int32(34));
+ g_assert(dbusmenu_menuitem_property_get_variant(item, "myprop") != NULL);
+
+ /* Remove the property with a NULL string */
+ dbusmenu_menuitem_property_set(item, "myprop", NULL);
+ g_assert(dbusmenu_menuitem_property_get_variant(item, "myprop") == NULL);
+
+ g_object_unref(item);
+
+ return;
+}
+
/* Build the test suite */
static void
test_glib_objects_suite (void)
@@ -286,6 +317,7 @@ test_glib_objects_suite (void)
g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_swap", test_object_menuitem_props_swap);
g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_signals", test_object_menuitem_props_signals);
g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_boolstr", test_object_menuitem_props_boolstr);
+ g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_removal", test_object_menuitem_props_removal);
return;
}