diff options
author | Ted Gould <ted@gould.cx> | 2010-08-27 15:29:49 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-08-27 15:29:49 -0500 |
commit | 6b16918eb4343bbe1c3be8c2806020c8e6c40284 (patch) | |
tree | 49d48cd133257899cd1484d0770f23f6549b77db /tests | |
parent | 72f52f7f170e28a87ed58436d438aa1bea2ecf11 (diff) | |
download | libdbusmenu-6b16918eb4343bbe1c3be8c2806020c8e6c40284.tar.gz libdbusmenu-6b16918eb4343bbe1c3be8c2806020c8e6c40284.tar.bz2 libdbusmenu-6b16918eb4343bbe1c3be8c2806020c8e6c40284.zip |
Fleshing out the test to get all happy
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-glib-events-client.c | 32 | ||||
-rw-r--r-- | tests/test-glib-events-server.c | 4 |
2 files changed, 34 insertions, 2 deletions
diff --git a/tests/test-glib-events-client.c b/tests/test-glib-events-client.c index 9b05ca6..688529c 100644 --- a/tests/test-glib-events-client.c +++ b/tests/test-glib-events-client.c @@ -28,6 +28,37 @@ with this program. If not, see <http://www.gnu.org/licenses/>. static GMainLoop * mainloop = NULL; static gboolean passed = TRUE; +static gboolean first = TRUE; + +static void +event_status (DbusmenuClient * client, DbusmenuMenuitem * item, gchar * name, GValue * data, guint timestamp, GError * error, gpointer user_data) +{ + g_debug("Event status: %s", error == NULL ? "Sent" : "Error"); + + if (first && error != NULL) { + passed = FALSE; + g_debug("First signal back failed."); + g_main_loop_quit(mainloop); + return; + } + + if (!first && error == NULL) { + passed = FALSE; + g_debug("Second signal didn't fail."); + g_main_loop_quit(mainloop); + return; + } + + if (!first && error != NULL) { + g_debug("Second signal failed: pass."); + g_main_loop_quit(mainloop); + return; + } + + first = FALSE; + dbusmenu_menuitem_handle_event(item, "clicked", NULL, 0); + return; +} static void layout_updated (DbusmenuClient * client, gpointer data) @@ -61,6 +92,7 @@ main (int argc, char ** argv) DbusmenuClient * client = dbusmenu_client_new("org.dbusmenu.test", "/org/test"); g_signal_connect(G_OBJECT(client), DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED, G_CALLBACK(layout_updated), NULL); + g_signal_connect(G_OBJECT(client), DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT, G_CALLBACK(event_status), NULL); g_timeout_add_seconds(5, timer_func, client); diff --git a/tests/test-glib-events-server.c b/tests/test-glib-events-server.c index db4f5c5..0d1e0b1 100644 --- a/tests/test-glib-events-server.c +++ b/tests/test-glib-events-server.c @@ -86,9 +86,9 @@ main (int argc, char ** argv) if (passed) { int i; - for (i = 0; i < 10; i++) { + for (i = 0; i < 5; i++) { g_debug("Ignoring signals: %d", i); - g_usleep(100 * 1000); + g_usleep(1000 * 1000); } } |