[gtk+] a11y tests: Use the new AtkValue interface
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] a11y tests: Use the new AtkValue interface
- Date: Sat, 3 May 2014 00:54:16 +0000 (UTC)
commit 4fc256de8a0fad2dd231b032cf2bad9931087826
Author: Matthias Clasen <mclasen redhat com>
Date: Fri May 2 20:48:35 2014 -0400
a11y tests: Use the new AtkValue interface
The old interface is deprecated, and we just implemented the
new one, so lets test it.
testsuite/a11y/accessibility-dump.c | 46 +++++++++++++++-------------------
testsuite/a11y/value.c | 10 ++++---
2 files changed, 26 insertions(+), 30 deletions(-)
---
diff --git a/testsuite/a11y/accessibility-dump.c b/testsuite/a11y/accessibility-dump.c
index 2b58ca8..80b62c2 100644
--- a/testsuite/a11y/accessibility-dump.c
+++ b/testsuite/a11y/accessibility-dump.c
@@ -427,40 +427,34 @@ dump_atk_value (AtkValue *atk_value,
guint depth,
GString *string)
{
- GValue value = G_VALUE_INIT;
- GValue svalue = G_VALUE_INIT;
+ AtkRange *range;
+ gdouble value;
+ gchar *text;
- g_string_append_printf (string, "%*s<AtkValue>\n", depth, "");
+ value = 0.0;
+ text = NULL;
- g_value_init (&value, G_TYPE_DOUBLE);
- g_value_init (&svalue, G_TYPE_STRING);
+ atk_value_get_value_and_text (atk_value, &value, &text);
+ range = atk_value_get_range (atk_value);
- atk_value_get_minimum_value (atk_value, &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_string_append_printf (string, "%*s<AtkValue>\n", depth, "");
- g_value_reset (&value);
- g_value_reset (&svalue);
+ if (range)
+ {
+ g_string_append_printf (string, "%*sminimum value: %f\n", depth, "", atk_range_get_lower_limit
(range));
- atk_value_get_maximum_value (atk_value, &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_string_append_printf (string, "%*smaximum value: %f\n", depth, "", atk_range_get_upper_limit
(range));
- g_value_reset (&value);
- g_value_reset (&svalue);
+ atk_range_free (range);
+ }
- atk_value_get_current_value (atk_value, &value);
- if (g_value_transform (&value, &svalue))
- g_string_append_printf (string, "%*scurrent value: %s\n", depth, "", g_value_get_string (&svalue));
+ if (text)
+ {
+ g_string_append_printf (string, "%*scurrent value: %f %s\n", depth, "", value, text);
+ g_free (text);
+ }
else
- g_string_append_printf (string, "%*scurrent value: %s\n", depth, "", G_VALUE_TYPE_NAME (&value));
-
- g_value_reset (&value);
- g_value_reset (&svalue);
+ g_string_append_printf (string, "%*scurrent value: %f\n", depth, "", value);
/* Don't dump minimum increment; it changes too much in response to
* theme changes.
diff --git a/testsuite/a11y/value.c b/testsuite/a11y/value.c
index af50a36..909c8e8 100644
--- a/testsuite/a11y/value.c
+++ b/testsuite/a11y/value.c
@@ -63,7 +63,8 @@ test_basic (GtkWidget *widget)
AtkObject *atk_object;
AtkValue *atk_value;
gdouble value = 50;
- GValue ret;
+ gdouble ret;
+ gchar *text;
atk_object = gtk_widget_get_accessible (widget);
atk_value = ATK_VALUE (atk_object);
@@ -74,9 +75,10 @@ test_basic (GtkWidget *widget)
g_assert_cmpint (notify_data.count, ==, 1);
g_assert_cmpstr (notify_data.last_name, ==, "accessible-value");
- memset (&ret, 0, sizeof (ret));
- atk_value_get_current_value (atk_value, &ret);
- g_assert_cmpfloat (g_value_get_double (&ret), ==, value);
+ text = NULL;
+ atk_value_get_value_and_text (atk_value, &ret, &text);
+ g_assert_cmpfloat (ret, ==, value);
+ g_free (text);
g_free (notify_data.last_name);
g_signal_handlers_disconnect_by_func (atk_object, G_CALLBACK (notify_cb), ¬ify_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]