From 23d6b5d0da79ac8afaff855f0eed4811615999f3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 9 Nov 2009 00:14:54 -0600 Subject: Adding a defualt file for a little appliction that'll grow into a full app. --- tests/Makefile.am | 19 ++++++++++++++++++- tests/test-simple-app.c | 8 ++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/test-simple-app.c (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index f6a0525..39cd3a6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,7 +2,8 @@ check_PROGRAMS = \ test-libcustomindicator \ test-libcustomindicator-dbus-client \ - test-libcustomindicator-dbus-server + test-libcustomindicator-dbus-server \ + test-simple-app TESTS = DISTCLEANFILES = $(TESTS) @@ -82,3 +83,19 @@ test-libcustomindicator-dbus: test-libcustomindicator-dbus-client test-libcustom TESTS += test-libcustomindicator-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/libcustomindicator.la + diff --git a/tests/test-simple-app.c b/tests/test-simple-app.c new file mode 100644 index 0000000..9c2d164 --- /dev/null +++ b/tests/test-simple-app.c @@ -0,0 +1,8 @@ + +int +main (int argc, char ** argv) +{ + + + return 0; +} -- cgit v1.2.3 From 5c797c35b740399391fecf1cb5bd8eff843d3282 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 9 Nov 2009 00:27:17 -0600 Subject: A simple little app. --- tests/test-simple-app.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests') diff --git a/tests/test-simple-app.c b/tests/test-simple-app.c index 9c2d164..9e779ec 100644 --- a/tests/test-simple-app.c +++ b/tests/test-simple-app.c @@ -1,8 +1,32 @@ +#include +#include +#include +#include + +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"); + + CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_INDICATOR_TYPE, + "id", "test-application", + "status-enum", CUSTOM_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; } -- cgit v1.2.3 From 35d5c711028141dbca7907f550849b1bd1c8dfe7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 30 Nov 2009 13:15:47 -0600 Subject: De-customizing the directory stuff. --- tests/Makefile.am | 70 +++---- tests/test-libappindicator-dbus-client.c | 272 ++++++++++++++++++++++++++++ tests/test-libappindicator-dbus-server.c | 44 +++++ tests/test-libappindicator.c | 163 +++++++++++++++++ tests/test-libcustomindicator-dbus-client.c | 272 ---------------------------- tests/test-libcustomindicator-dbus-server.c | 44 ----- tests/test-libcustomindicator.c | 163 ----------------- 7 files changed, 514 insertions(+), 514 deletions(-) create mode 100644 tests/test-libappindicator-dbus-client.c create mode 100644 tests/test-libappindicator-dbus-server.c create mode 100644 tests/test-libappindicator.c delete mode 100644 tests/test-libcustomindicator-dbus-client.c delete mode 100644 tests/test-libcustomindicator-dbus-server.c delete mode 100644 tests/test-libcustomindicator.c (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 0b771db..845b41c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,92 +1,92 @@ 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 @@ -102,5 +102,5 @@ test_simple_app_CFLAGS = \ test_simple_app_LDADD = \ $(INDICATOR_LIBS) \ - $(top_builddir)/src/libcustomindicator.la + $(top_builddir)/src/libappindicator.la diff --git a/tests/test-libappindicator-dbus-client.c b/tests/test-libappindicator-dbus-client.c new file mode 100644 index 0000000..e0203c0 --- /dev/null +++ b/tests/test-libappindicator-dbus-client.c @@ -0,0 +1,272 @@ + +#include +#include +#include +#include "test-defines.h" + +static GMainLoop * mainloop = NULL; +static gboolean passed = TRUE; +static int propcount = 0; + +static void +check_propcount (void) +{ + if (propcount >= 6) { + 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; +} + +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) +{ + g_main_loop_quit(mainloop); + g_warning("Forced to Kill"); + passed = FALSE; + return FALSE; +} + +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 * props = dbus_g_proxy_new_for_name_owner(session_bus, + ":1.0", + "/need/a/path", + 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.custom.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, "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, "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, "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, "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, "Menu", + 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 new file mode 100644 index 0000000..2d61776 --- /dev/null +++ b/tests/test-libappindicator-dbus-server.c @@ -0,0 +1,44 @@ + +#include +#include +#include +#include +#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-libappindicator.c b/tests/test-libappindicator.c new file mode 100644 index 0000000..c4342e8 --- /dev/null +++ b/tests/test-libappindicator.c @@ -0,0 +1,163 @@ + +#include +#include + +#include + +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-libcustomindicator-dbus-client.c b/tests/test-libcustomindicator-dbus-client.c deleted file mode 100644 index e0203c0..0000000 --- a/tests/test-libcustomindicator-dbus-client.c +++ /dev/null @@ -1,272 +0,0 @@ - -#include -#include -#include -#include "test-defines.h" - -static GMainLoop * mainloop = NULL; -static gboolean passed = TRUE; -static int propcount = 0; - -static void -check_propcount (void) -{ - if (propcount >= 6) { - 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; -} - -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) -{ - g_main_loop_quit(mainloop); - g_warning("Forced to Kill"); - passed = FALSE; - return FALSE; -} - -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 * props = dbus_g_proxy_new_for_name_owner(session_bus, - ":1.0", - "/need/a/path", - 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.custom.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, "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, "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, "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, "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, "Menu", - 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-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 -#include -#include -#include -#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 -#include - -#include - -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 (); -} -- cgit v1.2.3 From f0881be3b8f779e0411958e6637f8f29e5697cbb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 30 Nov 2009 13:21:45 -0600 Subject: Changing the insides to remove the custom stuff. --- tests/test-defines.h | 4 +- tests/test-libappindicator-dbus-client.c | 14 ++--- tests/test-libappindicator-dbus-server.c | 18 +++--- tests/test-libappindicator.c | 94 ++++++++++++++++---------------- tests/test-simple-app.c | 14 ++--- 5 files changed, 72 insertions(+), 72 deletions(-) (limited to 'tests') 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-libappindicator-dbus-client.c b/tests/test-libappindicator-dbus-client.c index e0203c0..f8ed4b3 100644 --- a/tests/test-libappindicator-dbus-client.c +++ b/tests/test-libappindicator-dbus-client.c @@ -1,7 +1,7 @@ #include #include -#include +#include #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 index 2d61776..f7b8d9f 100644 --- a/tests/test-libappindicator-dbus-server.c +++ b/tests/test-libappindicator-dbus-server.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include "test-defines.h" static GMainLoop * mainloop = NULL; @@ -23,14 +23,14 @@ main (gint argc, gchar * argv[]) 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)); + 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); diff --git a/tests/test-libappindicator.c b/tests/test-libappindicator.c index c4342e8..1d7c920 100644 --- a/tests/test-libappindicator.c +++ b/tests/test-libappindicator.c @@ -2,149 +2,149 @@ #include #include -#include +#include void -test_libcustomindicator_prop_signals_status_helper (CustomIndicator * ci, gchar * status, gboolean * signalactivated) +test_libappindicator_prop_signals_status_helper (AppIndicator * ci, gchar * status, gboolean * signalactivated) { *signalactivated = TRUE; return; } void -test_libcustomindicator_prop_signals_helper (CustomIndicator * ci, gboolean * signalactivated) +test_libappindicator_prop_signals_helper (AppIndicator * ci, gboolean * signalactivated) { *signalactivated = TRUE; return; } void -test_libcustomindicator_prop_signals (void) +test_libappindicator_prop_signals (void) { - CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_INDICATOR_TYPE, NULL)); + 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_libcustomindicator_prop_signals_helper), &signaled); + 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_libcustomindicator_prop_signals_helper), &signaled); + 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_libcustomindicator_prop_signals_status_helper), &signaled); + handlerid = g_signal_connect(G_OBJECT(ci), "new-status", G_CALLBACK(test_libappindicator_prop_signals_status_helper), &signaled); g_assert(handlerid != 0); signaled = FALSE; - custom_indicator_set_icon(ci, "bob"); + app_indicator_set_icon(ci, "bob"); g_assert(signaled); signaled = FALSE; - custom_indicator_set_icon(ci, "bob"); + app_indicator_set_icon(ci, "bob"); g_assert(!signaled); signaled = FALSE; - custom_indicator_set_icon(ci, "al"); + app_indicator_set_icon(ci, "al"); g_assert(signaled); signaled = FALSE; - custom_indicator_set_attention_icon(ci, "bob"); + app_indicator_set_attention_icon(ci, "bob"); g_assert(signaled); signaled = FALSE; - custom_indicator_set_attention_icon(ci, "bob"); + app_indicator_set_attention_icon(ci, "bob"); g_assert(!signaled); signaled = FALSE; - custom_indicator_set_attention_icon(ci, "al"); + app_indicator_set_attention_icon(ci, "al"); g_assert(signaled); signaled = FALSE; - custom_indicator_set_status(ci, CUSTOM_INDICATOR_STATUS_PASSIVE); + app_indicator_set_status(ci, APP_INDICATOR_STATUS_PASSIVE); g_assert(!signaled); signaled = FALSE; - custom_indicator_set_status(ci, CUSTOM_INDICATOR_STATUS_ACTIVE); + app_indicator_set_status(ci, APP_INDICATOR_STATUS_ACTIVE); g_assert(signaled); signaled = FALSE; - custom_indicator_set_status(ci, CUSTOM_INDICATOR_STATUS_ACTIVE); + app_indicator_set_status(ci, APP_INDICATOR_STATUS_ACTIVE); g_assert(!signaled); signaled = FALSE; - custom_indicator_set_status(ci, CUSTOM_INDICATOR_STATUS_ATTENTION); + app_indicator_set_status(ci, APP_INDICATOR_STATUS_ATTENTION); g_assert(signaled); return; } void -test_libcustomindicator_init_set_props (void) +test_libappindicator_init_set_props (void) { - CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_INDICATOR_TYPE, NULL)); + AppIndicator * ci = APP_INDICATOR(g_object_new(APP_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"); + 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", 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_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_libcustomindicator_init_with_props (void) +test_libappindicator_init_with_props (void) { - CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_INDICATOR_TYPE, + AppIndicator * ci = APP_INDICATOR(g_object_new(APP_INDICATOR_TYPE, "id", "my-id", - "category-enum", CUSTOM_INDICATOR_CATEGORY_APPLICATION_STATUS, - "status-enum", CUSTOM_INDICATOR_STATUS_ACTIVE, + "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", 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_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_libcustomindicator_init (void) +test_libappindicator_init (void) { - CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_INDICATOR_TYPE, NULL)); + AppIndicator * ci = APP_INDICATOR(g_object_new(APP_INDICATOR_TYPE, NULL)); g_assert(ci != NULL); g_object_unref(G_OBJECT(ci)); return; } void -test_libcustomindicator_props_suite (void) +test_libappindicator_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); + 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; } @@ -156,7 +156,7 @@ main (gint argc, gchar * argv[]) g_test_init(&argc, &argv, NULL); /* Test suites */ - test_libcustomindicator_props_suite(); + test_libappindicator_props_suite(); return g_test_run (); diff --git a/tests/test-simple-app.c b/tests/test-simple-app.c index 9e779ec..3484e9e 100644 --- a/tests/test-simple-app.c +++ b/tests/test-simple-app.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include static GMainLoop * mainloop = NULL; @@ -15,12 +15,12 @@ main (int argc, char ** argv) DbusmenuMenuitem * dmi = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set(dmi, "label", "Bob"); - CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_INDICATOR_TYPE, - "id", "test-application", - "status-enum", CUSTOM_INDICATOR_STATUS_ACTIVE, - "icon-name", "system-shutdown", - "menu-object", dms, - NULL)); + 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); -- cgit v1.2.3