diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-libappindicator-dbus-client.c | 48 | ||||
-rw-r--r-- | tests/test-libappindicator-dbus-server.c | 25 | ||||
-rw-r--r-- | tests/test-libappindicator.c | 29 | ||||
-rw-r--r-- | tests/test-simple-app.c | 1 |
4 files changed, 33 insertions, 70 deletions
diff --git a/tests/test-libappindicator-dbus-client.c b/tests/test-libappindicator-dbus-client.c index 5b12920..8598f9a 100644 --- a/tests/test-libappindicator-dbus-client.c +++ b/tests/test-libappindicator-dbus-client.c @@ -7,16 +7,16 @@ Copyright 2009 Canonical Ltd. Authors: Ted Gould <ted@canonical.com> -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License along +You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -33,7 +33,7 @@ static int propcount = 0; static void check_propcount (void) { - if (propcount >= 6) { + if (propcount >= 5) { g_main_loop_quit(mainloop); } return; @@ -175,33 +175,6 @@ prop_attention_icon_name_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * d return; } -static void -prop_menu_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data) -{ - propcount++; - - GError * error = NULL; - GValue value = {0}; - - if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &value, G_TYPE_INVALID)) { - g_warning("Getting menu object failed: %s", error->message); - g_error_free(error); - passed = FALSE; - check_propcount(); - return; - } - - if (g_strcmp0(TEST_OBJECT, g_value_get_string(&value))) { - g_debug("Property menu object Returned: FAILED"); - passed = FALSE; - } else { - g_debug("Property menu object Returned: PASSED"); - } - - check_propcount(); - return; -} - gboolean kill_func (gpointer userdata) { @@ -270,13 +243,6 @@ main (gint argc, gchar * argv[]) G_TYPE_STRING, "org.ayatana.indicator.application.NotificationItem", G_TYPE_STRING, "AttentionIconName", G_TYPE_INVALID); - dbus_g_proxy_begin_call (props, - "Get", - prop_menu_cb, - NULL, NULL, - G_TYPE_STRING, "org.ayatana.indicator.application.NotificationItem", - G_TYPE_STRING, "Menu", - G_TYPE_INVALID); g_timeout_add_seconds(2, kill_func, NULL); diff --git a/tests/test-libappindicator-dbus-server.c b/tests/test-libappindicator-dbus-server.c index 6216c94..cc072aa 100644 --- a/tests/test-libappindicator-dbus-server.c +++ b/tests/test-libappindicator-dbus-server.c @@ -7,16 +7,16 @@ Copyright 2009 Canonical Ltd. Authors: Ted Gould <ted@canonical.com> -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License along +You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -43,16 +43,9 @@ main (gint argc, gchar * argv[]) g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); - DbusmenuServer * dms = dbusmenu_server_new(TEST_OBJECT); - - AppIndicator * ci = APP_INDICATOR(g_object_new(APP_INDICATOR_TYPE, - "id", TEST_ID, - "category-enum", TEST_CATEGORY, - "status-enum", TEST_STATE, - "icon-name", TEST_ICON_NAME, - "attention-icon-name", TEST_ATTENTION_ICON_NAME, - "menu-object", dms, - NULL)); + AppIndicator * ci = app_indicator_new (TEST_ID, TEST_ICON_NAME, TEST_CATEGORY); + app_indicator_set_status (ci, TEST_STATE); + app_indicator_set_attention_icon (ci, TEST_ATTENTION_ICON_NAME); g_timeout_add_seconds(2, kill_func, NULL); diff --git a/tests/test-libappindicator.c b/tests/test-libappindicator.c index 8b76d6e..896782d 100644 --- a/tests/test-libappindicator.c +++ b/tests/test-libappindicator.c @@ -42,7 +42,10 @@ test_libappindicator_prop_signals_helper (AppIndicator * ci, gboolean * signalac void test_libappindicator_prop_signals (void) { - AppIndicator * ci = APP_INDICATOR(g_object_new(APP_INDICATOR_TYPE, NULL)); + AppIndicator * ci = app_indicator_new ("test-app-indicator", + "indicator-messages", + APP_INDICATOR_CATEGORY_APPLICATION_STATUS); + g_assert(ci != NULL); gboolean signaled = FALSE; @@ -109,13 +112,13 @@ test_libappindicator_prop_signals (void) void test_libappindicator_init_set_props (void) { - AppIndicator * ci = APP_INDICATOR(g_object_new(APP_INDICATOR_TYPE, NULL)); + AppIndicator * ci = app_indicator_new ("my-id", + "my-name", + APP_INDICATOR_CATEGORY_APPLICATION_STATUS); + g_assert(ci != NULL); - app_indicator_set_id(ci, "my-id"); - app_indicator_set_category(ci, APP_INDICATOR_CATEGORY_APPLICATION_STATUS); app_indicator_set_status(ci, APP_INDICATOR_STATUS_ACTIVE); - app_indicator_set_icon(ci, "my-name"); app_indicator_set_attention_icon(ci, "my-attention-name"); g_assert(!g_strcmp0("my-id", app_indicator_get_id(ci))); @@ -131,13 +134,13 @@ test_libappindicator_init_set_props (void) void test_libappindicator_init_with_props (void) { - AppIndicator * ci = APP_INDICATOR(g_object_new(APP_INDICATOR_TYPE, - "id", "my-id", - "category-enum", APP_INDICATOR_CATEGORY_APPLICATION_STATUS, - "status-enum", APP_INDICATOR_STATUS_ACTIVE, - "icon-name", "my-name", - "attention-icon-name", "my-attention-name", - NULL)); + AppIndicator * ci = app_indicator_new ("my-id", + "my-name", + APP_INDICATOR_CATEGORY_APPLICATION_STATUS); + + app_indicator_set_status (ci, APP_INDICATOR_STATUS_ACTIVE); + app_indicator_set_attention_icon (ci, "my-attention-name"); + g_assert(ci != NULL); g_assert(!g_strcmp0("my-id", app_indicator_get_id(ci))); @@ -153,7 +156,7 @@ test_libappindicator_init_with_props (void) void test_libappindicator_init (void) { - AppIndicator * ci = APP_INDICATOR(g_object_new(APP_INDICATOR_TYPE, NULL)); + AppIndicator * ci = app_indicator_new ("my-id", "my-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); g_assert(ci != NULL); g_object_unref(G_OBJECT(ci)); return; diff --git a/tests/test-simple-app.c b/tests/test-simple-app.c index 60ed88f..f5957c8 100644 --- a/tests/test-simple-app.c +++ b/tests/test-simple-app.c @@ -23,6 +23,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> #include <glib.h> +#include <libdbusmenu-glib/server.h> #include <libappindicator/app-indicator.h> static GMainLoop * mainloop = NULL; |