diff options
author | Ted Gould <ted@gould.cx> | 2011-01-05 20:47:09 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-01-05 20:47:09 -0600 |
commit | e5f53f91d929c46914b4a02336e31724fb54ec95 (patch) | |
tree | af4cc814cda03176e7500207e4ef7f1fab0865b6 /tests | |
parent | 2597a9ea2a74a8390c0f46ea1518d493608aea19 (diff) | |
download | libdbusmenu-e5f53f91d929c46914b4a02336e31724fb54ec95.tar.gz libdbusmenu-e5f53f91d929c46914b4a02336e31724fb54ec95.tar.bz2 libdbusmenu-e5f53f91d929c46914b4a02336e31724fb54ec95.zip |
Adding a test to test removing of properties
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-glib-objects.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index 7143814..2c8eda9 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -274,6 +274,29 @@ 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); + + g_object_unref(item); + + return; +} + /* Build the test suite */ static void test_glib_objects_suite (void) @@ -286,6 +309,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; } |