diff options
author | Ted Gould <ted@gould.cx> | 2011-01-06 10:25:47 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-01-06 10:25:47 -0600 |
commit | 2e714ba91c9f2d2baf081d3725bf1634bcf68fe2 (patch) | |
tree | e66d785189401b6e6229f6aec623e0b4e867e4bd /tests | |
parent | 2597a9ea2a74a8390c0f46ea1518d493608aea19 (diff) | |
parent | 1b77b621285fe681ca030bf3f548ad04b50dd242 (diff) | |
download | libdbusmenu-2e714ba91c9f2d2baf081d3725bf1634bcf68fe2.tar.gz libdbusmenu-2e714ba91c9f2d2baf081d3725bf1634bcf68fe2.tar.bz2 libdbusmenu-2e714ba91c9f2d2baf081d3725bf1634bcf68fe2.zip |
Allow removing properties with NULL variants or strings.
Diffstat (limited to 'tests')
-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; } |