aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2010-07-22 21:17:12 +0200
committerKen VanDine <ken.vandine@canonical.com>2010-07-22 21:17:12 +0200
commit598b0b51ee4b12d51a47a0bd7b595503041f037d (patch)
tree6916ff59b3db297035721a574bab105bba2bc3e0 /tests
parentf71f850da99826cab7a99e03161411c2b35b3305 (diff)
parent8c75a152b79446cf8a63a79097b05b6fd620e778 (diff)
downloadlibdbusmenu-598b0b51ee4b12d51a47a0bd7b595503041f037d.tar.gz
libdbusmenu-598b0b51ee4b12d51a47a0bd7b595503041f037d.tar.bz2
libdbusmenu-598b0b51ee4b12d51a47a0bd7b595503041f037d.zip
Import upstream version 0.3.7
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am48
-rw-r--r--tests/Makefile.in130
-rw-r--r--tests/test-gtk-submenu-client.c143
-rw-r--r--tests/test-gtk-submenu-server.c98
4 files changed, 410 insertions, 9 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 63857a2..839305f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -10,11 +10,11 @@ TESTS = \
test-glib-proxy \
test-glib-simple-items \
test-glib-submenu \
- test-json \
test-gtk-objects-test \
test-gtk-label \
test-gtk-shortcut \
- test-gtk-reorder
+ test-gtk-reorder \
+ test-gtk-submenu
check_PROGRAMS = \
glib-server-nomenu \
@@ -36,7 +36,9 @@ check_PROGRAMS = \
test-glib-simple-items \
test-gtk-reorder-server \
test-json-client \
- test-json-server
+ test-json-server \
+ test-gtk-submenu-server \
+ test-gtk-submenu-client
XVFB_RUN=". $(srcdir)/run-xvfb.sh"
@@ -454,6 +456,46 @@ test_gtk_reorder_server_LDADD = \
$(DBUSMENUTESTS_LIBS)
#########################
+# Test GTK Submenu
+#########################
+
+test-gtk-submenu: test-gtk-submenu-client test-gtk-submenu-server Makefile.am
+ @echo "#!/bin/bash" > $@
+ @echo $(XVFB_RUN) >> $@
+ @echo $(DBUS_RUNNER) --task ./test-gtk-submenu-client --task-name Client --task ./test-gtk-submenu-server --task-name Server --ignore-return >> $@
+ @chmod +x $@
+
+test_gtk_submenu_server_SOURCES = \
+ test-gtk-submenu-server.c
+
+test_gtk_submenu_server_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(DBUSMENUGTK_CFLAGS) \
+ $(DBUSMENUTESTS_CFLAGS) \
+ $(DBUSMENUGLIB_CFLAGS) -Wall -Werror
+
+test_gtk_submenu_server_LDADD = \
+ ../libdbusmenu-glib/libdbusmenu-glib.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk.la \
+ $(DBUSMENUGTK_LIBS) \
+ $(DBUSMENUTESTS_LIBS)
+
+test_gtk_submenu_client_SOURCES = \
+ test-gtk-submenu-client.c
+
+test_gtk_submenu_client_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(DBUSMENUGTK_CFLAGS) \
+ $(DBUSMENUTESTS_CFLAGS) \
+ $(DBUSMENUGLIB_CFLAGS) -Wall -Werror
+
+test_gtk_submenu_client_LDADD = \
+ ../libdbusmenu-glib/libdbusmenu-glib.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk.la \
+ $(DBUSMENUGTK_LIBS) \
+ $(DBUSMENUTESTS_LIBS)
+
+#########################
# Test Mago
#########################
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 1f4806d..5e7c0ec 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -38,8 +38,8 @@ build_triplet = @build@
host_triplet = @host@
TESTS = test-glib-objects-test test-glib-layout test-glib-properties \
test-glib-proxy test-glib-simple-items$(EXEEXT) \
- test-glib-submenu test-json test-gtk-objects-test \
- test-gtk-label test-gtk-shortcut test-gtk-reorder
+ test-glib-submenu test-gtk-objects-test test-gtk-label \
+ test-gtk-shortcut test-gtk-reorder test-gtk-submenu
check_PROGRAMS = glib-server-nomenu$(EXEEXT) \
test-glib-objects$(EXEEXT) test-glib-layout-client$(EXEEXT) \
test-glib-layout-server$(EXEEXT) \
@@ -54,13 +54,19 @@ check_PROGRAMS = glib-server-nomenu$(EXEEXT) \
test-gtk-shortcut-server$(EXEEXT) \
test-glib-simple-items$(EXEEXT) \
test-gtk-reorder-server$(EXEEXT) test-json-client$(EXEEXT) \
- test-json-server$(EXEEXT)
+ test-json-server$(EXEEXT) test-gtk-submenu-server$(EXEEXT) \
+ test-gtk-submenu-client$(EXEEXT)
subdir = tests
DIST_COMMON = $(libdbusmenu_jsonloaderinclude_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/dbusmenu-jsonloader.pc.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/gnome-doc-utils.m4 \
+ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/intltool.m4 \
+ $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -289,6 +295,30 @@ test_gtk_shortcut_server_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(test_gtk_shortcut_server_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
+am_test_gtk_submenu_client_OBJECTS = \
+ test_gtk_submenu_client-test-gtk-submenu-client.$(OBJEXT)
+test_gtk_submenu_client_OBJECTS = \
+ $(am_test_gtk_submenu_client_OBJECTS)
+test_gtk_submenu_client_DEPENDENCIES = \
+ ../libdbusmenu-glib/libdbusmenu-glib.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+test_gtk_submenu_client_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(test_gtk_submenu_client_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_test_gtk_submenu_server_OBJECTS = \
+ test_gtk_submenu_server-test-gtk-submenu-server.$(OBJEXT)
+test_gtk_submenu_server_OBJECTS = \
+ $(am_test_gtk_submenu_server_OBJECTS)
+test_gtk_submenu_server_DEPENDENCIES = \
+ ../libdbusmenu-glib/libdbusmenu-glib.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+test_gtk_submenu_server_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(test_gtk_submenu_server_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
am_test_json_client_OBJECTS = \
test_json_client-test-json-client.$(OBJEXT)
test_json_client_OBJECTS = $(am_test_json_client_OBJECTS)
@@ -354,7 +384,9 @@ SOURCES = $(libdbusmenu_jsonloader_la_SOURCES) \
$(test_gtk_reorder_server_SOURCES) \
$(test_gtk_shortcut_client_SOURCES) \
$(test_gtk_shortcut_server_SOURCES) \
- $(test_json_client_SOURCES) $(test_json_server_SOURCES)
+ $(test_gtk_submenu_client_SOURCES) \
+ $(test_gtk_submenu_server_SOURCES) $(test_json_client_SOURCES) \
+ $(test_json_server_SOURCES)
DIST_SOURCES = $(libdbusmenu_jsonloader_la_SOURCES) \
$(glib_server_nomenu_SOURCES) \
$(test_glib_layout_client_SOURCES) \
@@ -373,7 +405,9 @@ DIST_SOURCES = $(libdbusmenu_jsonloader_la_SOURCES) \
$(test_gtk_reorder_server_SOURCES) \
$(test_gtk_shortcut_client_SOURCES) \
$(test_gtk_shortcut_server_SOURCES) \
- $(test_json_client_SOURCES) $(test_json_server_SOURCES)
+ $(test_gtk_submenu_client_SOURCES) \
+ $(test_gtk_submenu_server_SOURCES) $(test_json_client_SOURCES) \
+ $(test_json_server_SOURCES)
DATA = $(examples_DATA) $(json_DATA) $(pkgconfig_DATA)
HEADERS = $(libdbusmenu_jsonloaderinclude_HEADERS)
ETAGS = etags
@@ -399,6 +433,8 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
+DBUSMENUDUMPER_CFLAGS = @DBUSMENUDUMPER_CFLAGS@
+DBUSMENUDUMPER_LIBS = @DBUSMENUDUMPER_LIBS@
DBUSMENUGLIB_CFLAGS = @DBUSMENUGLIB_CFLAGS@
DBUSMENUGLIB_LIBS = @DBUSMENUGLIB_LIBS@
DBUSMENUGTK_CFLAGS = @DBUSMENUGTK_CFLAGS@
@@ -479,6 +515,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
POFILES = @POFILES@
POSUB = @POSUB@
PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
@@ -861,6 +899,36 @@ test_gtk_reorder_server_LDADD = \
$(DBUSMENUGTK_LIBS) \
$(DBUSMENUTESTS_LIBS)
+test_gtk_submenu_server_SOURCES = \
+ test-gtk-submenu-server.c
+
+test_gtk_submenu_server_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(DBUSMENUGTK_CFLAGS) \
+ $(DBUSMENUTESTS_CFLAGS) \
+ $(DBUSMENUGLIB_CFLAGS) -Wall -Werror
+
+test_gtk_submenu_server_LDADD = \
+ ../libdbusmenu-glib/libdbusmenu-glib.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk.la \
+ $(DBUSMENUGTK_LIBS) \
+ $(DBUSMENUTESTS_LIBS)
+
+test_gtk_submenu_client_SOURCES = \
+ test-gtk-submenu-client.c
+
+test_gtk_submenu_client_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(DBUSMENUGTK_CFLAGS) \
+ $(DBUSMENUTESTS_CFLAGS) \
+ $(DBUSMENUGLIB_CFLAGS) -Wall -Werror
+
+test_gtk_submenu_client_LDADD = \
+ ../libdbusmenu-glib/libdbusmenu-glib.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk.la \
+ $(DBUSMENUGTK_LIBS) \
+ $(DBUSMENUTESTS_LIBS)
+
#########################
# Other
@@ -1036,6 +1104,12 @@ test-gtk-shortcut-client$(EXEEXT): $(test_gtk_shortcut_client_OBJECTS) $(test_gt
test-gtk-shortcut-server$(EXEEXT): $(test_gtk_shortcut_server_OBJECTS) $(test_gtk_shortcut_server_DEPENDENCIES)
@rm -f test-gtk-shortcut-server$(EXEEXT)
$(AM_V_CCLD)$(test_gtk_shortcut_server_LINK) $(test_gtk_shortcut_server_OBJECTS) $(test_gtk_shortcut_server_LDADD) $(LIBS)
+test-gtk-submenu-client$(EXEEXT): $(test_gtk_submenu_client_OBJECTS) $(test_gtk_submenu_client_DEPENDENCIES)
+ @rm -f test-gtk-submenu-client$(EXEEXT)
+ $(AM_V_CCLD)$(test_gtk_submenu_client_LINK) $(test_gtk_submenu_client_OBJECTS) $(test_gtk_submenu_client_LDADD) $(LIBS)
+test-gtk-submenu-server$(EXEEXT): $(test_gtk_submenu_server_OBJECTS) $(test_gtk_submenu_server_DEPENDENCIES)
+ @rm -f test-gtk-submenu-server$(EXEEXT)
+ $(AM_V_CCLD)$(test_gtk_submenu_server_LINK) $(test_gtk_submenu_server_OBJECTS) $(test_gtk_submenu_server_LDADD) $(LIBS)
test-json-client$(EXEEXT): $(test_json_client_OBJECTS) $(test_json_client_DEPENDENCIES)
@rm -f test-json-client$(EXEEXT)
$(AM_V_CCLD)$(test_json_client_LINK) $(test_json_client_OBJECTS) $(test_json_client_LDADD) $(LIBS)
@@ -1068,6 +1142,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_gtk_reorder_server-test-gtk-reorder-server.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_gtk_shortcut_client-test-gtk-shortcut-client.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_gtk_shortcut_server-test-gtk-shortcut-server.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_gtk_submenu_client-test-gtk-submenu-client.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_gtk_submenu_server-test-gtk-submenu-server.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_json_client-test-json-client.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_json_server-test-json-server.Po@am__quote@
@@ -1391,6 +1467,38 @@ test_gtk_shortcut_server-test-gtk-shortcut-server.obj: test-gtk-shortcut-server.
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_gtk_shortcut_server_CFLAGS) $(CFLAGS) -c -o test_gtk_shortcut_server-test-gtk-shortcut-server.obj `if test -f 'test-gtk-shortcut-server.c'; then $(CYGPATH_W) 'test-gtk-shortcut-server.c'; else $(CYGPATH_W) '$(srcdir)/test-gtk-shortcut-server.c'; fi`
+test_gtk_submenu_client-test-gtk-submenu-client.o: test-gtk-submenu-client.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_gtk_submenu_client_CFLAGS) $(CFLAGS) -MT test_gtk_submenu_client-test-gtk-submenu-client.o -MD -MP -MF $(DEPDIR)/test_gtk_submenu_client-test-gtk-submenu-client.Tpo -c -o test_gtk_submenu_client-test-gtk-submenu-client.o `test -f 'test-gtk-submenu-client.c' || echo '$(srcdir)/'`test-gtk-submenu-client.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_gtk_submenu_client-test-gtk-submenu-client.Tpo $(DEPDIR)/test_gtk_submenu_client-test-gtk-submenu-client.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-gtk-submenu-client.c' object='test_gtk_submenu_client-test-gtk-submenu-client.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_gtk_submenu_client_CFLAGS) $(CFLAGS) -c -o test_gtk_submenu_client-test-gtk-submenu-client.o `test -f 'test-gtk-submenu-client.c' || echo '$(srcdir)/'`test-gtk-submenu-client.c
+
+test_gtk_submenu_client-test-gtk-submenu-client.obj: test-gtk-submenu-client.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_gtk_submenu_client_CFLAGS) $(CFLAGS) -MT test_gtk_submenu_client-test-gtk-submenu-client.obj -MD -MP -MF $(DEPDIR)/test_gtk_submenu_client-test-gtk-submenu-client.Tpo -c -o test_gtk_submenu_client-test-gtk-submenu-client.obj `if test -f 'test-gtk-submenu-client.c'; then $(CYGPATH_W) 'test-gtk-submenu-client.c'; else $(CYGPATH_W) '$(srcdir)/test-gtk-submenu-client.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_gtk_submenu_client-test-gtk-submenu-client.Tpo $(DEPDIR)/test_gtk_submenu_client-test-gtk-submenu-client.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-gtk-submenu-client.c' object='test_gtk_submenu_client-test-gtk-submenu-client.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_gtk_submenu_client_CFLAGS) $(CFLAGS) -c -o test_gtk_submenu_client-test-gtk-submenu-client.obj `if test -f 'test-gtk-submenu-client.c'; then $(CYGPATH_W) 'test-gtk-submenu-client.c'; else $(CYGPATH_W) '$(srcdir)/test-gtk-submenu-client.c'; fi`
+
+test_gtk_submenu_server-test-gtk-submenu-server.o: test-gtk-submenu-server.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_gtk_submenu_server_CFLAGS) $(CFLAGS) -MT test_gtk_submenu_server-test-gtk-submenu-server.o -MD -MP -MF $(DEPDIR)/test_gtk_submenu_server-test-gtk-submenu-server.Tpo -c -o test_gtk_submenu_server-test-gtk-submenu-server.o `test -f 'test-gtk-submenu-server.c' || echo '$(srcdir)/'`test-gtk-submenu-server.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_gtk_submenu_server-test-gtk-submenu-server.Tpo $(DEPDIR)/test_gtk_submenu_server-test-gtk-submenu-server.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-gtk-submenu-server.c' object='test_gtk_submenu_server-test-gtk-submenu-server.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_gtk_submenu_server_CFLAGS) $(CFLAGS) -c -o test_gtk_submenu_server-test-gtk-submenu-server.o `test -f 'test-gtk-submenu-server.c' || echo '$(srcdir)/'`test-gtk-submenu-server.c
+
+test_gtk_submenu_server-test-gtk-submenu-server.obj: test-gtk-submenu-server.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_gtk_submenu_server_CFLAGS) $(CFLAGS) -MT test_gtk_submenu_server-test-gtk-submenu-server.obj -MD -MP -MF $(DEPDIR)/test_gtk_submenu_server-test-gtk-submenu-server.Tpo -c -o test_gtk_submenu_server-test-gtk-submenu-server.obj `if test -f 'test-gtk-submenu-server.c'; then $(CYGPATH_W) 'test-gtk-submenu-server.c'; else $(CYGPATH_W) '$(srcdir)/test-gtk-submenu-server.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_gtk_submenu_server-test-gtk-submenu-server.Tpo $(DEPDIR)/test_gtk_submenu_server-test-gtk-submenu-server.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-gtk-submenu-server.c' object='test_gtk_submenu_server-test-gtk-submenu-server.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_gtk_submenu_server_CFLAGS) $(CFLAGS) -c -o test_gtk_submenu_server-test-gtk-submenu-server.obj `if test -f 'test-gtk-submenu-server.c'; then $(CYGPATH_W) 'test-gtk-submenu-server.c'; else $(CYGPATH_W) '$(srcdir)/test-gtk-submenu-server.c'; fi`
+
test_json_client-test-json-client.o: test-json-client.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_json_client_CFLAGS) $(CFLAGS) -MT test_json_client-test-json-client.o -MD -MP -MF $(DEPDIR)/test_json_client-test-json-client.Tpo -c -o test_json_client-test-json-client.o `test -f 'test-json-client.c' || echo '$(srcdir)/'`test-json-client.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_json_client-test-json-client.Tpo $(DEPDIR)/test_json_client-test-json-client.Po
@@ -1912,6 +2020,16 @@ test-gtk-reorder: test-gtk-label-client test-gtk-reorder-server Makefile.am
@chmod +x $@
#########################
+# Test GTK Submenu
+#########################
+
+test-gtk-submenu: test-gtk-submenu-client test-gtk-submenu-server Makefile.am
+ @echo "#!/bin/bash" > $@
+ @echo $(XVFB_RUN) >> $@
+ @echo $(DBUS_RUNNER) --task ./test-gtk-submenu-client --task-name Client --task ./test-gtk-submenu-server --task-name Server --ignore-return >> $@
+ @chmod +x $@
+
+#########################
# Test Mago
#########################
diff --git a/tests/test-gtk-submenu-client.c b/tests/test-gtk-submenu-client.c
new file mode 100644
index 0000000..2e1ef7a
--- /dev/null
+++ b/tests/test-gtk-submenu-client.c
@@ -0,0 +1,143 @@
+/*
+A test for libdbusmenu to ensure its quality.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <gtk/gtk.h>
+#include <libdbusmenu-gtk/menu.h>
+
+static GMainLoop * mainloop = NULL;
+static gboolean passed = TRUE;
+
+static gboolean check_menu_content(GtkMenu * menu, char ** content)
+{
+ GList * child = gtk_container_get_children(GTK_CONTAINER(menu));
+ char ** expected = content;
+ for (; child != NULL; child = g_list_next(child), ++expected) {
+ if (*expected == NULL) {
+ g_warning("Too many gtk items");
+ return FALSE;
+ }
+ const char * label = gtk_menu_item_get_label(GTK_MENU_ITEM(child->data));
+ if (g_strcmp0(label, *expected) != 0) {
+ g_warning("Expected '%s', got '%s'", *expected, label);
+ return FALSE;
+ }
+ }
+ if (*expected != NULL) {
+ g_warning("Not enough gtk items");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void
+abort_test(const char * message)
+{
+ if (message) {
+ g_warning("%s", message);
+ }
+ passed = FALSE;
+ g_main_loop_quit(mainloop);
+}
+
+static gboolean
+timer_func (gpointer data)
+{
+ static char * root_content[] = { "Folder 1", "Folder 2", NULL };
+ static char * folder1_content[] = { "1.1", "1.2", "1.3", NULL };
+ static char * folder2_content[] = { "2.1", "2.2", "2.3", NULL };
+
+ GtkMenuItem * root_item = GTK_MENU_ITEM(data);
+ GtkMenu * menu = GTK_MENU(gtk_menu_item_get_submenu(root_item));
+
+ /* Root */
+ if (!check_menu_content(menu, root_content)) {
+ abort_test("Checking root content failed");
+ return FALSE;
+ }
+
+ /* Folder 1 */
+ GList * child = gtk_container_get_children(GTK_CONTAINER(menu));
+ GtkMenuItem * item = GTK_MENU_ITEM(child->data);
+ GtkMenu * folder_menu = GTK_MENU(gtk_menu_item_get_submenu(item));
+ if (!folder_menu) {
+ abort_test("Folder 1 has no menu");
+ return FALSE;
+ }
+
+ if (!check_menu_content(folder_menu, folder1_content)) {
+ abort_test("Checking folder1 content failed");
+ return FALSE;
+ }
+
+ /* Folder 2 */
+ child = g_list_next(child);
+ item = GTK_MENU_ITEM(child->data);
+ folder_menu = GTK_MENU(gtk_menu_item_get_submenu(item));
+ if (!folder_menu) {
+ abort_test("Folder 2 has no menu");
+ return FALSE;
+ }
+
+ if (!check_menu_content(folder_menu, folder2_content)) {
+ abort_test("Checking folder2 content failed");
+ return FALSE;
+ }
+
+ passed = TRUE;
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char ** argv)
+{
+ gtk_init(&argc, &argv);
+
+ g_debug("Client Initialized. Waiting.");
+ /* Make sure the server starts up and all that */
+ g_usleep(500000);
+
+ g_debug("Building Window");
+ GtkWidget * window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ GtkWidget * menubar = gtk_menu_bar_new();
+ GtkWidget * menuitem = gtk_menu_item_new_with_label("Test");
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(dbusmenu_gtkmenu_new ("glib.label.test", "/org/test")));
+ gtk_widget_show(menuitem);
+ gtk_menu_bar_append(menubar, menuitem);
+ gtk_widget_show(menubar);
+ gtk_container_add(GTK_CONTAINER(window), menubar);
+ gtk_window_set_title(GTK_WINDOW(window), "libdbusmenu-gtk test");
+ gtk_widget_show(window);
+
+ g_timeout_add_seconds(1, timer_func, menuitem);
+
+ g_debug("Entering Mainloop");
+ 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;
+ }
+}
diff --git a/tests/test-gtk-submenu-server.c b/tests/test-gtk-submenu-server.c
new file mode 100644
index 0000000..ba3993e
--- /dev/null
+++ b/tests/test-gtk-submenu-server.c
@@ -0,0 +1,98 @@
+/*
+A test for libdbusmenu to ensure its quality.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <glib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include <dbus/dbus-glib-bindings.h>
+
+#include <libdbusmenu-glib/menuitem.h>
+#include <libdbusmenu-glib/server.h>
+
+static GMainLoop *mainloop = NULL;
+
+static gboolean
+timer_func (gpointer data)
+{
+ g_main_loop_quit (mainloop);
+
+ return FALSE;
+}
+
+DbusmenuMenuitem *
+add_item(DbusmenuMenuitem * parent, const char * label)
+{
+ DbusmenuMenuitem * item = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(item, "label", label);
+ dbusmenu_menuitem_child_append(parent, item);
+ return item;
+}
+
+int
+main (int argc, char ** argv)
+{
+ GError * error = NULL;
+
+ g_type_init();
+
+ DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
+ g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL))));
+
+ DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
+ guint nameret = 0;
+
+ if (!org_freedesktop_DBus_request_name(bus_proxy, "glib.label.test", 0, &nameret, &error)) {
+ g_error("Unable to call to request name");
+ return 1;
+ }
+
+ if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
+ g_error("Unable to get name");
+ return 1;
+ }
+
+ DbusmenuServer * server = dbusmenu_server_new("/org/test");
+ DbusmenuMenuitem * root = dbusmenu_menuitem_new();
+ dbusmenu_server_set_root(server, root);
+
+ DbusmenuMenuitem * item;
+ item = add_item(root, "Folder 1");
+ add_item(item, "1.1");
+ add_item(item, "1.2");
+ add_item(item, "1.3");
+
+ item = add_item(root, "Folder 2");
+ add_item(item, "2.1");
+ add_item(item, "2.2");
+ add_item(item, "2.3");
+
+ g_timeout_add_seconds(3, timer_func, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ g_debug("Quiting");
+
+ return 0;
+}
+