[gtk+] Dump AtkText properties too



commit 76f71b8f9cca5d3a8d79e19a0e47576e19b37332
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 19 14:56:05 2011 -0400

    Dump AtkText properties too
    
    ...would be nice if these actually _were_ properties.
    Update the expected output to match.

 tests/a11y/accessibility-dump.c |   25 +++++++++++++++++++++++++
 tests/a11y/accessible-name.txt  |    2 ++
 tests/a11y/hello-world.txt      |    2 ++
 tests/a11y/mnemonic.txt         |    4 ++++
 4 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/tests/a11y/accessibility-dump.c b/tests/a11y/accessibility-dump.c
index aadd7f2..6a8fcee 100644
--- a/tests/a11y/accessibility-dump.c
+++ b/tests/a11y/accessibility-dump.c
@@ -222,6 +222,29 @@ dump_attribute_set (GString         *string,
 }
 
 static void
+dump_atk_text (AtkText *atk_text,
+               guint    depth,
+               GString *string)
+{
+  gchar *text;
+  gint i, start, end;
+
+  text = atk_text_get_text (atk_text, 0, -1);
+  g_string_append_printf (string, "%*stext: %s\n", depth, "", text);
+  g_free (text);
+
+  g_string_append_printf (string, "%*scaret offset: %d\n", depth, "", atk_text_get_caret_offset (atk_text));
+
+  for (i = 0; i < atk_text_get_n_selections (atk_text); i++)
+    {
+      text = atk_text_get_selection (atk_text, i, &start, &end);
+      if (text)
+        g_string_append_printf (string, "%*sselection %d: (%d, %d) %s\n", depth, "", i, start, end, text);
+      g_free (text);
+    }
+}
+
+static void
 dump_accessible (AtkObject     *accessible,
                  guint          depth,
                  GString       *string)
@@ -243,6 +266,8 @@ dump_accessible (AtkObject     *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));
+  if (ATK_IS_TEXT (accessible))
+    dump_atk_text (ATK_TEXT (accessible), depth, string);
 
   for (i = 0; i < atk_object_get_n_accessible_children (accessible); i++)
     {
diff --git a/tests/a11y/accessible-name.txt b/tests/a11y/accessible-name.txt
index 588a278..7105697 100644
--- a/tests/a11y/accessible-name.txt
+++ b/tests/a11y/accessible-name.txt
@@ -10,3 +10,5 @@ window1
     name: Accessible name
     state: enabled focusable sensitive showing visible
     toolkit: gail
+    text: Hello World!
+    caret offset: 0
diff --git a/tests/a11y/hello-world.txt b/tests/a11y/hello-world.txt
index c52e404..b3b8e8f 100644
--- a/tests/a11y/hello-world.txt
+++ b/tests/a11y/hello-world.txt
@@ -10,3 +10,5 @@ window1
     name: Hello World!
     state: enabled focusable sensitive showing visible
     toolkit: gail
+    text: Hello World!
+    caret offset: 0
diff --git a/tests/a11y/mnemonic.txt b/tests/a11y/mnemonic.txt
index 0fe81d2..354b274 100644
--- a/tests/a11y/mnemonic.txt
+++ b/tests/a11y/mnemonic.txt
@@ -17,6 +17,8 @@ window1
       label-for: entry1
       state: enabled multi-line sensitive visible
       toolkit: gail
+      text: Entry:
+      caret offset: 0
     entry1
       "text"
       parent: box1
@@ -24,3 +26,5 @@ window1
       labelled-by: label1
       state: editable enabled focusable sensitive single-line visible
       toolkit: gail
+      text: text
+      caret offset: 0



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