aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2013-12-19 15:51:13 +0100
committerLars Uebernickel <lars.uebernickel@canonical.com>2013-12-19 15:51:13 +0100
commitb2d4deb6ed08dfb32db88d93ff4bf841eb7751e0 (patch)
treec3d5d376a16813eae6072484a49a855288da323d /tests
parentef145fcbec9ac6ab36940dc7d1f2a8ce91ce2dcf (diff)
downloadlibayatana-indicator-b2d4deb6ed08dfb32db88d93ff4bf841eb7751e0.tar.gz
libayatana-indicator-b2d4deb6ed08dfb32db88d93ff4bf841eb7751e0.tar.bz2
libayatana-indicator-b2d4deb6ed08dfb32db88d93ff4bf841eb7751e0.zip
test-indicator-ng: adapt to new gtkmodelmenuitem widget structure
Diffstat (limited to 'tests')
-rw-r--r--tests/test-indicator-ng.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/test-indicator-ng.c b/tests/test-indicator-ng.c
index 7b677d3..cf1f59a 100644
--- a/tests/test-indicator-ng.c
+++ b/tests/test-indicator-ng.c
@@ -98,6 +98,32 @@ test_instantiation_with_profile (void)
g_object_unref (indicator);
}
+/* From gtk+/testsuite/gtk/gtkmenu.c
+ *
+ * Returns the label of a GtkModelMenuItem, for which
+ * gtk_menu_item_get_label() returns NULL, because it uses its own
+ * widgets to accommodate an icon.
+ *
+ */
+static const gchar *
+get_label (GtkMenuItem *item)
+{
+ GList *children = gtk_container_get_children (GTK_CONTAINER (item));
+ const gchar *label = NULL;
+
+ while (children)
+ {
+ if (GTK_IS_CONTAINER (children->data))
+ children = g_list_concat (children, gtk_container_get_children (children->data));
+ else if (GTK_IS_LABEL (children->data))
+ label = gtk_label_get_text (children->data);
+
+ children = g_list_delete_link (children, children);
+ }
+
+ return label;
+}
+
static void
test_menu (void)
{
@@ -135,7 +161,7 @@ test_menu (void)
item = children->data;
g_assert (GTK_IS_MENU_ITEM (item));
g_assert (gtk_widget_is_sensitive (GTK_WIDGET (item)));
- g_assert_cmpstr (gtk_menu_item_get_label (item), ==, "Show");
+ g_assert_cmpstr (get_label (item), ==, "Show");
g_list_free (children);
}