diff options
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | debian/changelog | 41 | ||||
-rw-r--r-- | debian/control | 3 | ||||
-rw-r--r-- | libdbusmenu-glib/Makefile.am | 3 | ||||
-rw-r--r-- | libdbusmenu-gtk/Makefile.am | 3 | ||||
-rw-r--r-- | libdbusmenu-gtk/parser.c | 82 | ||||
-rw-r--r-- | tests/Makefile.am | 470 | ||||
-rw-r--r-- | tests/test-glib-layout-client.c | 2 | ||||
-rw-r--r-- | tests/test-glib-properties-client.c | 6 | ||||
-rw-r--r-- | tests/test-glib-proxy-client.c | 8 | ||||
-rw-r--r-- | tests/test-glib-proxy-server.c | 2 | ||||
-rw-r--r-- | tests/test-glib-simple-items.c | 2 | ||||
-rw-r--r-- | tests/test-glib-submenu-client.c | 2 | ||||
-rw-r--r-- | tests/test-gtk-remove-server.c | 118 | ||||
-rw-r--r-- | tests/test-gtk-reorder-server.c | 2 | ||||
-rw-r--r-- | tests/test-gtk-shortcut-client.c | 2 |
16 files changed, 378 insertions, 369 deletions
diff --git a/configure.ac b/configure.ac index 66afc14..81cbb99 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,6 @@ AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums]) ########################### GTK_DOC_CHECK([1.14],[--flavour no-tmpl]) -GNOME_DOC_INIT ########################### # Dependencies - GLib diff --git a/debian/changelog b/debian/changelog index 85d1cbf..4d12b92 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,44 @@ +libdbusmenu (12.10.3+13.10.20130731-0ubuntu1) saucy; urgency=low + + [ Jeremy Bicha ] + * Don't build-depend on gnome-doc-utils. + + [ Ubuntu daily release ] + * Automatic snapshot from revision 455 + + -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Wed, 31 Jul 2013 02:02:59 +0000 + +libdbusmenu (12.10.3+13.10.20130628-0ubuntu1) saucy; urgency=low + + [ Charles Kerr ] + * Fix a bug caused by keeping signals connected to menuitems that + we're not using anymore. (LP: #1154701) + * Fix breakage when building with coverage scanning. + + [ Ted Gould ] + * Increase test timeouts to ensure proper results on slower platforms + (ARM). + + [ Jeremy Bicha ] + * Build with default valac. + + [ Ubuntu daily release ] + * Automatic snapshot from revision 453 + + -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 28 Jun 2013 02:03:25 +0000 + +libdbusmenu (12.10.3daily13.06.19-0ubuntu1) saucy; urgency=low + + [ Jeremy Bicha ] + * According to Debian's GObject introspection mini-policy: + http://anonscm.debian.org/viewvc/pkg-gnome/desktop/unstable/gobject- + introspection/debian/policy.txt?view=markup. + + [ Ubuntu daily release ] + * Automatic snapshot from revision 448 + + -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Wed, 19 Jun 2013 02:02:27 +0000 + libdbusmenu (12.10.3daily13.06.07-0ubuntu1) saucy; urgency=low [ Mathieu Trudel-Lapierre ] diff --git a/debian/control b/debian/control index cc7be0c..88b4735 100644 --- a/debian/control +++ b/debian/control @@ -9,7 +9,6 @@ Build-Depends: debhelper (>= 9), dh-autoreconf, libtool, intltool, - gnome-doc-utils, gtk-doc-tools, valgrind, dbus-test-runner, @@ -24,7 +23,7 @@ Build-Depends: debhelper (>= 9), gobject-introspection, libgirepository1.0-dev (>= 0.9.3), libx11-dev (>= 1.3), - valac-0.16, + valac (>= 0.16), Standards-Version: 3.9.2 Homepage: https://launchpad.net/dbusmenu # If you aren't a member of ~dbusmenu-team but need to upload diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index b2e796c..26d900c 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -185,10 +185,7 @@ Dbusmenu_0_4_gir_INCLUDES = \ GObject-2.0 Dbusmenu_0_4_gir_CFLAGS = \ $(DBUSMENUGLIB_CFLAGS) \ - $(COVERAGE_CFLAGS) \ -I$(top_srcdir) -Dbusmenu_0_4_gir_LDFLAGS = \ - $(COVERAGE_LDFLAGS) Dbusmenu_0_4_gir_LIBS = libdbusmenu-glib.la Dbusmenu_0_4_gir_FILES = $(introspection_sources) Dbusmenu_0_4_gir_NAMESPACE = Dbusmenu diff --git a/libdbusmenu-gtk/Makefile.am b/libdbusmenu-gtk/Makefile.am index b52098f..ff8555e 100644 --- a/libdbusmenu-gtk/Makefile.am +++ b/libdbusmenu-gtk/Makefile.am @@ -121,10 +121,7 @@ DbusmenuGtk_0_4_gir_INCLUDES = \ Dbusmenu-0.4 DbusmenuGtk_0_4_gir_CFLAGS = \ $(DBUSMENUGTK_CFLAGS) \ - $(COVERAGE_CFLAGS) \ -I$(top_srcdir) -DbusmenuGtk_0_4_gir_LDFLAGS = \ - $(COVERAGE_LDFLAGS) DbusmenuGtk_0_4_gir_LIBS = libdbusmenu-gtk$(VER).la \ $(top_builddir)/libdbusmenu-glib/libdbusmenu-glib.la DbusmenuGtk_0_4_gir_FILES = $(addprefix $(srcdir)/, $(introspection_sources)) diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index 6244b07..b09e984 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -273,10 +273,47 @@ dbusmenu_gtk_parse_menu_structure (GtkWidget * widget) DbusmenuMenuitem * dbusmenu_gtk_parse_get_cached_item (GtkWidget * widget) { - if (!GTK_IS_MENU_ITEM(widget)) { - return NULL; - } - return DBUSMENU_MENUITEM(g_object_get_data(G_OBJECT(widget), CACHED_MENUITEM)); + GObject * o = NULL; + DbusmenuMenuitem * ret = NULL; + + if (GTK_IS_MENU_ITEM (widget)) + o = g_object_get_data (G_OBJECT(widget), CACHED_MENUITEM); + + if (o && DBUSMENU_IS_MENUITEM(o)) + ret = DBUSMENU_MENUITEM (o); + + return ret; +} + +/* remove our dbusmenuitem's hooks to a GtkWidget, + such as when either of them are being destroyed */ +static void +disconnect_from_widget (GtkWidget * widget) +{ + ParserData * pdata = parser_data_get_from_widget (widget); + + if (pdata && pdata->widget) + { + GObject * o; + + g_assert (pdata->widget == widget); + + /* stop listening to signals from the widget */ + o = G_OBJECT (pdata->widget); + dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_notify_handler_id); + dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_add_handler_id); + dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_accel_handler_id); + dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_toggle_handler_id); + dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_visible_handler_id); + dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_screen_changed_handler_id); + + /* clear the menuitem's widget pointer */ + g_object_remove_weak_pointer (o, (gpointer*)&pdata->widget); + pdata->widget = NULL; + + /* clear the widget's menuitem pointer */ + g_object_set_data(o, CACHED_MENUITEM, NULL); + } } static void @@ -297,17 +334,7 @@ parser_data_free (ParserData * pdata) } if (pdata->widget != NULL) { - GObject * o = G_OBJECT(pdata->widget); - dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_notify_handler_id); - dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_add_handler_id); - dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_accel_handler_id); - dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_toggle_handler_id); - dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_visible_handler_id); - dbusmenu_gtk_clear_signal_handler (o, &pdata->widget_screen_changed_handler_id); - g_object_remove_weak_pointer(o, (gpointer*)&pdata->widget); - - /* since the DbusmenuMenuitem is being destroyed, uncache it from the GtkWidget */ - g_object_steal_data(o, CACHED_MENUITEM); + disconnect_from_widget (pdata->widget); } if (pdata->settings != NULL) { @@ -379,7 +406,7 @@ new_menuitem (GtkWidget * widget) pdata->widget = widget; g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->widget); - g_object_set_data(G_OBJECT(widget), CACHED_MENUITEM, item); + g_object_set_data_full(G_OBJECT(widget), CACHED_MENUITEM, g_object_ref(item), g_object_unref); return item; } @@ -1387,24 +1414,19 @@ item_inserted_cb (GtkContainer *menu, /* A child item was removed from a menu we're watching. */ static void -item_removed_cb (GtkContainer *menu, GtkWidget *widget, gpointer data) +item_removed_cb (GtkContainer *parent_w, GtkWidget *child_w, gpointer data) { - gpointer pmi = g_object_get_data(G_OBJECT(widget), CACHED_MENUITEM); - if (pmi == NULL) { - return; - } + DbusmenuMenuitem * child_mi; - DbusmenuMenuitem * child = DBUSMENU_MENUITEM(pmi); - - pmi = g_object_get_data(G_OBJECT(menu), CACHED_MENUITEM); - if (pmi == NULL) { - return; - } + if ((child_mi = dbusmenu_gtk_parse_get_cached_item (child_w))) + { + DbusmenuMenuitem * parent_mi; - DbusmenuMenuitem * parent = DBUSMENU_MENUITEM(pmi); + if ((parent_mi = dbusmenu_gtk_parse_get_cached_item (GTK_WIDGET(parent_w)))) + dbusmenu_menuitem_child_delete (parent_mi, child_mi); - dbusmenu_menuitem_child_delete(parent, child); - return; + disconnect_from_widget (child_w); + } } static gboolean diff --git a/tests/Makefile.am b/tests/Makefile.am index 69b9f26..177b4d8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,3 @@ - DBUS_RUNNER=dbus-test-runner --max-wait=0 CLEANFILES= @@ -29,7 +28,12 @@ TESTS += \ test-gtk-label \ test-gtk-shortcut \ test-gtk-reorder \ - test-gtk-parser-test + test-gtk-remove +# This is failing on Jenkins ARM but no where else that we +# can get debug output. So we're going to disable it for now +# as we have unity-gtk-module doing the majority of our GTK +# menu parsing today. +# test-gtk-parser-test # Not working with GTK3 and a critical grab that is in # the GTK3 code. # test-gtk-submenu @@ -81,6 +85,7 @@ check_PROGRAMS += \ test-gtk-label-server \ test-gtk-shortcut-client \ test-gtk-shortcut-server \ + test-gtk-remove-server \ test-gtk-reorder-server \ test-gtk-submenu-server \ test-gtk-submenu-client \ @@ -92,6 +97,22 @@ XVFB_RUN=". $(srcdir)/run-xvfb.sh" # for the GI tests, prefer/use the typelibs from the local build tree TESTS_ENVIRONMENT = env GI_TYPELIB_PATH=$(top_builddir)/libdbusmenu-glib:$(top_builddir)/libdbusmenu-gtk:$(GI_TYPELIB_PATH) +############################################ +# Shared vars for the dbusmenu-glib tests +############################################ + +DBUSMENU_GLIB_TEST_CFLAGS = \ + -Wall -Werror \ + -DG_DISABLE_DEPRECATED \ + -I$(top_srcdir) \ + $(DBUSMENUTESTS_CFLAGS) \ + $(DBUSMENUGLIB_CFLAGS) + +DBUSMENU_GLIB_TEST_LDADD = \ + $(top_builddir)/libdbusmenu-glib/libdbusmenu-glib.la \ + $(DBUSMENUGLIB_LIBS) \ + $(DBUSMENUTESTS_LIBS) + ###################### # JSON Loader lib ###################### @@ -113,18 +134,11 @@ libdbusmenu_jsonloader_la_LDFLAGS = \ -export-symbols-regex "^[^_].*" libdbusmenu_jsonloader_la_CFLAGS = \ - $(DBUSMENUGLIB_CFLAGS) \ - $(DBUSMENUTESTS_CFLAGS) \ - -I $(srcdir)/.. \ - -Wall \ - -Werror \ - -DG_DISABLE_DEPRECATED \ + $(DBUSMENU_GLIB_TEST_CFLAGS) \ -DG_LOG_DOMAIN="\"LIBDBUSMENU-JSONLOADER\"" libdbusmenu_jsonloader_la_LIBADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) \ - $(DBUSMENUTESTS_LIBS) + $(DBUSMENU_GLIB_TEST_LDADD) pkgconfig_DATA = dbusmenu-jsonloader-0.4.pc pkgconfigdir = $(libdir)/pkgconfig @@ -133,16 +147,9 @@ pkgconfigdir = $(libdir)/pkgconfig # Test GLib server ###################### -glib_server_nomenu_SOURCES = \ - glib-server-nomenu.c - -glib_server_nomenu_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -glib_server_nomenu_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) +glib_server_nomenu_SOURCES = glib-server-nomenu.c +glib_server_nomenu_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +glib_server_nomenu_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) ###################### # Test Glib Layout @@ -152,32 +159,17 @@ test-glib-layout: test-glib-layout-client test-glib-layout-server Makefile.am @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(DBUS_RUNNER) --task ./test-glib-layout-client --task-name Client --task ./test-glib-layout-server --task-name Server --ignore-return >> $@ @chmod +x $@ -test_glib_layout_server_SOURCES = \ - test-glib-layout.h \ - test-glib-layout-server.c +test_glib_layout_server_SOURCES = test-glib-layout.h test-glib-layout-server.c +test_glib_layout_server_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_glib_layout_server_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) -test_glib_layout_server_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_glib_layout_server_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) - -test_glib_layout_client_SOURCES = \ - test-glib-layout.h \ - 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) +test_glib_layout_client_SOURCES = test-glib-layout.h test-glib-layout-client.c +test_glib_layout_client_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_glib_layout_client_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) ###################### # Test Glib Events @@ -187,30 +179,17 @@ test-glib-events: test-glib-events-client test-glib-events-server Makefile.am @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(DBUS_RUNNER) --task ./test-glib-events-client --task-name Client --task ./test-glib-events-server --task-name Server --ignore-return >> $@ @chmod +x $@ -test_glib_events_server_SOURCES = \ - test-glib-events-server.c - -test_glib_events_server_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_glib_events_server_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) - -test_glib_events_client_SOURCES = \ - test-glib-events-client.c +test_glib_events_server_SOURCES = test-glib-events-server.c +test_glib_events_server_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_glib_events_server_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) -test_glib_events_client_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_glib_events_client_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) +test_glib_events_client_SOURCES = test-glib-events-client.c +test_glib_events_client_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_glib_events_client_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) ################################ # Test Glib Events No Grouping @@ -220,19 +199,13 @@ test-glib-events-nogroup: test-glib-events-nogroup-client test-glib-events-serve @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(DBUS_RUNNER) --task ./test-glib-events-nogroup-client --task-name Client --task ./test-glib-events-server --task-name Server --ignore-return >> $@ @chmod +x $@ -test_glib_events_nogroup_client_SOURCES = \ - test-glib-events-nogroup-client.c - -test_glib_events_nogroup_client_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_glib_events_nogroup_client_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) +test_glib_events_nogroup_client_SOURCES = test-glib-events-nogroup-client.c +test_glib_events_nogroup_client_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_glib_events_nogroup_client_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) ###################### # Test JSON @@ -242,6 +215,7 @@ test-json: test-json-client test-json-server Makefile.am @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(XVFB_RUN) >> $@ @echo $(DBUS_RUNNER) --task ./test-json-client --wait-for org.dbusmenu.test --task-name Client --parameter $(top_builddir)/tools/dbusmenu-dumper --parameter test-json-01.output.json --task ./test-json-server --task-name Server --parameter $(srcdir)/test-json-01.json >> $@ @echo diff $(srcdir)/test-json-01.json test-json-01.output.json \> /dev/null >> $@ @@ -253,30 +227,17 @@ test_json_server_SOURCES = \ test-json-server.c test_json_server_CFLAGS = \ - -I $(srcdir)/.. \ - -I $(srcdir) \ - $(DBUSMENUGLIB_CFLAGS) \ - $(DBUSMENUTESTS_CFLAGS) \ - $(DBUSMENUTESTSVALGRIND_CFLAGS) \ - -Wall -Werror + $(DBUSMENU_GLIB_TEST_CFLAGS) \ + -I$(srcdir) \ + $(DBUSMENUTESTSVALGRIND_CFLAGS) test_json_server_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ libdbusmenu-jsonloader.la \ - $(DBUSMENUTESTS_LIBS) \ - $(DBUSMENUGLIB_LIBS) + $(DBUSMENU_GLIB_TEST_LDADD) -test_json_client_SOURCES = \ - test-json-client.c - -test_json_client_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_json_client_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUTESTS_LIBS) \ - $(DBUSMENUGLIB_LIBS) +test_json_client_SOURCES = test-json-client.c +test_json_client_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_json_client_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) ######################### # Test JSON Instructions @@ -286,6 +247,7 @@ test-json-instruction: test-json-client test-json-server test-json-instruction-c @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(XVFB_RUN) >> $@ @echo $(DBUS_RUNNER) --task $(builddir)/test-json-client --wait-for org.dbusmenu.test --task-name Client --parameter $(top_builddir)/tools/dbusmenu-dumper --parameter /dev/null --task libtool --parameter --mode=execute --parameter $(srcdir)/test-json-instruction-count --parameter $(builddir)/test-json-server --task-name Server --parameter $(srcdir)/test-json-01.json >> $@ @chmod +x $@ @@ -305,32 +267,17 @@ test-glib-submenu: test-glib-submenu-client test-glib-submenu-server Makefile.am # in the grabbing code on GTK3. Since we can't add events to the stack # we can't remove this error from getting thrown :-( # @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(DBUS_RUNNER) --task ./test-glib-submenu-client --task-name Client --task ./test-glib-submenu-server --task-name Server --ignore-return >> $@ @chmod +x $@ -test_glib_submenu_server_SOURCES = \ - test-glib-submenu.h \ - test-glib-submenu-server.c - -test_glib_submenu_server_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror +test_glib_submenu_server_SOURCES = test-glib-submenu.h test-glib-submenu-server.c +test_glib_submenu_server_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_glib_submenu_server_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) -test_glib_submenu_server_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) - -test_glib_submenu_client_SOURCES = \ - test-glib-submenu.h \ - test-glib-submenu-client.c - -test_glib_submenu_client_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_glib_submenu_client_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) +test_glib_submenu_client_SOURCES = test-glib-submenu.h test-glib-submenu-client.c +test_glib_submenu_client_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_glib_submenu_client_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) ###################### # Test Glib Object @@ -342,19 +289,13 @@ test-glib-objects-test: test-glib-objects Makefile.am @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(DBUS_RUNNER) --task gtester --task-name test --parameter --verbose --parameter -k --parameter -o --parameter $(OBJECT_XML_REPORT) --parameter ./test-glib-objects >> $@ @chmod +x $@ -test_glib_objects_SOURCES = \ - test-glib-objects.c - -test_glib_objects_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_glib_objects_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) +test_glib_objects_SOURCES = test-glib-objects.c +test_glib_objects_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_glib_objects_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) DISTCLEANFILES += $(OBJECT_XML_REPORT) @@ -366,32 +307,17 @@ test-glib-properties: test-glib-properties-client test-glib-properties-server Ma @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(DBUS_RUNNER) --task ./test-glib-properties-client --task-name Client --task ./test-glib-properties-server --task-name Server --ignore-return >> $@ @chmod +x $@ -test_glib_properties_server_SOURCES = \ - test-glib-properties.h \ - test-glib-properties-server.c - -test_glib_properties_server_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_glib_properties_server_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) +test_glib_properties_server_SOURCES = test-glib-properties.h test-glib-properties-server.c +test_glib_properties_server_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_glib_properties_server_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) -test_glib_properties_client_SOURCES = \ - test-glib-properties.h \ - test-glib-properties-client.c - -test_glib_properties_client_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_glib_properties_client_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) +test_glib_properties_client_SOURCES = test-glib-properties.h test-glib-properties-client.c +test_glib_properties_client_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_glib_properties_client_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) ###################### # Test Glib Proxy @@ -401,6 +327,7 @@ test-glib-proxy: test-glib-proxy-client test-glib-proxy-server test-glib-proxy-p @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(DBUS_RUNNER) --task ./test-glib-proxy-client --task-name Client --task ./test-glib-proxy-server --task-name Server --ignore-return \\ >> $@ @echo --task ./test-glib-proxy-proxy --parameter test.proxy.first_proxy --parameter test.proxy.second_proxy --task-name Proxy01 --ignore-return \\ >> $@ @echo --task ./test-glib-proxy-proxy --parameter test.proxy.second_proxy --parameter test.proxy.third_proxy --task-name Proxy02 --ignore-return \\ >> $@ @@ -409,58 +336,40 @@ test-glib-proxy: test-glib-proxy-client test-glib-proxy-server test-glib-proxy-p @echo --task ./test-glib-proxy-proxy --parameter test.proxy.last_proxy --parameter test.proxy.server --task-name Proxy05 --ignore-return >> $@ @chmod +x $@ -test_glib_proxy_server_SOURCES = \ - test-glib-proxy.h \ - test-glib-proxy-server.c - -test_glib_proxy_server_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_glib_proxy_server_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) - -test_glib_proxy_client_SOURCES = \ - test-glib-proxy.h \ - test-glib-proxy-client.c - -test_glib_proxy_client_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_glib_proxy_client_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) +test_glib_proxy_server_SOURCES = test-glib-proxy.h test-glib-proxy-server.c +test_glib_proxy_server_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_glib_proxy_server_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) -test_glib_proxy_proxy_SOURCES = \ - test-glib-proxy.h \ - test-glib-proxy-proxy.c +test_glib_proxy_client_SOURCES = test-glib-proxy.h test-glib-proxy-client.c +test_glib_proxy_client_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_glib_proxy_client_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) -test_glib_proxy_proxy_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_glib_proxy_proxy_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) +test_glib_proxy_proxy_SOURCES = test-glib-proxy.h test-glib-proxy-proxy.c +test_glib_proxy_proxy_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_glib_proxy_proxy_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) ######################### # Test Glib Simple Items ######################### -test_glib_simple_items_SOURCES = \ - test-glib-simple-items.c +test_glib_simple_items_SOURCES = test-glib-simple-items.c +test_glib_simple_items_CFLAGS = $(DBUSMENU_GLIB_TEST_CFLAGS) +test_glib_simple_items_LDADD = $(DBUSMENU_GLIB_TEST_LDADD) -test_glib_simple_items_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror +EXTRA_DIST += test-glib-simple-items.py -test_glib_simple_items_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) +############################################ +# Shared vars for the dbusmenu-gtk tests +############################################ -EXTRA_DIST += test-glib-simple-items.py +DBUSMENU_GTK_TEST_CFLAGS = \ + $(DBUSMENUGTK_CFLAGS) \ + $(DBUSMENU_GLIB_TEST_CFLAGS) + +DBUSMENU_GTK_TEST_LDADD = \ + $(top_builddir)/libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \ + $(DBUSMENUGTK_LIBS) \ + $(DBUSMENU_GLIB_TEST_LDADD) ###################### # Test GTK Object @@ -472,25 +381,14 @@ test-gtk-objects-test: test-gtk-objects Makefile.am @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(XVFB_RUN) >> $@ @echo $(DBUS_RUNNER) --task gtester --task-name test --parameter --verbose --parameter -k --parameter -o --parameter $(GTK_OBJECT_XML_REPORT) --parameter ./test-gtk-objects >> $@ @chmod +x $@ -test_gtk_objects_SOURCES = \ - test-gtk-objects.c - -test_gtk_objects_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) \ - $(DBUSMENUGTK_CFLAGS) \ - -DSRCDIR="\"$(srcdir)\"" \ - -Wall -Werror - -test_gtk_objects_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \ - $(DBUSMENUGLIB_LIBS) \ - $(DBUSMENUGTK_LIBS) +test_gtk_objects_SOURCES = test-gtk-objects.c +test_gtk_objects_CFLAGS = $(DBUSMENU_GTK_TEST_CFLAGS) -DSRCDIR="\"$(srcdir)\"" +test_gtk_objects_LDADD = $(DBUSMENU_GTK_TEST_LDADD) DISTCLEANFILES += $(GTK_OBJECT_XML_REPORT) @@ -504,25 +402,14 @@ test-gtk-parser-test: test-gtk-parser Makefile.am @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(XVFB_RUN) >> $@ - @echo gtester --verbose -k -o $(GTK_PARSER_XML_REPORT) ./test-gtk-parser >> $@ + @echo $(DBUS_RUNNER) --task gtester --task-name test --parameter --verbose --parameter -k --parameter -o --parameter $(GTK_PARSER_XML_REPORT) --parameter $(builddir)/test-gtk-parser >> $@ @chmod +x $@ -test_gtk_parser_SOURCES = \ - test-gtk-parser.c - -test_gtk_parser_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) \ - $(DBUSMENUGTK_CFLAGS) \ - -DSRCDIR="\"$(srcdir)\"" \ - -Wall -Werror - -test_gtk_parser_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \ - $(DBUSMENUGLIB_LIBS) \ - $(DBUSMENUGTK_LIBS) +test_gtk_parser_SOURCES = test-gtk-parser.c +test_gtk_parser_CFLAGS = $(DBUSMENU_GTK_TEST_CFLAGS) -DSRCDIR="\"$(srcdir)\"" +test_gtk_parser_LDADD = $(DBUSMENU_GTK_TEST_LDADD) DISTCLEANFILES += $(GTK_PARSER_XML_REPORT) @@ -534,40 +421,18 @@ test-gtk-label: test-gtk-label-client test-gtk-label-server test-gtk-label.json @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(XVFB_RUN) >> $@ @echo $(DBUS_RUNNER) --task ./test-gtk-label-client --task-name Client --task ./test-gtk-label-server --parameter $(srcdir)/test-gtk-label.json --task-name Server --ignore-return >> $@ @chmod +x $@ -test_gtk_label_server_SOURCES = \ - test-gtk-label-server.c - -test_gtk_label_server_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGTK_CFLAGS) \ - $(DBUSMENUTESTS_CFLAGS) \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_gtk_label_server_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \ - libdbusmenu-jsonloader.la \ - $(DBUSMENUGTK_LIBS) \ - $(DBUSMENUTESTS_LIBS) - -test_gtk_label_client_SOURCES = \ - test-gtk-label-client.c +test_gtk_label_server_SOURCES = test-gtk-label-server.c +test_gtk_label_server_CFLAGS = $(DBUSMENU_GTK_TEST_CFLAGS) +test_gtk_label_server_LDADD = libdbusmenu-jsonloader.la $(DBUSMENU_GTK_TEST_LDADD) -test_gtk_label_client_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGTK_CFLAGS) \ - $(DBUSMENUTESTS_CFLAGS) \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_gtk_label_client_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \ - $(DBUSMENUGTK_LIBS) \ - $(DBUSMENUTESTS_LIBS) +test_gtk_label_client_SOURCES = test-gtk-label-client.c +test_gtk_label_client_CFLAGS = $(DBUSMENU_GTK_TEST_CFLAGS) +test_gtk_label_client_LDADD = $(DBUSMENU_GTK_TEST_LDADD) ######################### # Test GTK Shortcut @@ -577,39 +442,18 @@ test-gtk-shortcut: test-gtk-shortcut-client test-gtk-shortcut-server Makefile.am @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(XVFB_RUN) >> $@ @echo $(DBUS_RUNNER) --task ./test-gtk-shortcut-client --task-name Client --task ./test-gtk-shortcut-server --task-name Server --ignore-return >> $@ @chmod +x $@ -test_gtk_shortcut_server_SOURCES = \ - test-gtk-shortcut-server.c +test_gtk_shortcut_server_SOURCES = test-gtk-shortcut-server.c +test_gtk_shortcut_server_CFLAGS = $(DBUSMENU_GTK_TEST_CFLAGS) +test_gtk_shortcut_server_LDADD = $(DBUSMENU_GTK_TEST_LDADD) -test_gtk_shortcut_server_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGTK_CFLAGS) \ - $(DBUSMENUTESTS_CFLAGS) \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_gtk_shortcut_server_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \ - $(DBUSMENUGTK_LIBS) \ - $(DBUSMENUTESTS_LIBS) - -test_gtk_shortcut_client_SOURCES = \ - test-gtk-shortcut-client.c - -test_gtk_shortcut_client_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGTK_CFLAGS) \ - $(DBUSMENUTESTS_CFLAGS) \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_gtk_shortcut_client_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \ - $(DBUSMENUGTK_LIBS) \ - $(DBUSMENUTESTS_LIBS) +test_gtk_shortcut_client_SOURCES = test-gtk-shortcut-client.c +test_gtk_shortcut_client_CFLAGS = $(DBUSMENU_GTK_TEST_CFLAGS) +test_gtk_shortcut_client_LDADD = $(DBUSMENU_GTK_TEST_LDADD) ######################### # Test GTK Shortcut Python @@ -619,6 +463,7 @@ test-gtk-shortcut-python: test-gtk-shortcut-server test-gtk-shortcut-client.py M @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(XVFB_RUN) >> $@ @echo $(DBUS_RUNNER) --task $(srcdir)/test-gtk-shortcut-client.py --task-name Client --task ./test-gtk-shortcut-server --task-name Server --ignore-return >> $@ @chmod +x $@ @@ -627,6 +472,23 @@ EXTRA_DIST += test-gtk-shortcut-client.py CLEANFILES += test-gtk-shortcut-client.pyc ######################### +# Test GTK Remove +######################### + +test-gtk-remove: test-gtk-remove-server Makefile.am + @echo "#!/bin/bash" > $@ + @echo export UBUNTU_MENUPROXY="" >> $@ + @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ + @echo $(XVFB_RUN) >> $@ + @echo $(DBUS_RUNNER) --task ./test-gtk-remove-server --parameter $(srcdir)/test-gtk-label.json --task-name Server --ignore-return >> $@ + @chmod +x $@ + +test_gtk_remove_server_SOURCES = test-gtk-remove-server.c +test_gtk_remove_server_CFLAGS = $(DBUSMENU_GTK_TEST_CFLAGS) +test_gtk_remove_server_LDADD = $(DBUSMENU_GTK_TEST_LDADD) + +######################### # Test GTK Reorder ######################### @@ -634,24 +496,14 @@ test-gtk-reorder: test-gtk-label-client test-gtk-reorder-server Makefile.am @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(XVFB_RUN) >> $@ @echo $(DBUS_RUNNER) --task ./test-gtk-label-client --task-name Client --task ./test-gtk-reorder-server --parameter $(srcdir)/test-gtk-label.json --task-name Server --ignore-return >> $@ @chmod +x $@ -test_gtk_reorder_server_SOURCES = \ - test-gtk-reorder-server.c - -test_gtk_reorder_server_CFLAGS = \ - -I $(srcdir)/.. \ - $(DBUSMENUGTK_CFLAGS) \ - $(DBUSMENUTESTS_CFLAGS) \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror - -test_gtk_reorder_server_LDADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \ - $(DBUSMENUGTK_LIBS) \ - $(DBUSMENUTESTS_LIBS) +test_gtk_reorder_server_SOURCES = test-gtk-reorder-server.c +test_gtk_reorder_server_CFLAGS = $(DBUSMENU_GTK_TEST_CFLAGS) +test_gtk_reorder_server_LDADD = $(DBUSMENU_GTK_TEST_LDADD) ######################### # Test GTK Submenu @@ -661,39 +513,18 @@ test-gtk-submenu: test-gtk-submenu-client test-gtk-submenu-server Makefile.am @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @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$(VER).la \ - $(DBUSMENUGTK_LIBS) \ - $(DBUSMENUTESTS_LIBS) +test_gtk_submenu_server_SOURCES = test-gtk-submenu-server.c +test_gtk_submenu_server_CFLAGS = $(DBUSMENU_GTK_TEST_CFLAGS) +test_gtk_submenu_server_LDADD = $(DBUSMENU_GTK_TEST_LDADD) -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$(VER).la \ - $(DBUSMENUGTK_LIBS) \ - $(DBUSMENUTESTS_LIBS) +test_gtk_submenu_client_SOURCES = test-gtk-submenu-client.c +test_gtk_submenu_client_CFLAGS = $(DBUSMENU_GTK_TEST_CFLAGS) +test_gtk_submenu_client_LDADD = $(DBUSMENU_GTK_TEST_LDADD) ######################### # Test Mago @@ -703,6 +534,7 @@ test-mago: test-gtk-label-client test-gtk-label-server $(srcdir)/dbusmenu-gtk/ma @echo "#!/bin/bash" > $@ @echo export UBUNTU_MENUPROXY="" >> $@ @echo export G_DEBUG=fatal_criticals >> $@ + @echo export G_MESSAGES_DEBUG=all >> $@ @echo $(XVFB_RUN) >> $@ @echo cd $(srcdir)/dbusmenu-gtk >> $@ @echo /usr/lib/at-spi/at-spi-registryd \& >> $@ diff --git a/tests/test-glib-layout-client.c b/tests/test-glib-layout-client.c index 83b47ee..265b34f 100644 --- a/tests/test-glib-layout-client.c +++ b/tests/test-glib-layout-client.c @@ -117,7 +117,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_timeout_add_seconds(10, timer_func, client); + g_timeout_add_seconds(60, timer_func, client); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); diff --git a/tests/test-glib-properties-client.c b/tests/test-glib-properties-client.c index 3d6aa9d..f77eab6 100644 --- a/tests/test-glib-properties-client.c +++ b/tests/test-glib-properties-client.c @@ -26,6 +26,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include "test-glib-properties.h" +#define DEATH_TIME 60 + static guint layouton = 0; static GMainLoop * mainloop = NULL; static gboolean passed = TRUE; @@ -137,7 +139,7 @@ layout_verify_timer (gpointer data) } else { /* Extend our death */ g_source_remove(death_timer); - death_timer = g_timeout_add_seconds(10, timer_func, data); + death_timer = g_timeout_add_seconds(DEATH_TIME, timer_func, data); } layouton++; @@ -158,7 +160,7 @@ main (int argc, char ** argv) DbusmenuClient * client = dbusmenu_client_new(":1.0", "/org/test"); g_signal_connect(G_OBJECT(client), DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED, G_CALLBACK(layout_updated), NULL); - death_timer = g_timeout_add_seconds(10, timer_func, client); + death_timer = g_timeout_add_seconds(DEATH_TIME, timer_func, client); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); diff --git a/tests/test-glib-proxy-client.c b/tests/test-glib-proxy-client.c index 8f760a2..6421dc9 100644 --- a/tests/test-glib-proxy-client.c +++ b/tests/test-glib-proxy-client.c @@ -26,6 +26,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include "test-glib-proxy.h" +#define DEATH_TIME 60 + static guint layouton = -2; static GMainLoop * mainloop = NULL; static gboolean passed = TRUE; @@ -123,7 +125,7 @@ layout_updated (DbusmenuClient * client, gpointer data) g_source_remove(verify_timer); } - verify_timer = g_timeout_add (3000, layout_verify_timer, client); + verify_timer = g_timeout_add_seconds (10, layout_verify_timer, client); return; } @@ -143,7 +145,7 @@ layout_verify_timer (gpointer data) } else { /* Extend our death */ g_source_remove(death_timer); - death_timer = g_timeout_add_seconds(4, timer_func, data); + death_timer = g_timeout_add_seconds(DEATH_TIME, timer_func, data); } if (layouts[layouton+1].id == -1) { @@ -162,7 +164,7 @@ main (int argc, char ** argv) DbusmenuClient * client = dbusmenu_client_new("test.proxy.first_proxy", "/org/test"); g_signal_connect(G_OBJECT(client), DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED, G_CALLBACK(layout_updated), NULL); - death_timer = g_timeout_add_seconds(4, timer_func, client); + death_timer = g_timeout_add_seconds(DEATH_TIME, timer_func, client); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); diff --git a/tests/test-glib-proxy-server.c b/tests/test-glib-proxy-server.c index 6823cec..ccb4cb8 100644 --- a/tests/test-glib-proxy-server.c +++ b/tests/test-glib-proxy-server.c @@ -95,7 +95,7 @@ layout_change (DbusmenuMenuitem * oldroot, guint timestamp, gpointer data) if (death_timer != 0) { g_source_remove(death_timer); } - death_timer = g_timeout_add_seconds(4, timer_func, data); + death_timer = g_timeout_add_seconds(60, timer_func, data); return; } diff --git a/tests/test-glib-simple-items.c b/tests/test-glib-simple-items.c index 1fff8bf..f4086a4 100644 --- a/tests/test-glib-simple-items.c +++ b/tests/test-glib-simple-items.c @@ -25,7 +25,7 @@ dummy_users (DbusmenuMenuitem * root) { static gboolean quititall (gpointer data) { - g_main_quit(mainloop); + g_main_loop_quit(mainloop); return FALSE; } diff --git a/tests/test-glib-submenu-client.c b/tests/test-glib-submenu-client.c index 29d7720..097e91d 100644 --- a/tests/test-glib-submenu-client.c +++ b/tests/test-glib-submenu-client.c @@ -100,7 +100,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_timeout_add_seconds(10, timer_func, client); + g_timeout_add_seconds(60, timer_func, client); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); diff --git a/tests/test-gtk-remove-server.c b/tests/test-gtk-remove-server.c new file mode 100644 index 0000000..0655fc0 --- /dev/null +++ b/tests/test-gtk-remove-server.c @@ -0,0 +1,118 @@ +/* + Confirm that no warnings/criticals get generated by including + multiple add/removes in a match w/o waiting on the mainloop to iterate. + + Copyright 2013 Canonical Ltd. + + Original sample code by Drew Bliss <drewb@valvesoftware.com> + Modified for automatic testing by Charles Kerr <charles.kerr@canonical.com> + */ + +#include <stdlib.h> /* exit() */ +#include <gtk/gtk.h> +#include <libdbusmenu-glib/server.h> +#include <libdbusmenu-gtk/menu.h> +#include <libdbusmenu-gtk/parser.h> + +static GMainLoop * loop = NULL; +static GtkWidget * top_gtk = NULL; +static DbusmenuMenuitem * top_dbusmenu = NULL; +static DbusmenuServer * menuservice = NULL; + +static void +rebuild_menu (void) +{ + GList * l; + GList * children; + int i; + const int n = 10; + static int count = 0; + + if (top_gtk == NULL) + { + top_gtk = gtk_menu_new (); + gtk_widget_show (top_gtk); + top_dbusmenu = dbusmenu_gtk_parse_menu_structure (top_gtk); + menuservice = dbusmenu_server_new ("/org/ayatana/NotificationItem/test/Menu"); + dbusmenu_server_set_root (menuservice, top_dbusmenu); + } + + // remove all the previous children + children = gtk_container_get_children (GTK_CONTAINER(top_gtk)); + for (l=children; l!=NULL; l=l->next) + gtk_widget_destroy (GTK_WIDGET (l->data)); + + // add a handful of new children + for (i=0; i<n; ++i) + { + char buf[80]; + GtkWidget * child; + + g_snprintf (buf, sizeof(buf), "Test item %d", ++count); + child = gtk_menu_item_new_with_label (buf); + gtk_menu_shell_append (GTK_MENU_SHELL(top_gtk), child); + gtk_widget_show (child); + } +} + +/* + * Periodically rebuild the menu. + * + * After we've looped a couple of times with only one rebuild, + * attempt to reproduce the bug Drew reported by rebuilding multiple + * times before returning control to the main loop. + * + * If we survive doing this a handful of times without encountering + * a g_warning or g_critical, pass the test. + */ +static gint +on_timer (gpointer unused G_GNUC_UNUSED) +{ + static int iteration = 0; + + ++iteration; + + if (iteration > 5) + { + g_main_loop_quit (loop); + return G_SOURCE_REMOVE; + } + + if (iteration <= 2) + { + rebuild_menu (); + } + else + { + int i; + + for (i=0; i<iteration; ++i) + rebuild_menu (); + } + + return G_SOURCE_CONTINUE; +} + +static void +warning_counter (const gchar * log_domain, + GLogLevelFlags log_level G_GNUC_UNUSED, + const gchar * message, + gpointer user_data G_GNUC_UNUSED) +{ + g_message ("Failing the test due to warning: %s %s", log_domain, message); + exit (EXIT_FAILURE); +} + +int +main (int argc, char ** argv) +{ + g_log_set_handler ("LIBDBUSMENU-GLIB", G_LOG_LEVEL_WARNING|G_LOG_LEVEL_CRITICAL, warning_counter, NULL); + + + gtk_init (&argc, &argv); + loop = g_main_loop_new (NULL, FALSE); + g_timeout_add (200, on_timer, NULL); + g_main_loop_run (loop); + + return 0; +} diff --git a/tests/test-gtk-reorder-server.c b/tests/test-gtk-reorder-server.c index d0fba82..560820e 100644 --- a/tests/test-gtk-reorder-server.c +++ b/tests/test-gtk-reorder-server.c @@ -52,7 +52,7 @@ static gboolean timer_func (gpointer data) { if (test == NUMBER_TESTS) { - g_main_quit(mainloop); + g_main_loop_quit(mainloop); return FALSE; } diff --git a/tests/test-gtk-shortcut-client.c b/tests/test-gtk-shortcut-client.c index 259e177..7147ce2 100644 --- a/tests/test-gtk-shortcut-client.c +++ b/tests/test-gtk-shortcut-client.c @@ -60,7 +60,7 @@ main (int argc, char ** argv) gtk_window_add_accel_group(GTK_WINDOW(window), agroup); gtk_widget_show(window); - death_timer = g_timeout_add_seconds(10, timer_func, window); + death_timer = g_timeout_add_seconds(60, timer_func, window); g_debug("Entering Mainloop"); mainloop = g_main_loop_new(NULL, FALSE); |