Reverted Value interface since the new union was more complicated than necessary.
[platform/core/uifw/at-spi2-atk.git] / test / test-simple.c
index b64ee96..eed9448 100644 (file)
@@ -122,7 +122,7 @@ create_test_window (void)
        widget = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION,
                                           GTK_ICON_SIZE_LARGE_TOOLBAR);
        test_window_add_and_show (GTK_CONTAINER (vbox), widget);
-       
+
        widget = g_object_new (GTK_TYPE_RANGE, NULL);
        gtk_range_set_range (GTK_RANGE (widget), 0.0, 100.0);
        test_window_add_and_show (GTK_CONTAINER (vbox), widget);
@@ -158,6 +158,28 @@ test_roles (void)
 }
 
 static void
+test_action (AccessibleAction *action)
+{
+       gint n_actions, i;
+       gchar *s, *sd;
+       g_assert ((n_actions = AccessibleAction_getNActions (action)) >= 0);
+
+       fprintf (stderr, "Testing actions...");
+       for (i = 0; i < n_actions; ++i)
+       {
+               s = AccessibleAction_getName (action, i);
+               g_assert (s);
+               sd = AccessibleAction_getDescription (action, i);
+               g_assert (sd);
+               fprintf (stderr, "%d: %s (%s);  ", i, s, sd);
+               SPI_freeString (s);
+               SPI_freeString (sd);
+               /* g_assert (AccessibleAction_doAction (action, i)); */
+       }
+       fprintf (stderr, "\n");
+}
+
+static void
 test_desktop (void)
 {
        Accessible *desktop;
@@ -433,10 +455,11 @@ validate_accessible (Accessible *accessible,
                     gboolean    has_parent,
                     gboolean    recurse_down)
 {
-       Accessible *tmp;
-       char       *name, *descr;
-       const char *role;
-       GString    *item_str = g_string_new ("");
+       Accessible    *tmp;
+       char          *name, *descr;
+       AccessibleRole role;
+       char          *role_name;
+       GString       *item_str = g_string_new ("");
 
        name = Accessible_getName (accessible);
        g_assert (name != NULL);
@@ -445,7 +468,10 @@ validate_accessible (Accessible *accessible,
        g_assert (descr != NULL);
 
        role = Accessible_getRole (accessible);
-       g_assert (role != NULL);
+       g_assert (role != SPI_ROLE_INVALID);
+       role_name = Accessible_getRoleName (accessible);
+       g_assert (role_name != NULL);
+       
 
        if (print_tree) {
                int i;
@@ -460,6 +486,8 @@ validate_accessible (Accessible *accessible,
                g_assert (tmp != NULL);
                if (print_tree)
                        fprintf (stderr, "At");
+               else
+                       test_action (tmp);
                AccessibleAction_unref (tmp);
        }
 
@@ -558,10 +586,11 @@ validate_accessible (Accessible *accessible,
 
        if (print_tree)
                fprintf (stderr, " ] '%s' (%s) - %s: %s\n",
-                        name, descr, role, item_str->str);
+                        name, descr, role_name, item_str->str);
 
        SPI_freeString (name);
        SPI_freeString (descr);
+       SPI_freeString (role_name);
        g_string_free (item_str, TRUE);
 
        validate_tree (accessible, has_parent, recurse_down);