[gtk+] More text properties



commit 58b4b410fa97626813dc4bc94360d7c860029c29
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 19 15:22:08 2011 -0400

    More text properties

 tests/a11y/accessibility-dump.c |   40 +++++++++++++++++++++++++++++++++++++++
 tests/a11y/accessible-name.txt  |    2 +
 tests/a11y/hello-world.txt      |    2 +
 tests/a11y/mnemonic.txt         |    4 +++
 4 files changed, 48 insertions(+), 0 deletions(-)
---
diff --git a/tests/a11y/accessibility-dump.c b/tests/a11y/accessibility-dump.c
index 6a8fcee..9bdc706 100644
--- a/tests/a11y/accessibility-dump.c
+++ b/tests/a11y/accessibility-dump.c
@@ -222,6 +222,42 @@ dump_attribute_set (GString         *string,
 }
 
 static void
+dump_text_attributes (GString         *string,
+                      gint             depth,
+                      const gchar     *name,
+                      AtkAttributeSet *attributes)
+{
+  GSList *l;
+  AtkAttribute *attr;
+  const gchar *value;
+
+  if (attributes == NULL)
+    return;
+
+  g_string_append_printf (string, "%*s%s:", depth, "", name);
+  for (l = attributes; l; l = l->next)
+    {
+      attr = l->data;
+      /* don't dump values that depend on the environment */
+      if (strcmp (attr->name, "family-name") == 0 ||
+          strcmp (attr->name, "size") == 0 ||
+          strcmp (attr->name, "weight") == 0 ||
+          strcmp (attr->name, "stretch") == 0 ||
+          strcmp (attr->name, "variant") == 0 ||
+          strcmp (attr->name, "style") == 0 ||
+          strcmp (attr->name, "language") == 0 ||
+          strcmp (attr->name, "direction") == 0)
+        value = "<omitted>";
+      else
+        value = attr->value;
+      g_string_append_printf (string, " %s:%s", attr->name, value);
+    }
+  g_string_append_c (string, '\n');
+
+  atk_attribute_set_free (attributes);
+}
+
+static void
 dump_atk_text (AtkText *atk_text,
                guint    depth,
                GString *string)
@@ -233,6 +269,8 @@ dump_atk_text (AtkText *atk_text,
   g_string_append_printf (string, "%*stext: %s\n", depth, "", text);
   g_free (text);
 
+  g_string_append_printf (string, "%*scharacter count: %d\n", depth, "", atk_text_get_character_count (atk_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++)
@@ -242,6 +280,8 @@ dump_atk_text (AtkText *atk_text,
         g_string_append_printf (string, "%*sselection %d: (%d, %d) %s\n", depth, "", i, start, end, text);
       g_free (text);
     }
+
+  dump_text_attributes (string, depth, "default attributes", atk_text_get_default_attributes (atk_text));
 }
 
 static void
diff --git a/tests/a11y/accessible-name.txt b/tests/a11y/accessible-name.txt
index 7105697..438054b 100644
--- a/tests/a11y/accessible-name.txt
+++ b/tests/a11y/accessible-name.txt
@@ -11,4 +11,6 @@ window1
     state: enabled focusable sensitive showing visible
     toolkit: gail
     text: Hello World!
+    character count: 12
     caret offset: 0
+    default attributes: left-margin:0 right-margin:0 indent:0 invisible:false editable:false pixels-above-lines:0 pixels-below-lines:0 pixels-inside-wrap:0 bg-full-height:0 scale:1 rise:0 underline:none strikethrough:false bg-stipple:false fg-stipple:false fg-color:0,0,0 bg-color:56540,56026,54741 wrap-mode:word justification:left size:<omitted> weight:<omitted> family-name:<omitted> stretch:<omitted> variant:<omitted> style:<omitted> language:<omitted> direction:<omitted>
diff --git a/tests/a11y/hello-world.txt b/tests/a11y/hello-world.txt
index b3b8e8f..6a76eee 100644
--- a/tests/a11y/hello-world.txt
+++ b/tests/a11y/hello-world.txt
@@ -11,4 +11,6 @@ window1
     state: enabled focusable sensitive showing visible
     toolkit: gail
     text: Hello World!
+    character count: 12
     caret offset: 0
+    default attributes: left-margin:0 right-margin:0 indent:0 invisible:false editable:false pixels-above-lines:0 pixels-below-lines:0 pixels-inside-wrap:0 bg-full-height:0 scale:1 rise:0 underline:none strikethrough:false bg-stipple:false fg-stipple:false fg-color:0,0,0 bg-color:56540,56026,54741 wrap-mode:word justification:left size:<omitted> weight:<omitted> family-name:<omitted> stretch:<omitted> variant:<omitted> style:<omitted> language:<omitted> direction:<omitted>
diff --git a/tests/a11y/mnemonic.txt b/tests/a11y/mnemonic.txt
index 354b274..8925d41 100644
--- a/tests/a11y/mnemonic.txt
+++ b/tests/a11y/mnemonic.txt
@@ -18,7 +18,9 @@ window1
       state: enabled multi-line sensitive visible
       toolkit: gail
       text: Entry:
+      character count: 6
       caret offset: 0
+      default attributes: left-margin:0 right-margin:0 indent:0 invisible:false editable:false pixels-above-lines:0 pixels-below-lines:0 pixels-inside-wrap:0 bg-full-height:0 scale:1 rise:0 underline:none strikethrough:false bg-stipple:false fg-stipple:false fg-color:0,0,0 bg-color:56540,56026,54741 wrap-mode:word justification:left size:<omitted> weight:<omitted> family-name:<omitted> stretch:<omitted> variant:<omitted> style:<omitted> language:<omitted> direction:<omitted>
     entry1
       "text"
       parent: box1
@@ -27,4 +29,6 @@ window1
       state: editable enabled focusable sensitive single-line visible
       toolkit: gail
       text: text
+      character count: 4
       caret offset: 0
+      default attributes: left-margin:0 right-margin:0 indent:0 invisible:false editable:false pixels-above-lines:0 pixels-below-lines:0 pixels-inside-wrap:0 bg-full-height:0 scale:1 rise:0 underline:none strikethrough:false bg-stipple:false fg-stipple:false fg-color:0,0,0 bg-color:65535,65535,65535 wrap-mode:word justification:left size:<omitted> weight:<omitted> family-name:<omitted> stretch:<omitted> variant:<omitted> style:<omitted> language:<omitted> direction:<omitted>



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