aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am54
-rw-r--r--tests/test-gtk-label-client.c2
-rw-r--r--tests/test-gtk-label.json53
-rw-r--r--tests/test-gtk-objects.c4
-rw-r--r--tests/test-gtk-parser.c16
-rw-r--r--tests/test-gtk-shortcut-client.c2
-rw-r--r--tests/test-gtk-shortcut-server.c4
-rw-r--r--tests/test-gtk-submenu-client.c2
8 files changed, 119 insertions, 18 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a2c0716..a4e8682 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -12,14 +12,25 @@ TESTS = \
test-glib-properties \
test-glib-proxy \
test-glib-simple-items \
- test-glib-submenu \
- test-json \
+ test-glib-submenu
+
+if WANT_DBUSMENUDUMPER
+TESTS += \
+ test-json
+endif
+
+if WANT_LIBDBUSMENUGTK
+TESTS += \
test-gtk-objects-test \
test-gtk-label \
test-gtk-shortcut \
test-gtk-reorder \
test-gtk-submenu \
test-gtk-parser-test
+endif
+
+XFAIL_TESTS = \
+ test-glib-proxy
# The Python test only work on the system copy of
# dbusmenu, so while they can be usefule they're not
@@ -41,20 +52,28 @@ check_PROGRAMS = \
test-glib-proxy-client \
test-glib-proxy-server \
test-glib-proxy-proxy \
- test-gtk-objects \
test-glib-submenu-client \
test-glib-submenu-server \
+ test-glib-simple-items
+
+if WANT_DBUSMENUDUMPER
+check_PROGRAMS += \
+ test-json-client \
+ test-json-server
+endif
+
+if WANT_LIBDBUSMENUGTK
+check_PROGRAMS += \
+ test-gtk-objects \
test-gtk-label-client \
test-gtk-label-server \
test-gtk-shortcut-client \
test-gtk-shortcut-server \
- test-glib-simple-items \
test-gtk-reorder-server \
- test-json-client \
- test-json-server \
test-gtk-submenu-server \
test-gtk-submenu-client \
test-gtk-parser
+endif
XVFB_RUN=". $(srcdir)/run-xvfb.sh"
@@ -399,7 +418,7 @@ test_gtk_objects_CFLAGS = \
test_gtk_objects_LDADD = \
../libdbusmenu-glib/libdbusmenu-glib.la \
- ../libdbusmenu-gtk/libdbusmenu-gtk.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \
$(DBUSMENUGLIB_LIBS) \
$(DBUSMENUGTK_LIBS)
@@ -429,7 +448,7 @@ test_gtk_parser_CFLAGS = \
test_gtk_parser_LDADD = \
../libdbusmenu-glib/libdbusmenu-glib.la \
- ../libdbusmenu-gtk/libdbusmenu-gtk.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \
$(DBUSMENUGLIB_LIBS) \
$(DBUSMENUGTK_LIBS)
@@ -456,7 +475,7 @@ test_gtk_label_server_CFLAGS = \
test_gtk_label_server_LDADD = \
../libdbusmenu-glib/libdbusmenu-glib.la \
- ../libdbusmenu-gtk/libdbusmenu-gtk.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \
libdbusmenu-jsonloader.la \
$(DBUSMENUGTK_LIBS) \
$(DBUSMENUTESTS_LIBS)
@@ -472,7 +491,7 @@ test_gtk_label_client_CFLAGS = \
test_gtk_label_client_LDADD = \
../libdbusmenu-glib/libdbusmenu-glib.la \
- ../libdbusmenu-gtk/libdbusmenu-gtk.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \
$(DBUSMENUGTK_LIBS) \
$(DBUSMENUTESTS_LIBS)
@@ -497,7 +516,7 @@ test_gtk_shortcut_server_CFLAGS = \
test_gtk_shortcut_server_LDADD = \
../libdbusmenu-glib/libdbusmenu-glib.la \
- ../libdbusmenu-gtk/libdbusmenu-gtk.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \
$(DBUSMENUGTK_LIBS) \
$(DBUSMENUTESTS_LIBS)
@@ -512,7 +531,7 @@ test_gtk_shortcut_client_CFLAGS = \
test_gtk_shortcut_client_LDADD = \
../libdbusmenu-glib/libdbusmenu-glib.la \
- ../libdbusmenu-gtk/libdbusmenu-gtk.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \
$(DBUSMENUGTK_LIBS) \
$(DBUSMENUTESTS_LIBS)
@@ -550,7 +569,7 @@ test_gtk_reorder_server_CFLAGS = \
test_gtk_reorder_server_LDADD = \
../libdbusmenu-glib/libdbusmenu-glib.la \
- ../libdbusmenu-gtk/libdbusmenu-gtk.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \
$(DBUSMENUGTK_LIBS) \
$(DBUSMENUTESTS_LIBS)
@@ -575,7 +594,7 @@ test_gtk_submenu_server_CFLAGS = \
test_gtk_submenu_server_LDADD = \
../libdbusmenu-glib/libdbusmenu-glib.la \
- ../libdbusmenu-gtk/libdbusmenu-gtk.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \
$(DBUSMENUGTK_LIBS) \
$(DBUSMENUTESTS_LIBS)
@@ -590,7 +609,7 @@ test_gtk_submenu_client_CFLAGS = \
test_gtk_submenu_client_LDADD = \
../libdbusmenu-glib/libdbusmenu-glib.la \
- ../libdbusmenu-gtk/libdbusmenu-gtk.la \
+ ../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \
$(DBUSMENUGTK_LIBS) \
$(DBUSMENUTESTS_LIBS)
@@ -658,3 +677,8 @@ distclean-local:
DISTCLEANFILES += \
$(filter-out %.py, $(TESTS))
+if USE_GTK3
+VER=3
+else
+VER=
+endif
diff --git a/tests/test-gtk-label-client.c b/tests/test-gtk-label-client.c
index 14eb5bd..415c6b0 100644
--- a/tests/test-gtk-label-client.c
+++ b/tests/test-gtk-label-client.c
@@ -160,7 +160,7 @@ main (int argc, char ** argv)
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_menu_shell_append(GTK_MENU_SHELL(menubar), menuitem);
gtk_widget_show(menubar);
gtk_container_add(GTK_CONTAINER(window), menubar);
gtk_window_set_title(GTK_WINDOW(window), "libdbusmenu-gtk test");
diff --git a/tests/test-gtk-label.json b/tests/test-gtk-label.json
index 0189fbe..86d18e8 100644
--- a/tests/test-gtk-label.json
+++ b/tests/test-gtk-label.json
@@ -367,5 +367,58 @@ QmCC",
"toggle-state": -1
}
]
+ },
+ {"id": 1, "type": "standard",
+ "label": "value1",
+ "submenu": [
+ {"id": 60,
+ "label": "Disposition Normal",
+ "disposition": "normal"
+ },
+ {"id": 61,
+ "label": "Disposition Info",
+ "disposition": "informational"
+ },
+ {"id": 62,
+ "label": "Disposition Warning",
+ "disposition": "warning"
+ },
+ {"id": 63,
+ "label": "Disposition Alert",
+ "disposition": "alert"
+ }
+ ]
+ },
+ {"id": 1, "type": "standard",
+ "label": "value1",
+ "submenu": [
+ {"id": 70,
+ "label": "_Mnemonic"
+ },
+ {"id": 71,
+ "label": "M_nemonic"
+ },
+ {"id": 72,
+ "label": "Mn_emonic"
+ },
+ {"id": 73,
+ "label": "Mne_monic"
+ },
+ {"id": 74,
+ "label": "Mnem_onic"
+ },
+ {"id": 75,
+ "label": "Mnemo_nic"
+ },
+ {"id": 76,
+ "label": "Mnemon_ic"
+ },
+ {"id": 77,
+ "label": "Mnemoni_c"
+ },
+ {"id": 78,
+ "label": "__Underline__"
+ }
+ ]
}
]
diff --git a/tests/test-gtk-objects.c b/tests/test-gtk-objects.c
index 30fc022..4bd26d3 100644
--- a/tests/test-gtk-objects.c
+++ b/tests/test-gtk-objects.c
@@ -97,7 +97,11 @@ test_object_prop_shortcut (void)
g_assert(G_IS_OBJECT(item));
g_assert(DBUSMENU_IS_MENUITEM(item));
+#if GTK_CHECK_VERSION(3,0,0)
+ guint key = GDK_KEY_c;
+#else
guint key = GDK_c;
+#endif
GdkModifierType modifier = GDK_CONTROL_MASK;
/* Set a shortcut */
diff --git a/tests/test-gtk-parser.c b/tests/test-gtk-parser.c
index b66b46a..afd6194 100644
--- a/tests/test-gtk-parser.c
+++ b/tests/test-gtk-parser.c
@@ -28,6 +28,8 @@ test_parser_runs (void)
{
GtkWidget * gmi = gtk_menu_item_new_with_label("Test Item");
g_assert(gmi != NULL);
+ g_object_ref_sink(gmi);
+
DbusmenuMenuitem * mi = dbusmenu_gtk_parse_menu_structure(gmi);
g_assert(mi != NULL);
@@ -55,9 +57,23 @@ const gchar * test_parser_children_builder =
"</object>"
"</interface>";
+/* Checks the log level to let warnings not stop the program */
+static gboolean
+test_parser_children_log_handler (const gchar * domain, GLogLevelFlags level, const gchar * message, gpointer user_data)
+{
+ if (level & (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/* Ensure the parser can find children */
static void
test_parser_children (void) {
+ /* Hide GTK errors */
+ g_test_log_set_fatal_handler(test_parser_children_log_handler, NULL);
+
GtkBuilder * builder = gtk_builder_new();
g_assert(builder != NULL);
diff --git a/tests/test-gtk-shortcut-client.c b/tests/test-gtk-shortcut-client.c
index 003885c..259e177 100644
--- a/tests/test-gtk-shortcut-client.c
+++ b/tests/test-gtk-shortcut-client.c
@@ -53,7 +53,7 @@ main (int argc, char ** argv)
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(dmenu));
gtk_widget_show(menuitem);
- gtk_menu_bar_append(menubar, menuitem);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menubar), menuitem);
gtk_widget_show(menubar);
gtk_container_add(GTK_CONTAINER(window), menubar);
gtk_window_set_title(GTK_WINDOW(window), "libdbusmenu-gtk test");
diff --git a/tests/test-gtk-shortcut-server.c b/tests/test-gtk-shortcut-server.c
index b205d03..5df4881 100644
--- a/tests/test-gtk-shortcut-server.c
+++ b/tests/test-gtk-shortcut-server.c
@@ -46,7 +46,11 @@ build_menu (void)
item = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, "Control-L");
+#if GTK_CHECK_VERSION(3,0,0)
+ dbusmenu_menuitem_property_set_shortcut(item, GDK_KEY_l, GDK_CONTROL_MASK);
+#else
dbusmenu_menuitem_property_set_shortcut(item, GDK_l, GDK_CONTROL_MASK);
+#endif
dbusmenu_menuitem_child_append(root, item);
g_object_unref(item);
diff --git a/tests/test-gtk-submenu-client.c b/tests/test-gtk-submenu-client.c
index ec46122..81637f1 100644
--- a/tests/test-gtk-submenu-client.c
+++ b/tests/test-gtk-submenu-client.c
@@ -127,7 +127,7 @@ main (int argc, char ** argv)
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_menu_shell_append(GTK_MENU_SHELL(menubar), menuitem);
gtk_widget_show(menubar);
gtk_container_add(GTK_CONTAINER(window), menubar);
gtk_window_set_title(GTK_WINDOW(window), "libdbusmenu-gtk test");