[gtk+/a11y] Handle AtkValue implementations that return integer values
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/a11y] Handle AtkValue implementations that return integer values
- Date: Tue, 21 Jun 2011 22:54:16 +0000 (UTC)
commit 3688d5dbf2cf0780059e67f70cffc1888087ddde
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jun 21 18:01:26 2011 -0400
Handle AtkValue implementations that return integer values
We do this by transforming the returned GValue to a string.
As a side-effect, the formatting for doubles changes, so
adjust expected output to match.
tests/a11y/accessibility-dump.c | 39 +++++++++++++++++++++++++++++++++++----
tests/a11y/range.txt | 10 +++++-----
2 files changed, 40 insertions(+), 9 deletions(-)
---
diff --git a/tests/a11y/accessibility-dump.c b/tests/a11y/accessibility-dump.c
index 27e3b07..ce534b8 100644
--- a/tests/a11y/accessibility-dump.c
+++ b/tests/a11y/accessibility-dump.c
@@ -396,17 +396,48 @@ dump_atk_value (AtkValue *atk_value,
GString *string)
{
GValue value = { 0, };
+ GValue svalue = { 0, };
g_string_append_printf (string, "%*s<AtkValue>\n", depth, "");
+ g_value_init (&value, G_TYPE_DOUBLE);
+ g_value_init (&svalue, G_TYPE_STRING);
+
atk_value_get_minimum_value (atk_value, &value);
- g_string_append_printf (string, "%*sminimum value: %g\n", depth, "", g_value_get_double (&value));
+ if (g_value_transform (&value, &svalue))
+ g_string_append_printf (string, "%*sminimum value: %s\n", depth, "", g_value_get_string (&svalue));
+ else
+ g_string_append_printf (string, "%*sminimum value: <%s>\n", depth, "", G_VALUE_TYPE_NAME (&value));
+
+ g_value_reset (&value);
+ g_value_reset (&svalue);
+
atk_value_get_maximum_value (atk_value, &value);
- g_string_append_printf (string, "%*smaximum value: %g\n", depth, "", g_value_get_double (&value));
+ if (g_value_transform (&value, &svalue))
+ g_string_append_printf (string, "%*smaximum value: %s\n", depth, "", g_value_get_string (&svalue));
+ else
+ g_string_append_printf (string, "%*smaximum value: <%s>\n", depth, "", G_VALUE_TYPE_NAME (&value));
+
+ g_value_reset (&value);
+ g_value_reset (&svalue);
+
atk_value_get_current_value (atk_value, &value);
- g_string_append_printf (string, "%*scurrent value: %g\n", depth, "", g_value_get_double (&value));
+ if (g_value_transform (&value, &svalue))
+ g_string_append_printf (string, "%*scurrent value: %s\n", depth, "", g_value_get_string (&svalue));
+ else
+ g_string_append_printf (string, "%*scurrent value: %s\n", depth, "", G_VALUE_TYPE_NAME (&value));
+
+ g_value_reset (&value);
+ g_value_reset (&svalue);
+
atk_value_get_minimum_increment (atk_value, &value);
- g_string_append_printf (string, "%*sminimum increment: %g\n", depth, "", g_value_get_double (&value));
+ if (g_value_transform (&value, &svalue))
+ g_string_append_printf (string, "%*sminimum increment: %s\n", depth, "", g_value_get_string (&svalue));
+ else
+ g_string_append_printf (string, "%*sminimum increment: %s\n", depth, "", G_VALUE_TYPE_NAME (&value));
+
+ g_value_reset (&value);
+ g_value_reset (&svalue);
}
static void
diff --git a/tests/a11y/range.txt b/tests/a11y/range.txt
index 6274a37..cb9ce51 100644
--- a/tests/a11y/range.txt
+++ b/tests/a11y/range.txt
@@ -16,7 +16,7 @@ window1
layer: widget
alpha: 1
<AtkText>
- text: â45.5
+ text: ?45.5
character count: 5
caret offset: 0
default attributes: left-margin: 0
@@ -49,7 +49,7 @@ window1
<AtkAction>
action 0 name: activate
<AtkValue>
- minimum value: 0.5
- maximum value: 99.5
- current value: 45.5
- minimum increment: 0.5
+ minimum value: 0.500000
+ maximum value: 99.500000
+ current value: 45.500000
+ minimum increment: 0.500000
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]