2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
23 #include "atk_suite.h"
24 #include "atk_test_util.h"
26 #define DATA_FILE TESTS_DATA_DIR"/test-action.xml"
29 teardown_action_test (gpointer fixture, gconstpointer user_data)
35 atk_test_action_sample_get_interface (gpointer fixture, gconstpointer user_data)
37 AtspiAccessible *obj = get_root_obj (DATA_FILE);
38 g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
39 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
40 AtspiAction *iface = atspi_accessible_get_action_iface (child);
41 g_assert (iface != NULL);
45 atk_test_action_get_action_description (gpointer fixture, gconstpointer user_data)
47 AtspiAccessible *obj = get_root_obj (DATA_FILE);
48 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
49 AtspiAction *action = atspi_accessible_get_action_iface (child);
50 g_assert_cmpstr (atspi_action_get_action_description (action, 0, NULL), == ,"action1 description");
54 atk_test_action_get_action_name (gpointer fixture, gconstpointer user_data)
56 AtspiAccessible *obj = get_root_obj (DATA_FILE);
57 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
58 AtspiAction *action = atspi_accessible_get_action_iface (child);
59 g_assert_cmpstr (atspi_action_get_action_name (action, 0, NULL), == ,"action1");
63 atk_test_action_get_n_actions (gpointer fixture, gconstpointer user_data)
65 AtspiAccessible *obj = get_root_obj (DATA_FILE);
66 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
67 AtspiAction *action = atspi_accessible_get_action_iface (child);
68 g_assert_cmpint (atspi_action_get_n_actions (action, NULL), == , 2);
72 atk_test_action_get_key_binding (gpointer fixture, gconstpointer user_data)
74 AtspiAccessible *obj = get_root_obj (DATA_FILE);
75 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
76 AtspiAction *action = atspi_accessible_get_action_iface (child);
77 g_assert_cmpstr (atspi_action_get_key_binding (action, 0, NULL), == ,"action1 key binding");
81 atk_test_action_get_localized_name (gpointer fixture, gconstpointer user_data)
83 AtspiAccessible *obj = get_root_obj (DATA_FILE);
84 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
85 AtspiAction *action = atspi_accessible_get_action_iface (child);
86 g_assert_cmpstr (atspi_action_get_localized_name (action, 0, NULL), == ,"action1");
90 atk_test_action_do_action (gpointer fixture, gconstpointer user_data)
92 AtspiAccessible *obj = get_root_obj (DATA_FILE);
93 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
94 AtspiAction *action = atspi_accessible_get_action_iface (child);
95 g_assert (action != NULL);
96 atspi_action_do_action (action, 0, NULL);
97 atspi_accessible_clear_cache (obj);
98 AtspiStateSet *s = atspi_accessible_get_state_set (child);
99 GArray *array = atspi_state_set_get_states (s);
100 g_assert_cmpint (array->len, ==, 1);
104 atk_test_action (void)
106 g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_sample_get_interface",
107 0, NULL, NULL, atk_test_action_sample_get_interface, teardown_action_test);
108 g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_action_description",
109 0, NULL, NULL, atk_test_action_get_action_description, teardown_action_test);
110 g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_action_name",
111 0, NULL, NULL, atk_test_action_get_action_name, teardown_action_test);
112 g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_n_actions",
113 0, NULL, NULL, atk_test_action_get_n_actions, teardown_action_test);
114 g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_key_binding",
115 0, NULL, NULL, atk_test_action_get_key_binding, teardown_action_test);
116 g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_get_localized_name",
117 0, NULL, NULL, atk_test_action_get_localized_name, teardown_action_test);
118 g_test_add_vtable (ATK_TEST_PATH_ACTION "/atk_test_action_do_action",
119 0, NULL, NULL, atk_test_action_do_action, teardown_action_test);