7 * This module is used to test the implementation of AtkAction,
8 * i.e. the getting of the name and the getting and setting of description
11 static void _create_event_watcher (void);
12 static void _check_object (AtkObject *obj);
15 _check_object (AtkObject *obj)
17 G_CONST_RETURN char *accessible_name;
18 G_CONST_RETURN gchar * typename = NULL;
20 if (GTK_IS_ACCESSIBLE (obj))
22 GtkWidget* widget = NULL;
24 widget = GTK_ACCESSIBLE (obj)->widget;
25 typename = g_type_name (G_OBJECT_TYPE (widget));
26 g_print ("Widget type name: %s\n", typename ? typename : "NULL");
28 typename = g_type_name (G_OBJECT_TYPE (obj));
29 g_print ("Accessible type name: %s\n", typename ? typename : "NULL");
30 accessible_name = atk_object_get_name (obj);
32 g_print ("Name: %s\n", accessible_name);
34 if (ATK_IS_ACTION (obj))
36 AtkAction *action = ATK_ACTION (obj);
38 G_CONST_RETURN gchar *action_name;
39 G_CONST_RETURN gchar *action_desc;
40 G_CONST_RETURN gchar *action_binding;
41 const gchar *desc = "Test description";
43 n_actions = atk_action_get_n_actions (action);
44 g_print ("AtkAction supported number of actions: %d\n", n_actions);
45 for (i = 0; i < n_actions; i++)
47 action_name = atk_action_get_name (action, i);
48 g_print ("Name of Action %d: %s\n", i, action_name);
49 action_binding = atk_action_get_keybinding (action, i);
51 g_print ("Name of Action Keybinding %d: %s\n", i, action_binding);
53 if (!atk_action_set_description (action, i, desc))
55 g_print ("atk_action_set_description failed\n");
59 action_desc = atk_action_get_description (action, i);
60 if (strcmp (desc, action_desc) != 0)
62 g_print ("Problem with setting and getting action description\n");
66 if (atk_action_set_description (action, n_actions, desc))
68 g_print ("atk_action_set_description succeeded but should not have\n");
74 _create_event_watcher (void)
76 atk_add_focus_tracker (_check_object);
80 gtk_module_init(gint argc, char* argv[])
82 g_print("testaction Module loaded\n");
84 _create_event_watcher();