diff options
author | Ted Gould <ted@gould.cx> | 2010-12-02 15:57:09 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-12-02 15:57:09 -0600 |
commit | 68fd1cce05e05d738a82646b1c239f5a57a3fb76 (patch) | |
tree | c6ce652459bc05f417c7fbec88b82856609d82b7 /tests | |
parent | caf5eeb4cd8e00320345c9cf5d2afe864940702b (diff) | |
download | ayatana-indicator-application-68fd1cce05e05d738a82646b1c239f5a57a3fb76.tar.gz ayatana-indicator-application-68fd1cce05e05d738a82646b1c239f5a57a3fb76.tar.bz2 ayatana-indicator-application-68fd1cce05e05d738a82646b1c239f5a57a3fb76.zip |
Dropping the library tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 188 | ||||
-rw-r--r-- | tests/test-defines.h | 30 | ||||
-rw-r--r-- | tests/test-libappindicator-dbus-client.c | 292 | ||||
-rw-r--r-- | tests/test-libappindicator-dbus-server.c | 66 | ||||
-rw-r--r-- | tests/test-libappindicator-fallback-item.c | 153 | ||||
-rw-r--r-- | tests/test-libappindicator-fallback-watcher.c | 117 | ||||
-rw-r--r-- | tests/test-libappindicator-status-client.c | 153 | ||||
-rw-r--r-- | tests/test-libappindicator-status-server.c | 82 | ||||
-rw-r--r-- | tests/test-libappindicator.c | 320 | ||||
-rw-r--r-- | tests/test-simple-app.c | 54 |
10 files changed, 3 insertions, 1452 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index f2bdbb2..c012b96 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,14 +1,6 @@ check_PROGRAMS = \ - test-approver \ - test-libappindicator \ - test-libappindicator-dbus-client \ - test-libappindicator-dbus-server \ - test-libappindicator-status-client \ - test-libappindicator-status-server \ - test-libappindicator-fallback-watcher \ - test-libappindicator-fallback-item \ - test-simple-app + test-approver TESTS = DISTCLEANFILES = $(TESTS) @@ -16,90 +8,6 @@ DISTCLEANFILES = $(TESTS) EXTRA_DIST = run-xvfb.sh ######################################### -## test-libappindicator -######################################### - -test_libappindicator_SOURCES = \ - test-libappindicator.c - -test_libappindicator_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_libappindicator_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - -######################################### -## test-libappindicator-dbus-client -######################################### - -test_libappindicator_dbus_client_SOURCES = \ - test-defines.h \ - test-libappindicator-dbus-client.c - -test_libappindicator_dbus_client_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_libappindicator_dbus_client_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - -######################################### -## test-libappindicator-dbus-server -######################################### - -test_libappindicator_dbus_server_SOURCES = \ - test-defines.h \ - test-libappindicator-dbus-server.c - -test_libappindicator_dbus_server_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_libappindicator_dbus_server_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - -######################################### -## test-libappindicator-status-client -######################################### - -test_libappindicator_status_client_SOURCES = \ - test-defines.h \ - test-libappindicator-status-client.c - -test_libappindicator_status_client_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_libappindicator_status_client_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - -######################################### -## test-libappindicator-status-server -######################################### - -test_libappindicator_status_server_SOURCES = \ - test-defines.h \ - test-libappindicator-status-server.c - -test_libappindicator_status_server_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_libappindicator_status_server_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - -######################################### ## test-approver ######################################### @@ -108,12 +16,14 @@ test_approver_SOURCES = \ test_approver_CFLAGS = \ $(INDICATOR_CFLAGS) \ + $(TEST_CFLAGS) \ -Wall -Werror \ -I$(top_srcdir)/src \ -I$(top_builddir)/src test_approver_LDADD = \ $(INDICATOR_LIBS) \ + $(TEST_LIBS) \ $(top_builddir)/src/libappindicator.la test-approver-tester: test-approver Makefile.am @@ -126,95 +36,3 @@ test-approver-tester: test-approver Makefile.am TESTS += test-approver-tester -######################################### -## test-libappindicator-fallback -######################################### - -test_libappindicator_fallback_watcher_SOURCES = \ - test-libappindicator-fallback-watcher.c - -test_libappindicator_fallback_watcher_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_libappindicator_fallback_watcher_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - -test_libappindicator_fallback_item_SOURCES = \ - test-libappindicator-fallback-item.c - -test_libappindicator_fallback_item_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_libappindicator_fallback_item_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - -test-libappindicator-fallback: test-libappindicator-fallback-watcher test-libappindicator-fallback-item Makefile.am - @echo "#!/bin/bash" > $@ - @echo . $(srcdir)/run-xvfb.sh >> $@ - @echo $(DBUS_RUNNER) --task ./test-libappindicator-fallback-watcher --task-name Watcher --ignore-return --task ./test-libappindicator-fallback-item --task-name Item >> $@ - @chmod +x $@ - -TESTS += test-libappindicator-fallback - -######################################### -## Actual tests -######################################### - -XML_REPORT = libappindicator-check-results.xml -HTML_REPORT = libappindicator-check-results.html - -libappindicator-tests: libappindicator-tests-gtester Makefile.am - @echo "#!/bin/bash" > $@ - @echo . $(srcdir)/run-xvfb.sh >> $@ - @echo $(DBUS_RUNNER) --task ./libappindicator-tests-gtester >> $@ - @chmod +x $@ - -libappindicator-tests-gtester: test-libappindicator Makefile.am - @echo "#!/bin/sh" > $@ - @echo gtester -k --verbose -o=$(XML_REPORT) ./test-libappindicator >> $@ - @chmod +x $@ - -TESTS += libappindicator-tests -DISTCLEANFILES += $(XML_REPORT) $(HTML_REPORT) libappindicator-tests-gtester - - -DBUS_RUNNER=dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf - -test-libappindicator-dbus: test-libappindicator-dbus-client test-libappindicator-dbus-server Makefile.am - @echo "#!/bin/bash" > test-libappindicator-dbus - @echo . $(srcdir)/run-xvfb.sh >> $@ - @echo $(DBUS_RUNNER) --task ./test-libappindicator-dbus-client --task-name Client --task ./test-libappindicator-dbus-server --task-name Server --ignore-return >> test-libappindicator-dbus - @chmod +x test-libappindicator-dbus - -TESTS += test-libappindicator-dbus - -test-libappindicator-status: test-libappindicator-status-client test-libappindicator-status-server Makefile.am - @echo "#!/bin/bash" > test-libappindicator-status - @echo . $(srcdir)/run-xvfb.sh >> $@ - @echo $(DBUS_RUNNER) --task ./test-libappindicator-status-client --task-name Client --task ./test-libappindicator-status-server --task-name Server --ignore-return >> test-libappindicator-status - @chmod +x test-libappindicator-status - -TESTS += test-libappindicator-status - -######################################### -## test-simple-app -######################################### - -test_simple_app_SOURCES = \ - test-simple-app.c - -test_simple_app_CFLAGS = \ - $(INDICATOR_CFLAGS) \ - -Wall -Werror \ - -I$(top_srcdir)/src - -test_simple_app_LDADD = \ - $(INDICATOR_LIBS) \ - $(top_builddir)/src/libappindicator.la - diff --git a/tests/test-defines.h b/tests/test-defines.h deleted file mode 100644 index 2baf728..0000000 --- a/tests/test-defines.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -Testing defines to be shared between various tests. - -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 -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 -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#define TEST_ID "my-id" -#define TEST_ICON_NAME "my-icon-name" -#define TEST_ATTENTION_ICON_NAME "my-attention-icon-name" -#define TEST_STATE APP_INDICATOR_STATUS_ACTIVE -#define TEST_STATE_S "Active" -#define TEST_CATEGORY APP_INDICATOR_CATEGORY_APPLICATION_STATUS -#define TEST_CATEGORY_S "ApplicationStatus" -#define TEST_OBJECT "/an/object/path/to/use" - diff --git a/tests/test-libappindicator-dbus-client.c b/tests/test-libappindicator-dbus-client.c deleted file mode 100644 index 1500213..0000000 --- a/tests/test-libappindicator-dbus-client.c +++ /dev/null @@ -1,292 +0,0 @@ -/* -Tests for the libappindicator library that are over DBus. This is -the client side of those tests. - -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 -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 -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - - -#include <glib.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> -#include <dbus/dbus-glib-lowlevel.h> -#include <app-indicator.h> -#include "test-defines.h" - -#include "../src/dbus-shared.h" - -static GMainLoop * mainloop = NULL; -static gboolean passed = TRUE; -static int propcount = 0; - -static void -check_propcount (void) -{ - if (propcount >= 5) { - g_main_loop_quit(mainloop); - } - return; -} - - -static void -prop_id_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 ID failed: %s", error->message); - g_error_free(error); - passed = FALSE; - check_propcount(); - return; - } - - if (g_strcmp0(TEST_ID, g_value_get_string(&value))) { - g_debug("Property ID Returned: FAILED"); - passed = FALSE; - } else { - g_debug("Property ID Returned: PASSED"); - } - - check_propcount(); - return; -} - -static void -prop_category_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 category failed: %s", error->message); - g_error_free(error); - passed = FALSE; - check_propcount(); - return; - } - - if (g_strcmp0(TEST_CATEGORY_S, g_value_get_string(&value))) { - g_debug("Property category Returned: FAILED"); - passed = FALSE; - } else { - g_debug("Property category Returned: PASSED"); - } - - check_propcount(); - return; -} - -static void -prop_status_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 status failed: %s", error->message); - g_error_free(error); - passed = FALSE; - check_propcount(); - return; - } - - if (g_strcmp0(TEST_STATE_S, g_value_get_string(&value))) { - g_debug("Property status Returned: FAILED"); - passed = FALSE; - } else { - g_debug("Property status Returned: PASSED"); - } - - check_propcount(); - return; -} - -static void -prop_icon_name_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 icon name failed: %s", error->message); - g_error_free(error); - passed = FALSE; - check_propcount(); - return; - } - - if (g_strcmp0(TEST_ICON_NAME, g_value_get_string(&value))) { - g_debug("Property icon name Returned: FAILED"); - passed = FALSE; - } else { - g_debug("Property icon name Returned: PASSED"); - } - - check_propcount(); - return; -} - -static void -prop_attention_icon_name_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 attention icon name failed: %s", error->message); - g_error_free(error); - passed = FALSE; - check_propcount(); - return; - } - - if (g_strcmp0(TEST_ATTENTION_ICON_NAME, g_value_get_string(&value))) { - g_debug("Property attention icon name Returned: FAILED"); - passed = FALSE; - } else { - g_debug("Property attention icon name Returned: PASSED"); - } - - check_propcount(); - return; -} - -gboolean -kill_func (gpointer userdata) -{ - g_main_loop_quit(mainloop); - g_warning("Forced to Kill"); - passed = FALSE; - return FALSE; -} - -static DBusHandlerResult -dbus_filter (DBusConnection * connection, DBusMessage * message, void * user_data) -{ - if (dbus_message_is_method_call(message, NOTIFICATION_WATCHER_DBUS_ADDR, "RegisterStatusNotifierItem")) { - DBusMessage * reply = dbus_message_new_method_return(message); - dbus_connection_send(connection, reply, NULL); - dbus_message_unref(reply); - return DBUS_HANDLER_RESULT_HANDLED; - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - -gint -main (gint argc, gchar * argv[]) -{ - g_type_init(); - - g_usleep(500000); - - GError * error = NULL; - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (error != NULL) { - g_error("Unable to get session bus: %s", error->message); - return 1; - } - - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, NOTIFICATION_WATCHER_DBUS_ADDR, 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - - dbus_connection_add_filter(dbus_g_connection_get_connection(session_bus), dbus_filter, NULL, NULL); - - DBusGProxy * props = dbus_g_proxy_new_for_name_owner(session_bus, - ":1.0", - "/org/ayatana/NotificationItem/my_id", - DBUS_INTERFACE_PROPERTIES, - &error); - if (error != NULL) { - g_error("Unable to get property proxy: %s", error->message); - return 1; - } - - dbus_g_proxy_begin_call (props, - "Get", - prop_id_cb, - NULL, NULL, - G_TYPE_STRING, "org.ayatana.indicator.application.NotificationItem", - G_TYPE_STRING, "Id", - G_TYPE_INVALID); - dbus_g_proxy_begin_call (props, - "Get", - prop_category_cb, - NULL, NULL, - G_TYPE_STRING, "org.ayatana.indicator.application.NotificationItem", - G_TYPE_STRING, "Category", - G_TYPE_INVALID); - dbus_g_proxy_begin_call (props, - "Get", - prop_status_cb, - NULL, NULL, - G_TYPE_STRING, "org.ayatana.indicator.application.NotificationItem", - G_TYPE_STRING, "Status", - G_TYPE_INVALID); - dbus_g_proxy_begin_call (props, - "Get", - prop_icon_name_cb, - NULL, NULL, - G_TYPE_STRING, "org.ayatana.indicator.application.NotificationItem", - G_TYPE_STRING, "IconName", - G_TYPE_INVALID); - dbus_g_proxy_begin_call (props, - "Get", - prop_attention_icon_name_cb, - NULL, NULL, - G_TYPE_STRING, "org.ayatana.indicator.application.NotificationItem", - G_TYPE_STRING, "AttentionIconName", - G_TYPE_INVALID); - - g_timeout_add_seconds(2, kill_func, NULL); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - if (passed) { - g_debug("Quiting"); - return 0; - } else { - g_debug("Quiting as we're a failure"); - return 1; - } - return 0; -} diff --git a/tests/test-libappindicator-dbus-server.c b/tests/test-libappindicator-dbus-server.c deleted file mode 100644 index 995d49b..0000000 --- a/tests/test-libappindicator-dbus-server.c +++ /dev/null @@ -1,66 +0,0 @@ -/* -Tests for the libappindicator library that are over DBus. This is -the server side of those tests. - -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 -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 -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - - -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-lowlevel.h> -#include <gtk/gtk.h> -#include <app-indicator.h> -#include "test-defines.h" - -static GMainLoop * mainloop = NULL; - -gboolean -kill_func (gpointer userdata) -{ - g_main_loop_quit(mainloop); - return FALSE; -} - -gint -main (gint argc, gchar * argv[]) -{ - gtk_init(&argc, &argv); - - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, 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); - - GtkMenu * menu = GTK_MENU(gtk_menu_new()); - GtkMenuItem * item = GTK_MENU_ITEM(gtk_menu_item_new_with_label("Label")); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), GTK_WIDGET(item)); - - app_indicator_set_menu(ci, menu); - - g_timeout_add_seconds(2, kill_func, NULL); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - g_object_unref(G_OBJECT(ci)); - g_debug("Quiting"); - - return 0; -} diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c deleted file mode 100644 index 418b779..0000000 --- a/tests/test-libappindicator-fallback-item.c +++ /dev/null @@ -1,153 +0,0 @@ -#include <glib.h> -#include <glib-object.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> -#include <app-indicator.h> - -#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE (test_libappindicator_fallback_item_get_type ()) -#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItem)) -#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItemClass)) -#define IS_TEST_LIBAPPINDICATOR_FALLBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE)) -#define IS_TEST_LIBAPPINDICATOR_FALLBACK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE)) -#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItemClass)) - -typedef struct _TestLibappindicatorFallbackItem TestLibappindicatorFallbackItem; -typedef struct _TestLibappindicatorFallbackItemClass TestLibappindicatorFallbackItemClass; - -struct _TestLibappindicatorFallbackItemClass { - AppIndicatorClass parent_class; - -}; - -struct _TestLibappindicatorFallbackItem { - AppIndicator parent; - -}; - -GType test_libappindicator_fallback_item_get_type (void); - -#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItemPrivate)) - -static void test_libappindicator_fallback_item_class_init (TestLibappindicatorFallbackItemClass *klass); -static void test_libappindicator_fallback_item_init (TestLibappindicatorFallbackItem *self); -static GtkStatusIcon * fallback (AppIndicator * indicator); -static void unfallback (AppIndicator * indicator, GtkStatusIcon * status_icon); - -G_DEFINE_TYPE (TestLibappindicatorFallbackItem, test_libappindicator_fallback_item, APP_INDICATOR_TYPE); - -static void -test_libappindicator_fallback_item_class_init (TestLibappindicatorFallbackItemClass *klass) -{ - AppIndicatorClass * aiclass = APP_INDICATOR_CLASS(klass); - - aiclass->fallback = fallback; - aiclass->unfallback = unfallback; -} - -static void -test_libappindicator_fallback_item_init (TestLibappindicatorFallbackItem *self) -{ -} - -GMainLoop * mainloop = NULL; -gboolean passed = FALSE; - -enum { - STATE_INIT, - STATE_FALLBACK, - STATE_UNFALLBACK, - STATE_REFALLBACK, - STATE_REUNFALLBACK -}; - -gint state = STATE_INIT; - -static GtkStatusIcon * -fallback (AppIndicator * indicator) -{ - g_debug("Fallback"); - if (state == STATE_INIT) { - state = STATE_FALLBACK; - } else if (state == STATE_UNFALLBACK) { - state = STATE_REFALLBACK; - } else { - g_debug("Error, fallback in state: %d", state); - passed = FALSE; - } - return (GtkStatusIcon *)5; -} - -static void -unfallback (AppIndicator * indicator, GtkStatusIcon * status_icon) -{ - g_debug("Unfallback"); - if (state == STATE_FALLBACK) { - state = STATE_UNFALLBACK; - } else if (state == STATE_REFALLBACK) { - state = STATE_REUNFALLBACK; - passed = TRUE; - g_main_loop_quit(mainloop); - } else { - g_debug("Error, unfallback in state: %d", state); - passed = FALSE; - } - return; -} - -gboolean -kill_func (gpointer data) -{ - g_debug("Kill Function"); - g_main_loop_quit(mainloop); - return FALSE; -} - -int -main (int argc, char ** argv) -{ - gtk_init(&argc, &argv); - - GError * error = NULL; - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (error != NULL) { - g_error("Unable to get session bus: %s", error->message); - return 1; - } - - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, "org.test", 0, &nameret, NULL)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - - TestLibappindicatorFallbackItem * item = g_object_new(TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, - "id", "test-id", - "category", "Other", - "icon-name", "bob", - NULL); - - GtkWidget * menu = gtk_menu_new(); - app_indicator_set_menu(APP_INDICATOR(item), GTK_MENU(menu)); - - g_timeout_add_seconds(2, kill_func, NULL); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - g_object_unref(G_OBJECT(item)); - - if (passed) { - return 0; - } else { - return 1; - } -} diff --git a/tests/test-libappindicator-fallback-watcher.c b/tests/test-libappindicator-fallback-watcher.c deleted file mode 100644 index 5494082..0000000 --- a/tests/test-libappindicator-fallback-watcher.c +++ /dev/null @@ -1,117 +0,0 @@ -/* -This puts the NotificationWatcher on the bus, kinda. Enough to -trick the Item into unfalling back. - -Copyright 2010 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 -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 -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <glib.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> -#include <dbus/dbus-glib-lowlevel.h> - -#include "../src/dbus-shared.h" - -gboolean kill_func (gpointer userdata); - -static GMainLoop * mainloop = NULL; - -static DBusHandlerResult -dbus_filter (DBusConnection * connection, DBusMessage * message, void * user_data) -{ - if (dbus_message_is_method_call(message, NOTIFICATION_WATCHER_DBUS_ADDR, "RegisterStatusNotifierItem")) { - DBusMessage * reply = dbus_message_new_method_return(message); - dbus_connection_send(connection, reply, NULL); - dbus_message_unref(reply); - - /* Let the messages get out, but we're done at this point */ - g_timeout_add(50, kill_func, NULL); - - return DBUS_HANDLER_RESULT_HANDLED; - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - -gboolean -kill_func (gpointer userdata) -{ - g_main_loop_quit(mainloop); - return FALSE; -} - -int -main (int argv, char ** argc) -{ - g_type_init(); - - g_debug("Waiting to init."); - - - GError * error = NULL; - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (error != NULL) { - g_error("Unable to get session bus: %s", error->message); - return 1; - } - - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - - gboolean has_owner = FALSE; - gint owner_count = 0; - while (!has_owner && owner_count < 10000) { - org_freedesktop_DBus_name_has_owner(bus_proxy, "org.test", &has_owner, NULL); - owner_count++; - } - - if (owner_count == 10000) { - g_error("Unable to get name owner after 10000 tries"); - return 1; - } - - g_usleep(500000); - - g_debug("Initing"); - - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, NOTIFICATION_WATCHER_DBUS_ADDR, 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - - dbus_connection_add_filter(dbus_g_connection_get_connection(session_bus), dbus_filter, NULL, NULL); - - /* This is the final kill function. It really shouldn't happen - unless we get an error. */ - g_timeout_add(2000, kill_func, NULL); - - g_debug("Entering Mainloop"); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - g_debug("Exiting"); - - return 0; -} diff --git a/tests/test-libappindicator-status-client.c b/tests/test-libappindicator-status-client.c deleted file mode 100644 index 9e39ed8..0000000 --- a/tests/test-libappindicator-status-client.c +++ /dev/null @@ -1,153 +0,0 @@ -/* -Tests for the libappindicator library that are over DBus. This is -the client side of those tests. - -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 -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 -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - - -#include <glib.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> -#include <dbus/dbus-glib-lowlevel.h> -#include "../src/dbus-shared.h" - -static GMainLoop * mainloop = NULL; -static gboolean passed = TRUE; -static gboolean watchdog_hit = TRUE; -static gboolean active = FALSE; -static guint toggle_count = 0; - -#define PASSIVE_STR "Passive" -#define ACTIVE_STR "Active" -#define ATTN_STR "NeedsAttention" - -static DBusHandlerResult -dbus_reg_filter (DBusConnection * connection, DBusMessage * message, void * user_data) -{ - if (dbus_message_is_method_call(message, NOTIFICATION_WATCHER_DBUS_ADDR, "RegisterStatusNotifierItem")) { - DBusMessage * reply = dbus_message_new_method_return(message); - dbus_connection_send(connection, reply, NULL); - dbus_message_unref(reply); - return DBUS_HANDLER_RESULT_HANDLED; - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - - -static DBusHandlerResult -dbus_filter (DBusConnection * connection, DBusMessage * message, void * user_data) -{ - if (!dbus_message_is_signal(message, NOTIFICATION_ITEM_DBUS_IFACE, "NewStatus")) { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - - gchar * string; - - DBusError derror; - dbus_error_init(&derror); - if (!dbus_message_get_args(message, &derror, - DBUS_TYPE_STRING, &string, - DBUS_TYPE_INVALID)) { - g_warning("Couldn't get parameters"); - dbus_error_free(&derror); - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - - watchdog_hit = TRUE; - - if (g_strcmp0(string, ACTIVE_STR) == 0) { - if (active) { - g_warning("Got active when already active"); - passed = FALSE; - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - active = TRUE; - } else { - active = FALSE; - } - - toggle_count++; - - if (toggle_count == 100) { - g_main_loop_quit(mainloop); - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - -gboolean -kill_func (gpointer userdata) -{ - if (watchdog_hit == FALSE) { - g_main_loop_quit(mainloop); - g_warning("Forced to Kill"); - g_warning("Toggle count: %d", toggle_count); - passed = FALSE; - return FALSE; - } - watchdog_hit = FALSE; - return TRUE; -} - -gint -main (gint argc, gchar * argv[]) -{ - g_type_init(); - - GError * error = NULL; - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (error != NULL) { - g_error("Unable to get session bus: %s", error->message); - return 1; - } - - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, NOTIFICATION_WATCHER_DBUS_ADDR, 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - - dbus_connection_add_filter(dbus_g_connection_get_connection(session_bus), dbus_reg_filter, NULL, NULL); - - dbus_connection_add_filter(dbus_g_connection_get_connection(session_bus), dbus_filter, NULL, NULL); - dbus_bus_add_match(dbus_g_connection_get_connection(session_bus), "type='signal',interface='" NOTIFICATION_ITEM_DBUS_IFACE "',member='NewStatus'", NULL); - - watchdog_hit = TRUE; - g_timeout_add(1000, kill_func, NULL); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - if (passed) { - g_debug("Quiting"); - return 0; - } else { - g_debug("Quiting as we're a failure"); - return 1; - } - return 0; -} diff --git a/tests/test-libappindicator-status-server.c b/tests/test-libappindicator-status-server.c deleted file mode 100644 index 8cd5571..0000000 --- a/tests/test-libappindicator-status-server.c +++ /dev/null @@ -1,82 +0,0 @@ -/* -Tests for the libappindicator library that are over DBus. This is -the server side of those tests. - -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 -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 -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - - -#include <stdlib.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-lowlevel.h> -#include <glib.h> -#include <app-indicator.h> - -static GMainLoop * mainloop = NULL; -static gboolean active = FALSE; -static guint toggle_count = 0; - -gboolean -toggle (gpointer userdata) -{ - if (active) { - app_indicator_set_status (APP_INDICATOR(userdata), APP_INDICATOR_STATUS_ATTENTION); - active = FALSE; - } else { - app_indicator_set_status (APP_INDICATOR(userdata), APP_INDICATOR_STATUS_ACTIVE); - active = TRUE; - } - - toggle_count++; - - if (toggle_count == 100) { - g_main_loop_quit(mainloop); - return FALSE; - } - - return TRUE; -} - -gint -main (gint argc, gchar * argv[]) -{ - gtk_init(&argc, &argv); - - g_usleep(100000); - - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); - - AppIndicator * ci = app_indicator_new ("my-id", "my-icon-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - app_indicator_set_attention_icon (ci, "my-attention-icon"); - - GtkMenu * menu = GTK_MENU(gtk_menu_new()); - GtkMenuItem * item = GTK_MENU_ITEM(gtk_menu_item_new_with_label("Label")); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), GTK_WIDGET(item)); - - app_indicator_set_menu(ci, menu); - - g_timeout_add(50, toggle, ci); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - g_object_unref(G_OBJECT(ci)); - g_debug("Quiting"); - - return 0; -} diff --git a/tests/test-libappindicator.c b/tests/test-libappindicator.c deleted file mode 100644 index 8d12ac5..0000000 --- a/tests/test-libappindicator.c +++ /dev/null @@ -1,320 +0,0 @@ -/* -Tests for the libappindicator library. - -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 -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 -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - - -#include <glib.h> -#include <glib-object.h> - -#include <app-indicator.h> - -void -test_libappindicator_prop_signals_status_helper (AppIndicator * ci, gchar * status, gboolean * signalactivated) -{ - *signalactivated = TRUE; - return; -} - -void -test_libappindicator_prop_signals_helper (AppIndicator * ci, gboolean * signalactivated) -{ - *signalactivated = TRUE; - return; -} - -void -test_libappindicator_prop_signals (void) -{ - AppIndicator * ci = app_indicator_new ("test-app-indicator", - "indicator-messages", - APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - - g_assert(ci != NULL); - - gboolean signaled = FALSE; - gulong handlerid; - - handlerid = 0; - handlerid = g_signal_connect(G_OBJECT(ci), "new-icon", G_CALLBACK(test_libappindicator_prop_signals_helper), &signaled); - g_assert(handlerid != 0); - - handlerid = 0; - handlerid = g_signal_connect(G_OBJECT(ci), "new-attention-icon", G_CALLBACK(test_libappindicator_prop_signals_helper), &signaled); - g_assert(handlerid != 0); - - handlerid = 0; - handlerid = g_signal_connect(G_OBJECT(ci), "new-status", G_CALLBACK(test_libappindicator_prop_signals_status_helper), &signaled); - g_assert(handlerid != 0); - - - signaled = FALSE; - app_indicator_set_icon(ci, "bob"); - g_assert(signaled); - - signaled = FALSE; - app_indicator_set_icon(ci, "bob"); - g_assert(!signaled); - - signaled = FALSE; - app_indicator_set_icon(ci, "al"); - g_assert(signaled); - - - signaled = FALSE; - app_indicator_set_attention_icon(ci, "bob"); - g_assert(signaled); - - signaled = FALSE; - app_indicator_set_attention_icon(ci, "bob"); - g_assert(!signaled); - - signaled = FALSE; - app_indicator_set_attention_icon(ci, "al"); - g_assert(signaled); - - - signaled = FALSE; - app_indicator_set_status(ci, APP_INDICATOR_STATUS_PASSIVE); - g_assert(!signaled); - - signaled = FALSE; - app_indicator_set_status(ci, APP_INDICATOR_STATUS_ACTIVE); - g_assert(signaled); - - signaled = FALSE; - app_indicator_set_status(ci, APP_INDICATOR_STATUS_ACTIVE); - g_assert(!signaled); - - signaled = FALSE; - app_indicator_set_status(ci, APP_INDICATOR_STATUS_ATTENTION); - g_assert(signaled); - - return; -} - -void -test_libappindicator_init_set_props (void) -{ - AppIndicator * ci = app_indicator_new ("my-id", - "my-name", - APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - - g_assert(ci != NULL); - - app_indicator_set_status(ci, APP_INDICATOR_STATUS_ACTIVE); - app_indicator_set_attention_icon(ci, "my-attention-name"); - - g_assert(!g_strcmp0("my-id", app_indicator_get_id(ci))); - g_assert(!g_strcmp0("my-name", app_indicator_get_icon(ci))); - g_assert(!g_strcmp0("my-attention-name", app_indicator_get_attention_icon(ci))); - g_assert(app_indicator_get_status(ci) == APP_INDICATOR_STATUS_ACTIVE); - g_assert(app_indicator_get_category(ci) == APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - - g_object_unref(G_OBJECT(ci)); - return; -} - -void -test_libappindicator_init_with_props (void) -{ - 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))); - g_assert(!g_strcmp0("my-name", app_indicator_get_icon(ci))); - g_assert(!g_strcmp0("my-attention-name", app_indicator_get_attention_icon(ci))); - g_assert(app_indicator_get_status(ci) == APP_INDICATOR_STATUS_ACTIVE); - g_assert(app_indicator_get_category(ci) == APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - - g_object_unref(G_OBJECT(ci)); - return; -} - -void -test_libappindicator_init (void) -{ - 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; -} - -void -test_libappindicator_set_label (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); - - /* First check all the clearing modes, this is important as - we're going to use them later, we need them to work. */ - app_indicator_set_label(ci, NULL, NULL); - - g_assert(app_indicator_get_label(ci) == NULL); - g_assert(app_indicator_get_label_guide(ci) == NULL); - - app_indicator_set_label(ci, "", NULL); - - g_assert(app_indicator_get_label(ci) == NULL); - g_assert(app_indicator_get_label_guide(ci) == NULL); - - app_indicator_set_label(ci, NULL, ""); - - g_assert(app_indicator_get_label(ci) == NULL); - g_assert(app_indicator_get_label_guide(ci) == NULL); - - app_indicator_set_label(ci, "", ""); - - g_assert(app_indicator_get_label(ci) == NULL); - g_assert(app_indicator_get_label_guide(ci) == NULL); - - app_indicator_set_label(ci, "label", ""); - - g_assert(g_strcmp0(app_indicator_get_label(ci), "label") == 0); - g_assert(app_indicator_get_label_guide(ci) == NULL); - - app_indicator_set_label(ci, NULL, NULL); - - g_assert(app_indicator_get_label(ci) == NULL); - g_assert(app_indicator_get_label_guide(ci) == NULL); - - app_indicator_set_label(ci, "label", "guide"); - - g_assert(g_strcmp0(app_indicator_get_label(ci), "label") == 0); - g_assert(g_strcmp0(app_indicator_get_label_guide(ci), "guide") == 0); - - app_indicator_set_label(ci, "label2", "guide"); - - g_assert(g_strcmp0(app_indicator_get_label(ci), "label2") == 0); - g_assert(g_strcmp0(app_indicator_get_label_guide(ci), "guide") == 0); - - app_indicator_set_label(ci, "trick-label", "trick-guide"); - - g_assert(g_strcmp0(app_indicator_get_label(ci), "trick-label") == 0); - g_assert(g_strcmp0(app_indicator_get_label_guide(ci), "trick-guide") == 0); - - g_object_unref(G_OBJECT(ci)); - return; -} - -void -label_signals_cb (AppIndicator * appindicator, gchar * label, gchar * guide, gpointer user_data) -{ - gint * label_signals_count = (gint *)user_data; - (*label_signals_count)++; - return; -} - -void -label_signals_check (void) -{ - while (g_main_context_pending(NULL)) { - g_main_context_iteration(NULL, TRUE); - } - - return; -} - -void -test_libappindicator_label_signals (void) -{ - gint label_signals_count = 0; - 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); - - g_signal_connect(G_OBJECT(ci), APP_INDICATOR_SIGNAL_NEW_LABEL, G_CALLBACK(label_signals_cb), &label_signals_count); - - /* Shouldn't be a signal as it should be stuck in idle */ - app_indicator_set_label(ci, "label", "guide"); - g_assert(label_signals_count == 0); - - /* Should show up after idle processing */ - label_signals_check(); - g_assert(label_signals_count == 1); - - /* Shouldn't signal with no change */ - label_signals_count = 0; - app_indicator_set_label(ci, "label", "guide"); - label_signals_check(); - g_assert(label_signals_count == 0); - - /* Change one, we should get one signal */ - app_indicator_set_label(ci, "label2", "guide"); - label_signals_check(); - g_assert(label_signals_count == 1); - - /* Change several times, one signal */ - label_signals_count = 0; - app_indicator_set_label(ci, "label1", "guide0"); - app_indicator_set_label(ci, "label1", "guide1"); - app_indicator_set_label(ci, "label2", "guide2"); - app_indicator_set_label(ci, "label3", "guide3"); - label_signals_check(); - g_assert(label_signals_count == 1); - - /* Clear should signal too */ - label_signals_count = 0; - app_indicator_set_label(ci, NULL, NULL); - label_signals_check(); - g_assert(label_signals_count == 1); - - return; -} - -void -test_libappindicator_props_suite (void) -{ - g_test_add_func ("/indicator-application/libappindicator/init", test_libappindicator_init); - g_test_add_func ("/indicator-application/libappindicator/init_props", test_libappindicator_init_with_props); - g_test_add_func ("/indicator-application/libappindicator/init_set_props", test_libappindicator_init_set_props); - 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); - - return; -} - -gint -main (gint argc, gchar * argv[]) -{ - gtk_init(&argc, &argv); - g_test_init(&argc, &argv, NULL); - - /* Test suites */ - test_libappindicator_props_suite(); - - - return g_test_run (); -} diff --git a/tests/test-simple-app.c b/tests/test-simple-app.c deleted file mode 100644 index d60d9b9..0000000 --- a/tests/test-simple-app.c +++ /dev/null @@ -1,54 +0,0 @@ -/* -Test that creates a small test app which links with libappindicator. - -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 -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 -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -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 <app-indicator.h> - -static GMainLoop * mainloop = NULL; - -int -main (int argc, char ** argv) -{ - g_type_init(); - - DbusmenuServer * dms = dbusmenu_server_new("/menu"); - DbusmenuMenuitem * dmi = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(dmi, "label", "Bob"); - - AppIndicator * ci = APP_INDICATOR(g_object_new(APP_INDICATOR_TYPE, - "id", "test-application", - "status-enum", APP_INDICATOR_STATUS_ACTIVE, - "icon-name", "system-shutdown", - "menu-object", dms, - NULL)); - - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); - - g_object_unref(G_OBJECT(ci)); - g_debug("Quiting"); - - return 0; -} |