2 * Copyright 2008 Codethink Ltd.
3 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #include "atk_test_util.h"
22 #include "atk_suite.h"
24 #define DATA_FILE TESTS_DATA_DIR"/test-table.xml"
27 atk_test_accessible_get_table_cell (gpointer fixture, gconstpointer user_data)
29 AtspiAccessible *_obj = get_root_obj (DATA_FILE);
31 AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
34 AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 9, NULL);
35 AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
40 atk_test_table_cell_get_column_span (gpointer fixture, gconstpointer user_data)
42 AtspiAccessible *_obj = get_root_obj (DATA_FILE);
44 AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
47 AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 10, NULL);
48 AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
51 g_assert_cmpint (3, ==, atspi_table_cell_get_column_span (obj, NULL));
53 cell = atspi_accessible_get_child_at_index (child, 11, NULL);
54 obj = atspi_accessible_get_table_cell (cell);
57 g_assert_cmpint (1, ==, atspi_table_cell_get_column_span (obj, NULL));
62 atk_test_table_cell_get_column_header_cells (gpointer fixture, gconstpointer user_data)
64 AtspiAccessible *_obj = get_root_obj (DATA_FILE);
66 AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
69 AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 10, NULL);
70 AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
73 GPtrArray *ret = atspi_table_cell_get_column_header_cells (obj, NULL);
74 g_assert_cmpint (3, ==, ret->len);
79 atk_test_table_cell_get_row_span (gpointer fixture, gconstpointer user_data)
81 AtspiAccessible *_obj = get_root_obj (DATA_FILE);
83 AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
86 AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 9, NULL);
87 AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
90 g_assert_cmpint (2, ==, atspi_table_cell_get_row_span (obj, NULL));
92 cell = atspi_accessible_get_child_at_index (child, 11, NULL);
93 obj = atspi_accessible_get_table_cell (cell);
96 g_assert_cmpint (1, ==, atspi_table_cell_get_column_span (obj, NULL));
101 atk_test_table_cell_get_row_header_cells (gpointer fixture, gconstpointer user_data)
103 AtspiAccessible *_obj = get_root_obj (DATA_FILE);
105 AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
108 AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 10, NULL);
109 AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
112 GPtrArray *ret = atspi_table_cell_get_row_header_cells (obj, NULL);
113 g_assert_cmpint (4, ==, ret->len);
118 atk_test_table_cell_get_row_column_span (gpointer fixture, gconstpointer user_data)
120 AtspiAccessible *_obj = get_root_obj (DATA_FILE);
122 AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
125 AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 9, NULL);
126 AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
132 gint column_span = 10;
134 atspi_table_cell_get_row_column_span (obj, &row, &column, &row_span, &column_span, NULL);
136 g_assert_cmpint (row, ==, 0);
137 g_assert_cmpint (column, ==, 0);
138 g_assert_cmpint (row_span, ==, 2);
139 g_assert_cmpint (column_span, ==, 1);
143 atk_test_table_cell_get_position (gpointer fixture, gconstpointer user_data)
145 AtspiAccessible *_obj = get_root_obj (DATA_FILE);
147 AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
150 AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 9, NULL);
151 AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
157 atspi_table_cell_get_position (obj, &row, &column, NULL);
159 /* TODO: not a very good test for the app to return (-1, -1) */
160 g_assert_cmpint (row, ==, -1);
161 g_assert_cmpint (column, ==, -1);
165 atk_test_table_cell_get_table (gpointer fixture, gconstpointer user_data)
167 AtspiAccessible *_obj = get_root_obj (DATA_FILE);
169 AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
172 AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 9, NULL);
173 AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
176 AtspiAccessible *tab = atspi_table_cell_get_table (obj, NULL);
178 g_assert (child == tab);
182 teardown_table_cell_test (gpointer fixture, gconstpointer user_data)
188 atk_test_table_cell (void)
190 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_accessible_get_table_cell",
191 0, NULL, NULL, atk_test_accessible_get_table_cell, teardown_table_cell_test);
192 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_column_span",
193 0, NULL, NULL, atk_test_table_cell_get_column_span, teardown_table_cell_test);
195 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_column_header_cells",
196 0, NULL, NULL, atk_test_table_cell_get_column_header_cells, teardown_table_cell_test);
198 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_row_span",
199 0, NULL, NULL, atk_test_table_cell_get_row_span, teardown_table_cell_test);
201 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_row_header_cells",
202 0, NULL, NULL, atk_test_table_cell_get_row_header_cells, teardown_table_cell_test);
204 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_row_column_span",
205 0, NULL, NULL, atk_test_table_cell_get_row_column_span, teardown_table_cell_test);
206 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_position",
207 0, NULL, NULL, atk_test_table_cell_get_position, teardown_table_cell_test);
208 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_table",
209 0, NULL, NULL, atk_test_table_cell_get_table, teardown_table_cell_test);