aboutsummaryrefslogtreecommitdiff
path: root/tests/test-glib-events-client.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-08-27 15:29:49 -0500
committerTed Gould <ted@gould.cx>2010-08-27 15:29:49 -0500
commit6b16918eb4343bbe1c3be8c2806020c8e6c40284 (patch)
tree49d48cd133257899cd1484d0770f23f6549b77db /tests/test-glib-events-client.c
parent72f52f7f170e28a87ed58436d438aa1bea2ecf11 (diff)
downloadlibdbusmenu-6b16918eb4343bbe1c3be8c2806020c8e6c40284.tar.gz
libdbusmenu-6b16918eb4343bbe1c3be8c2806020c8e6c40284.tar.bz2
libdbusmenu-6b16918eb4343bbe1c3be8c2806020c8e6c40284.zip
Fleshing out the test to get all happy
Diffstat (limited to 'tests/test-glib-events-client.c')
-rw-r--r--tests/test-glib-events-client.c32
1 files changed, 32 insertions, 0 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);