diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-glib-objects.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index f3fbcc8..1d4f673 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -47,6 +47,30 @@ test_object_menuitem (void) return; } +/* Check to make sure a new ID is bigger than 0 */ +static void +test_object_menuitem_id (void) +{ + /* Build a menu item */ + DbusmenuMenuitem * item = dbusmenu_menuitem_new(); + + /* Test to make sure it's a happy object */ + g_assert(item != NULL); + g_assert(G_IS_OBJECT(item)); + g_assert(DBUSMENU_IS_MENUITEM(item)); + + g_assert(dbusmenu_menuitem_get_id(item) > 0); + + /* Set up a check to make sure it gets destroyed on unref */ + g_object_add_weak_pointer(G_OBJECT(item), (gpointer *)&item); + g_object_unref(item); + + /* Did it go away? */ + g_assert(item == NULL); + + return; +} + /* Set a string prop, make sure it's stored as one */ static void test_object_menuitem_props_string (void) @@ -255,6 +279,7 @@ static void test_glib_objects_suite (void) { g_test_add_func ("/dbusmenu/glib/objects/menuitem/base", test_object_menuitem); + g_test_add_func ("/dbusmenu/glib/objects/menuitem/id", test_object_menuitem_id); g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_string", test_object_menuitem_props_string); g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_int", test_object_menuitem_props_int); g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_bool", test_object_menuitem_props_bool); |