[gtk+] Dump more accessibility data



commit d36d6172d2f2f3f2377d5af302819be6a07aa63e
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 19 11:32:43 2011 -0400

    Dump more accessibility data
    
    This commit adds dumping of parents, attributes and states.
    The expected dump output has been adjusted to match.

 tests/a11y/accessibility-dump.c |   56 ++++++++++++++++++++++++++++++++++++++-
 tests/a11y/accessible-name.txt  |    7 +++++
 tests/a11y/hello-world.txt      |    7 +++++
 tests/a11y/mnemonic.txt         |   16 +++++++++++
 4 files changed, 85 insertions(+), 1 deletions(-)
---
diff --git a/tests/a11y/accessibility-dump.c b/tests/a11y/accessibility-dump.c
index e1e2a96..0d97f1a 100644
--- a/tests/a11y/accessibility-dump.c
+++ b/tests/a11y/accessibility-dump.c
@@ -174,6 +174,54 @@ dump_relation_set (GString        *string,
 }
 
 static void
+dump_state_set (GString     *string,
+                guint        depth,
+                AtkStateSet *set)
+{
+  guint i;
+
+  if (set == NULL)
+    return;
+
+  if (atk_state_set_is_empty (set))
+    return;
+
+  g_string_append_printf (string, "%*sstate:", depth, "");
+  for (i = 0; i < ATK_STATE_LAST_DEFINED; i++)
+    {
+      if (atk_state_set_contains_state (set, i))
+        g_string_append_printf (string, " %s", atk_state_type_get_name (i));
+    }
+  g_string_append_c (string, '\n');
+
+  g_object_unref (set);
+}
+
+static void
+dump_attribute (GString      *string,
+                guint         depth,
+                AtkAttribute *attribute)
+{
+  g_string_append_printf (string, "%*s%s: %s\n", depth, "", attribute->name, attribute->value);
+}
+
+static void
+dump_attribute_set (GString         *string,
+                    guint            depth,
+                    AtkAttributeSet *set)
+{
+  GSList *l;
+  AtkAttribute *attribute;
+
+  for (l = set; l; l = l->next)
+    {
+      attribute = l->data;
+
+      dump_attribute (string, depth, attribute);
+    }
+}
+
+static void
 dump_accessible (AtkObject     *accessible,
                  guint          depth,
                  GString       *string)
@@ -184,12 +232,18 @@ dump_accessible (AtkObject     *accessible,
   depth += DEPTH_INCREMENT;
 
   g_string_append_printf (string, "%*s\"%s\"\n", depth, "", atk_role_get_name (atk_object_get_role (accessible)));
+  if (atk_object_get_parent (accessible))
+    g_string_append_printf (string, "%*sparent: %s\n", depth, "", get_name (atk_object_get_parent (accessible)));
+  if (atk_object_get_index_in_parent (accessible) != -1)
+    g_string_append_printf (string, "%*sindex: %d\n", depth, "", atk_object_get_index_in_parent (accessible));
   if (atk_object_get_name (accessible))
     g_string_append_printf (string, "%*sname: %s\n", depth, "", atk_object_get_name (accessible));
   if (atk_object_get_description (accessible))
     g_string_append_printf (string, "%*sdescription: %s\n", depth, "", atk_object_get_description (accessible));
   dump_relation_set (string, depth, atk_object_ref_relation_set (accessible));
-  
+  dump_state_set (string, depth, atk_object_ref_state_set (accessible));
+  dump_attribute_set (string, depth, atk_object_get_attributes (accessible));
+
   for (i = 0; i < atk_object_get_n_accessible_children (accessible); i++)
     {
       AtkObject *child = atk_object_ref_accessible_child (accessible, i);
diff --git a/tests/a11y/accessible-name.txt b/tests/a11y/accessible-name.txt
index f924c61..588a278 100644
--- a/tests/a11y/accessible-name.txt
+++ b/tests/a11y/accessible-name.txt
@@ -1,5 +1,12 @@
 window1
   "window"
+  index: 0
+  state: enabled resizable sensitive showing visible
+  toolkit: gail
   button1
     "push button"
+    parent: window1
+    index: 0
     name: Accessible name
+    state: enabled focusable sensitive showing visible
+    toolkit: gail
diff --git a/tests/a11y/hello-world.txt b/tests/a11y/hello-world.txt
index d6b0fbb..c52e404 100644
--- a/tests/a11y/hello-world.txt
+++ b/tests/a11y/hello-world.txt
@@ -1,5 +1,12 @@
 window1
   "window"
+  index: 0
+  state: enabled resizable sensitive showing visible
+  toolkit: gail
   button1
     "push button"
+    parent: window1
+    index: 0
     name: Hello World!
+    state: enabled focusable sensitive showing visible
+    toolkit: gail
diff --git a/tests/a11y/mnemonic.txt b/tests/a11y/mnemonic.txt
index d7403c1..952915e 100644
--- a/tests/a11y/mnemonic.txt
+++ b/tests/a11y/mnemonic.txt
@@ -1,11 +1,27 @@
 window1
   "window"
+  index: 0
+  state: enabled resizable sensitive showing visible
+  toolkit: gail
   box1
     "filler"
+    parent: window1
+    index: 0
+    state: enabled horizontal sensitive
+    toolkit: gail
     label1
       "label"
+      parent: box1
+      index: 0
       name: Entry:
       label-for: entry1
+      state: enabled multi-line sensitive visible
+      toolkit: gail
     entry1
       "text"
+      parent: box1
+      index: 1
       labelled-by: label1
+      state: editable enabled focusable sensitive single-line visible
+      toolkit: gail
+)



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