From aad192611ca84bfabc036658066ea584385f0982 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Nov 2010 22:21:11 -0600 Subject: Fleshing out a function to see if an invalid name results in no entries --- tests/test-libappindicator.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests') diff --git a/tests/test-libappindicator.c b/tests/test-libappindicator.c index 46460f0..cadf783 100644 --- a/tests/test-libappindicator.c +++ b/tests/test-libappindicator.c @@ -386,9 +386,34 @@ test_libappindicator_desktop_menu (void) void test_libappindicator_desktop_menu_bad (void) { + AppIndicator * ci = app_indicator_new ("my-id-desktop-menu-bad", + "my-name", + APP_INDICATOR_CATEGORY_APPLICATION_STATUS); + + g_assert(ci != NULL); + g_assert(app_indicator_get_label(ci) == NULL); + g_assert(app_indicator_get_label_guide(ci) == NULL); + + app_indicator_build_menu_from_desktop(ci, SRCDIR "/test-libappindicator.desktop", "Not Test Program"); + + GValue serverval = {0}; + g_value_init(&serverval, DBUSMENU_TYPE_SERVER); + g_object_get_property(G_OBJECT(ci), "dbus-menu-server", &serverval); + DbusmenuServer * server = DBUSMENU_SERVER(g_value_get_object(&serverval)); + g_assert(server != NULL); + GValue rootval = {0}; + g_value_init(&rootval, DBUSMENU_TYPE_MENUITEM); + g_object_get_property(G_OBJECT(server), DBUSMENU_SERVER_PROP_ROOT_NODE, &rootval); + DbusmenuMenuitem * root = DBUSMENU_MENUITEM(g_value_get_object(&rootval)); + g_assert(root != NULL); + + GList * children = dbusmenu_menuitem_get_children(root); + g_assert(g_list_length(children) == 0); + g_object_unref(G_OBJECT(ci)); + return; } void -- cgit v1.2.3