[libdazzle] tests: assert some status of the joined menus



commit de859a523858d4a0cc273d989a26cceb0f9becb3
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jul 10 18:06:43 2017 -0700

    tests: assert some status of the joined menus
    
    We want to make sure our attributes are passing through, so
    ensure this is the case as part of the test.

 tests/data/menus/joined1.ui |    1 +
 tests/test-joined-menu.c    |   28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/tests/data/menus/joined1.ui b/tests/data/menus/joined1.ui
index 8c522a0..c5bf5a4 100644
--- a/tests/data/menus/joined1.ui
+++ b/tests/data/menus/joined1.ui
@@ -7,6 +7,7 @@
         <attribute name="id">editor-document-open-in-new-frame</attribute>
         <attribute name="label" translatable="yes">Open in New Frame</attribute>
         <attribute name="action">layoutstack.open-in-new-frame</attribute>
+        <attribute name="verb-icon-name">document-open-symbolic</attribute>
       </item>
       <item>
         <attribute name="label" translatable="yes">Split</attribute>
diff --git a/tests/test-joined-menu.c b/tests/test-joined-menu.c
index f453888..9cac79a 100644
--- a/tests/test-joined-menu.c
+++ b/tests/test-joined-menu.c
@@ -35,6 +35,20 @@ main (gint argc,
   g_assert_no_error (error);
   menu1 = dzl_menu_manager_get_menu_by_id (manager, "document-menu");
 
+  {
+    g_autofree gchar *icon = NULL;
+    g_autoptr(GMenuModel) section = NULL;
+    gboolean r;
+
+    section = g_menu_model_get_item_link (G_MENU_MODEL (menu1), 0, "section");
+    g_assert (section != NULL);
+    g_assert_cmpint (g_menu_model_get_n_items (section), ==, 3);
+
+    r = g_menu_model_get_item_attribute (section, 0, "verb-icon-name", "s", &icon);
+    g_assert_true (r);
+    g_assert_cmpstr (icon, ==, "document-open-symbolic");
+  }
+
   dzl_menu_manager_add_filename (manager, filename2, &error);
   g_assert_no_error (error);
   menu2 = dzl_menu_manager_get_menu_by_id (manager, "frame-menu");
@@ -43,6 +57,20 @@ main (gint argc,
   dzl_joined_menu_append_menu (joined, G_MENU_MODEL (menu1));
   dzl_joined_menu_append_menu (joined, G_MENU_MODEL (menu2));
 
+  {
+    g_autofree gchar *icon = NULL;
+    g_autoptr(GMenuModel) section = NULL;
+    gboolean r;
+
+    section = g_menu_model_get_item_link (G_MENU_MODEL (joined), 0, "section");
+    g_assert (section != NULL);
+    g_assert_cmpint (g_menu_model_get_n_items (section), ==, 3);
+
+    r = g_menu_model_get_item_attribute (section, 0, "verb-icon-name", "s", &icon);
+    g_assert_true (r);
+    g_assert_cmpstr (icon, ==, "document-open-symbolic");
+  }
+
   window = g_object_new (GTK_TYPE_WINDOW,
                          "default-width", 100,
                          "default-height", 100,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]