diff options
author | Ted Gould <ted@gould.cx> | 2009-11-30 13:28:20 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2009-11-30 13:28:20 -0600 |
commit | 44be8d22131ab3f6e2b4173da2af1dc5194919a8 (patch) | |
tree | b246e31d89f79defb4d3f2e8ba26a7c716e6f816 /tests | |
parent | f23c54ff5fee5587c31ecb8bf176b58fa3d4be1d (diff) | |
parent | f0881be3b8f779e0411958e6637f8f29e5697cbb (diff) | |
download | libayatana-appindicator-44be8d22131ab3f6e2b4173da2af1dc5194919a8.tar.gz libayatana-appindicator-44be8d22131ab3f6e2b4173da2af1dc5194919a8.tar.bz2 libayatana-appindicator-44be8d22131ab3f6e2b4173da2af1dc5194919a8.zip |
Getting the right named files.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 85 | ||||
-rw-r--r-- | tests/test-defines.h | 4 | ||||
-rw-r--r-- | tests/test-libappindicator-dbus-client.c (renamed from tests/test-libcustomindicator-dbus-client.c) | 14 | ||||
-rw-r--r-- | tests/test-libappindicator-dbus-server.c | 44 | ||||
-rw-r--r-- | tests/test-libappindicator.c | 163 | ||||
-rw-r--r-- | tests/test-libcustomindicator-dbus-server.c | 44 | ||||
-rw-r--r-- | tests/test-libcustomindicator.c | 163 | ||||
-rw-r--r-- | tests/test-simple-app.c | 32 |
8 files changed, 299 insertions, 250 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index dfdb397..845b41c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,89 +1,106 @@ check_PROGRAMS = \ - test-libcustomindicator \ - test-libcustomindicator-dbus-client \ - test-libcustomindicator-dbus-server + test-libappindicator \ + test-libappindicator-dbus-client \ + test-libappindicator-dbus-server \ + test-simple-app TESTS = DISTCLEANFILES = $(TESTS) ######################################### -## test-libcustomindicator +## test-libappindicator ######################################### -test_libcustomindicator_SOURCES = \ - test-libcustomindicator.c +test_libappindicator_SOURCES = \ + test-libappindicator.c -test_libcustomindicator_CFLAGS = \ +test_libappindicator_CFLAGS = \ $(INDICATOR_CFLAGS) \ -Wall -Werror \ -I$(top_srcdir)/src -test_libcustomindicator_LDADD = \ +test_libappindicator_LDADD = \ $(INDICATOR_LIBS) \ - $(top_builddir)/src/libcustomindicator.la + $(top_builddir)/src/libappindicator.la ######################################### -## test-libcustomindicator-dbus-client +## test-libappindicator-dbus-client ######################################### -test_libcustomindicator_dbus_client_SOURCES = \ +test_libappindicator_dbus_client_SOURCES = \ test-defines.h \ - test-libcustomindicator-dbus-client.c + test-libappindicator-dbus-client.c -test_libcustomindicator_dbus_client_CFLAGS = \ +test_libappindicator_dbus_client_CFLAGS = \ $(INDICATOR_CFLAGS) \ -Wall -Werror \ -I$(top_srcdir)/src -test_libcustomindicator_dbus_client_LDADD = \ +test_libappindicator_dbus_client_LDADD = \ $(INDICATOR_LIBS) \ - $(top_builddir)/src/libcustomindicator.la + $(top_builddir)/src/libappindicator.la ######################################### -## test-libcustomindicator-dbus-server +## test-libappindicator-dbus-server ######################################### -test_libcustomindicator_dbus_server_SOURCES = \ +test_libappindicator_dbus_server_SOURCES = \ test-defines.h \ - test-libcustomindicator-dbus-server.c + test-libappindicator-dbus-server.c -test_libcustomindicator_dbus_server_CFLAGS = \ +test_libappindicator_dbus_server_CFLAGS = \ $(INDICATOR_CFLAGS) \ -Wall -Werror \ -I$(top_srcdir)/src -test_libcustomindicator_dbus_server_LDADD = \ +test_libappindicator_dbus_server_LDADD = \ $(INDICATOR_LIBS) \ - $(top_builddir)/src/libcustomindicator.la + $(top_builddir)/src/libappindicator.la ######################################### ## Actual tests ######################################### -XML_REPORT = libcustomindicator-check-results.xml -HTML_REPORT = libcustomindicator-check-results.html +XML_REPORT = libappindicator-check-results.xml +HTML_REPORT = libappindicator-check-results.html -libcustomindicator-tests: libcustomindicator-tests-gtester Makefile.am +libappindicator-tests: libappindicator-tests-gtester Makefile.am @echo "#!/bin/sh" > $@ - @echo $(DBUS_RUNNER) --task ./libcustomindicator-tests-gtester >> $@ + @echo $(DBUS_RUNNER) --task ./libappindicator-tests-gtester >> $@ @chmod +x $@ -libcustomindicator-tests-gtester: test-libcustomindicator Makefile.am +libappindicator-tests-gtester: test-libappindicator Makefile.am @echo "#!/bin/sh" > $@ - @echo gtester -k --verbose -o=$(XML_REPORT) ./test-libcustomindicator >> $@ + @echo gtester -k --verbose -o=$(XML_REPORT) ./test-libappindicator >> $@ @chmod +x $@ -TESTS += libcustomindicator-tests -DISTCLEANFILES += $(XML_REPORT) $(HTML_REPORT) libcustomindicator-tests-gtester +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-libcustomindicator-dbus: test-libcustomindicator-dbus-client test-libcustomindicator-dbus-server Makefile.am - @echo "#!/bin/sh" > test-libcustomindicator-dbus - @echo $(DBUS_RUNNER) --task ./test-libcustomindicator-dbus-client --task-name Client --task ./test-libcustomindicator-dbus-server --task-name Server --ignore-return >> test-libcustomindicator-dbus - @chmod +x test-libcustomindicator-dbus +test-libappindicator-dbus: test-libappindicator-dbus-client test-libappindicator-dbus-server Makefile.am + @echo "#!/bin/sh" > test-libappindicator-dbus + @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-libcustomindicator-dbus +TESTS += test-libappindicator-dbus + +######################################### +## 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 index 9d1fc26..11e7a24 100644 --- a/tests/test-defines.h +++ b/tests/test-defines.h @@ -2,9 +2,9 @@ #define TEST_ID "my-id" #define TEST_ICON_NAME "my-icon-name" #define TEST_ATTENTION_ICON_NAME "my-attention-icon-name" -#define TEST_STATE CUSTOM_INDICATOR_STATUS_ACTIVE +#define TEST_STATE APP_INDICATOR_STATUS_ACTIVE #define TEST_STATE_S "active" -#define TEST_CATEGORY CUSTOM_INDICATOR_CATEGORY_APPLICATION_STATUS +#define TEST_CATEGORY APP_INDICATOR_CATEGORY_APPLICATION_STATUS #define TEST_CATEGORY_S "application-status" #define TEST_OBJECT "/an/object/path/to/use" diff --git a/tests/test-libcustomindicator-dbus-client.c b/tests/test-libappindicator-dbus-client.c index e0203c0..f8ed4b3 100644 --- a/tests/test-libcustomindicator-dbus-client.c +++ b/tests/test-libappindicator-dbus-client.c @@ -1,7 +1,7 @@ #include <glib.h> #include <dbus/dbus-glib.h> -#include <libcustomindicator/custom-indicator.h> +#include <libappindicator/app-indicator.h> #include "test-defines.h" static GMainLoop * mainloop = NULL; @@ -217,42 +217,42 @@ main (gint argc, gchar * argv[]) "Get", prop_id_cb, NULL, NULL, - G_TYPE_STRING, "org.ayatana.indicator.custom.NotificationItem", + 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.custom.NotificationItem", + 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.custom.NotificationItem", + 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.custom.NotificationItem", + 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.custom.NotificationItem", + 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.custom.NotificationItem", + G_TYPE_STRING, "org.ayatana.indicator.application.NotificationItem", G_TYPE_STRING, "Menu", G_TYPE_INVALID); diff --git a/tests/test-libappindicator-dbus-server.c b/tests/test-libappindicator-dbus-server.c new file mode 100644 index 0000000..f7b8d9f --- /dev/null +++ b/tests/test-libappindicator-dbus-server.c @@ -0,0 +1,44 @@ + +#include <dbus/dbus-glib.h> +#include <dbus/dbus-glib-lowlevel.h> +#include <glib.h> +#include <libappindicator/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[]) +{ + g_type_init(); + + 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)); + + 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.c b/tests/test-libappindicator.c new file mode 100644 index 0000000..1d7c920 --- /dev/null +++ b/tests/test-libappindicator.c @@ -0,0 +1,163 @@ + +#include <glib.h> +#include <glib-object.h> + +#include <libappindicator/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(g_object_new(APP_INDICATOR_TYPE, NULL)); + 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(g_object_new(APP_INDICATOR_TYPE, NULL)); + 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))); + 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(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)); + 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(g_object_new(APP_INDICATOR_TYPE, NULL)); + g_assert(ci != NULL); + g_object_unref(G_OBJECT(ci)); + 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); + + return; +} + +gint +main (gint argc, gchar * argv[]) +{ + g_type_init(); + g_test_init(&argc, &argv, NULL); + + /* Test suites */ + test_libappindicator_props_suite(); + + + return g_test_run (); +} diff --git a/tests/test-libcustomindicator-dbus-server.c b/tests/test-libcustomindicator-dbus-server.c deleted file mode 100644 index 2d61776..0000000 --- a/tests/test-libcustomindicator-dbus-server.c +++ /dev/null @@ -1,44 +0,0 @@ - -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-lowlevel.h> -#include <glib.h> -#include <libcustomindicator/custom-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[]) -{ - g_type_init(); - - 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); - - CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_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)); - - 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-libcustomindicator.c b/tests/test-libcustomindicator.c deleted file mode 100644 index c4342e8..0000000 --- a/tests/test-libcustomindicator.c +++ /dev/null @@ -1,163 +0,0 @@ - -#include <glib.h> -#include <glib-object.h> - -#include <libcustomindicator/custom-indicator.h> - -void -test_libcustomindicator_prop_signals_status_helper (CustomIndicator * ci, gchar * status, gboolean * signalactivated) -{ - *signalactivated = TRUE; - return; -} - -void -test_libcustomindicator_prop_signals_helper (CustomIndicator * ci, gboolean * signalactivated) -{ - *signalactivated = TRUE; - return; -} - -void -test_libcustomindicator_prop_signals (void) -{ - CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_INDICATOR_TYPE, NULL)); - g_assert(ci != NULL); - - gboolean signaled = FALSE; - gulong handlerid; - - handlerid = 0; - handlerid = g_signal_connect(G_OBJECT(ci), "new-icon", G_CALLBACK(test_libcustomindicator_prop_signals_helper), &signaled); - g_assert(handlerid != 0); - - handlerid = 0; - handlerid = g_signal_connect(G_OBJECT(ci), "new-attention-icon", G_CALLBACK(test_libcustomindicator_prop_signals_helper), &signaled); - g_assert(handlerid != 0); - - handlerid = 0; - handlerid = g_signal_connect(G_OBJECT(ci), "new-status", G_CALLBACK(test_libcustomindicator_prop_signals_status_helper), &signaled); - g_assert(handlerid != 0); - - - signaled = FALSE; - custom_indicator_set_icon(ci, "bob"); - g_assert(signaled); - - signaled = FALSE; - custom_indicator_set_icon(ci, "bob"); - g_assert(!signaled); - - signaled = FALSE; - custom_indicator_set_icon(ci, "al"); - g_assert(signaled); - - - signaled = FALSE; - custom_indicator_set_attention_icon(ci, "bob"); - g_assert(signaled); - - signaled = FALSE; - custom_indicator_set_attention_icon(ci, "bob"); - g_assert(!signaled); - - signaled = FALSE; - custom_indicator_set_attention_icon(ci, "al"); - g_assert(signaled); - - - signaled = FALSE; - custom_indicator_set_status(ci, CUSTOM_INDICATOR_STATUS_PASSIVE); - g_assert(!signaled); - - signaled = FALSE; - custom_indicator_set_status(ci, CUSTOM_INDICATOR_STATUS_ACTIVE); - g_assert(signaled); - - signaled = FALSE; - custom_indicator_set_status(ci, CUSTOM_INDICATOR_STATUS_ACTIVE); - g_assert(!signaled); - - signaled = FALSE; - custom_indicator_set_status(ci, CUSTOM_INDICATOR_STATUS_ATTENTION); - g_assert(signaled); - - return; -} - -void -test_libcustomindicator_init_set_props (void) -{ - CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_INDICATOR_TYPE, NULL)); - g_assert(ci != NULL); - - custom_indicator_set_id(ci, "my-id"); - custom_indicator_set_category(ci, CUSTOM_INDICATOR_CATEGORY_APPLICATION_STATUS); - custom_indicator_set_status(ci, CUSTOM_INDICATOR_STATUS_ACTIVE); - custom_indicator_set_icon(ci, "my-name"); - custom_indicator_set_attention_icon(ci, "my-attention-name"); - - g_assert(!g_strcmp0("my-id", custom_indicator_get_id(ci))); - g_assert(!g_strcmp0("my-name", custom_indicator_get_icon(ci))); - g_assert(!g_strcmp0("my-attention-name", custom_indicator_get_attention_icon(ci))); - g_assert(custom_indicator_get_status(ci) == CUSTOM_INDICATOR_STATUS_ACTIVE); - g_assert(custom_indicator_get_category(ci) == CUSTOM_INDICATOR_CATEGORY_APPLICATION_STATUS); - - g_object_unref(G_OBJECT(ci)); - return; -} - -void -test_libcustomindicator_init_with_props (void) -{ - CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_INDICATOR_TYPE, - "id", "my-id", - "category-enum", CUSTOM_INDICATOR_CATEGORY_APPLICATION_STATUS, - "status-enum", CUSTOM_INDICATOR_STATUS_ACTIVE, - "icon-name", "my-name", - "attention-icon-name", "my-attention-name", - NULL)); - g_assert(ci != NULL); - - g_assert(!g_strcmp0("my-id", custom_indicator_get_id(ci))); - g_assert(!g_strcmp0("my-name", custom_indicator_get_icon(ci))); - g_assert(!g_strcmp0("my-attention-name", custom_indicator_get_attention_icon(ci))); - g_assert(custom_indicator_get_status(ci) == CUSTOM_INDICATOR_STATUS_ACTIVE); - g_assert(custom_indicator_get_category(ci) == CUSTOM_INDICATOR_CATEGORY_APPLICATION_STATUS); - - g_object_unref(G_OBJECT(ci)); - return; -} - -void -test_libcustomindicator_init (void) -{ - CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_INDICATOR_TYPE, NULL)); - g_assert(ci != NULL); - g_object_unref(G_OBJECT(ci)); - return; -} - -void -test_libcustomindicator_props_suite (void) -{ - g_test_add_func ("/indicator-custom/libcustomindicator/init", test_libcustomindicator_init); - g_test_add_func ("/indicator-custom/libcustomindicator/init_props", test_libcustomindicator_init_with_props); - g_test_add_func ("/indicator-custom/libcustomindicator/init_set_props", test_libcustomindicator_init_set_props); - g_test_add_func ("/indicator-custom/libcustomindicator/prop_signals", test_libcustomindicator_prop_signals); - - return; -} - -gint -main (gint argc, gchar * argv[]) -{ - g_type_init(); - g_test_init(&argc, &argv, NULL); - - /* Test suites */ - test_libcustomindicator_props_suite(); - - - return g_test_run (); -} diff --git a/tests/test-simple-app.c b/tests/test-simple-app.c new file mode 100644 index 0000000..3484e9e --- /dev/null +++ b/tests/test-simple-app.c @@ -0,0 +1,32 @@ + +#include <dbus/dbus-glib.h> +#include <dbus/dbus-glib-lowlevel.h> +#include <glib.h> +#include <libappindicator/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; +} |