aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore1
-rw-r--r--tests/Makefile.am12
-rw-r--r--tests/test-glib-layout-client.c42
3 files changed, 55 insertions, 0 deletions
diff --git a/.bzrignore b/.bzrignore
index 13bd161..36595be 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -27,3 +27,4 @@ libdbusmenu_glib_la-server-marshal.lo
.libs
glib-server-nomenu
test-glib-layout-server
+test-glib-layout-client
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f00a7e7..a80f1d1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,7 @@
libexec_PROGRAMS = \
glib-server-nomenu \
+ test-glib-layout-client \
test-glib-layout-server
glib_server_nomenu_SOURCES = \
@@ -25,6 +26,17 @@ test_glib_layout_server_LDADD = \
../libdbusmenu-glib/libdbusmenu-glib.la \
$(DBUSMENUGLIB_LIBS)
+test_glib_layout_client_SOURCES = \
+ test-glib-layout-client.c
+
+test_glib_layout_client_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(DBUSMENUGLIB_CFLAGS) -Wall -Werror
+
+test_glib_layout_client_LDADD = \
+ ../libdbusmenu-glib/libdbusmenu-glib.la \
+ $(DBUSMENUGLIB_LIBS)
+
diff --git a/tests/test-glib-layout-client.c b/tests/test-glib-layout-client.c
index e69de29..814f019 100644
--- a/tests/test-glib-layout-client.c
+++ b/tests/test-glib-layout-client.c
@@ -0,0 +1,42 @@
+#include <glib.h>
+
+#include <libdbusmenu-glib/client.h>
+#include <libdbusmenu-glib/menuitem.h>
+
+#include "test-glib-layout.h"
+
+static guint layouton = 0;
+static GMainLoop * mainloop = NULL;
+static gboolean passed = TRUE;
+
+static gboolean
+timer_func (gpointer data)
+{
+ g_debug("Death timer. Oops. Got to: %d", layouton);
+ passed = FALSE;
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char ** argv)
+{
+ g_type_init();
+
+ DbusmenuClient * client = dbusmenu_client_new(":1", "/org/test");
+ dbusmenu_client_get_root(client);
+
+ timer_func(NULL);
+ g_timeout_add_seconds(2, timer_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 0;
+ }
+}