From 8d9b6e921d45ba5f4153e7c1fd784eef64c3d80e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 8 Nov 2010 11:47:52 -0500 Subject: Adding in a couple of desktop tests --- tests/test-libappindicator.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/test-libappindicator.c') diff --git a/tests/test-libappindicator.c b/tests/test-libappindicator.c index 8d12ac5..202c5e1 100644 --- a/tests/test-libappindicator.c +++ b/tests/test-libappindicator.c @@ -291,6 +291,22 @@ test_libappindicator_label_signals (void) g_assert(label_signals_count == 1); return; +} + +void +test_libappindicator_desktop_menu (void) +{ + + + +} + +void +test_libappindicator_desktop_menu_bad (void) +{ + + + } void @@ -302,6 +318,8 @@ test_libappindicator_props_suite (void) g_test_add_func ("/indicator-application/libappindicator/prop_signals", test_libappindicator_prop_signals); g_test_add_func ("/indicator-application/libappindicator/set_label", test_libappindicator_set_label); g_test_add_func ("/indicator-application/libappindicator/label_signals", test_libappindicator_label_signals); + g_test_add_func ("/indicator-application/libappindicator/desktop_menu", test_libappindicator_desktop_menu); + g_test_add_func ("/indicator-application/libappindicator/desktop_menu_bad",test_libappindicator_desktop_menu_bad); return; } -- cgit v1.2.3 From 52c706605c23a2b3b06e5f4262d5ea1ab1577567 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 8 Nov 2010 12:10:46 -0500 Subject: Adding a test to check the number of items in the desktop file --- tests/test-libappindicator.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/test-libappindicator.c') diff --git a/tests/test-libappindicator.c b/tests/test-libappindicator.c index 202c5e1..f340a67 100644 --- a/tests/test-libappindicator.c +++ b/tests/test-libappindicator.c @@ -296,9 +296,26 @@ test_libappindicator_label_signals (void) void test_libappindicator_desktop_menu (void) { + AppIndicator * ci = app_indicator_new ("my-id", + "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", "Test Program"); + GtkMenu * menu = app_indicator_get_menu(ci); + g_assert(menu != NULL); + + GList * children = gtk_container_get_children(GTK_CONTAINER(menu)); + g_assert(children != NULL); + g_assert(g_list_length(children) == 3); + + g_object_unref(G_OBJECT(ci)); + + return; } void -- cgit v1.2.3 From d089c385b260d54d7521c277ebc875a3017d7f96 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Nov 2010 21:25:00 -0600 Subject: Switching to be dbusmenu based instead of GTK menu based --- tests/test-libappindicator.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'tests/test-libappindicator.c') diff --git a/tests/test-libappindicator.c b/tests/test-libappindicator.c index 82f3d05..00a8f19 100644 --- a/tests/test-libappindicator.c +++ b/tests/test-libappindicator.c @@ -353,15 +353,26 @@ test_libappindicator_desktop_menu (void) app_indicator_build_menu_from_desktop(ci, SRCDIR "/test-libappindicator.desktop", "Test Program"); - GtkMenu * menu = app_indicator_get_menu(ci); - g_assert(menu != NULL); + 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 = gtk_container_get_children(GTK_CONTAINER(menu)); + GList * children = dbusmenu_menuitem_get_children(root); g_assert(children != NULL); g_assert(g_list_length(children) == 3); - g_object_unref(G_OBJECT(ci)); + + g_object_unref(G_OBJECT(ci)); return; } -- cgit v1.2.3 From ca62d8c2fa745e4d033a9b6c79b146b1bbb86a2f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Nov 2010 22:18:55 -0600 Subject: Changing the ID to ensure we get different paths --- tests/test-libappindicator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test-libappindicator.c') diff --git a/tests/test-libappindicator.c b/tests/test-libappindicator.c index 3860b69..46460f0 100644 --- a/tests/test-libappindicator.c +++ b/tests/test-libappindicator.c @@ -350,7 +350,7 @@ test_libappindicator_label_signals (void) void test_libappindicator_desktop_menu (void) { - AppIndicator * ci = app_indicator_new ("my-id", + AppIndicator * ci = app_indicator_new ("my-id-desktop-menu", "my-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); -- cgit v1.2.3 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/test-libappindicator.c') 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