diff options
author | Ted Gould <ted@gould.cx> | 2011-01-05 21:25:15 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-01-05 21:25:15 -0600 |
commit | 7d5b031a5540fa8bd12784bad16472d9da19e45b (patch) | |
tree | 064d0cb96b6b6fb4e760fdda979e3ed65fff28f3 /tests/test-glib-objects.c | |
parent | 9b52fc3b27335fa6b7582c7a25bb1a39532ece05 (diff) | |
parent | 1b77b621285fe681ca030bf3f548ad04b50dd242 (diff) | |
download | libdbusmenu-7d5b031a5540fa8bd12784bad16472d9da19e45b.tar.gz libdbusmenu-7d5b031a5540fa8bd12784bad16472d9da19e45b.tar.bz2 libdbusmenu-7d5b031a5540fa8bd12784bad16472d9da19e45b.zip |
* Upstream Merge
* Supporting removing properties
Diffstat (limited to 'tests/test-glib-objects.c')
-rw-r--r-- | tests/test-glib-objects.c | 32 |
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; } |