diff options
author | Ted Gould <ted@gould.cx> | 2010-02-04 21:40:32 -0800 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-02-04 21:40:32 -0800 |
commit | b43ae677fdd98a90e541212f22d752a3ba5c0877 (patch) | |
tree | a2d3d050c625d10497f164529b33e3239173c320 /tests | |
parent | 4accd480cff9980188aa3966f7cbeb5615b922d3 (diff) | |
download | libdbusmenu-b43ae677fdd98a90e541212f22d752a3ba5c0877.tar.gz libdbusmenu-b43ae677fdd98a90e541212f22d752a3ba5c0877.tar.bz2 libdbusmenu-b43ae677fdd98a90e541212f22d752a3ba5c0877.zip |
Checking the IDs from menuitems.
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); |