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 Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 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 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, 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_column_index (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, 10, NULL);
87 AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
90 /* ATK Table Cell interface do not implement that func */
91 g_assert_cmpint (-1, ==, atspi_table_cell_get_column_index (obj, NULL));
95 atk_test_table_cell_get_row_span (gpointer fixture, gconstpointer user_data)
97 AtspiAccessible *_obj = get_root_obj (DATA_FILE);
99 AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
102 AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 9, NULL);
103 AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
106 g_assert_cmpint (2, ==, atspi_table_cell_get_row_span (obj, NULL));
108 cell = atspi_accessible_get_child_at_index (child, 11, NULL);
109 obj = atspi_accessible_get_table_cell (cell);
112 g_assert_cmpint (1, ==, atspi_table_cell_get_column_span (obj, NULL));
117 atk_test_table_cell_get_row_header_cells (gpointer fixture, gconstpointer user_data)
119 AtspiAccessible *_obj = get_root_obj (DATA_FILE);
121 AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
124 AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 10, NULL);
125 AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
128 GPtrArray *ret = atspi_table_cell_get_row_header_cells (obj, NULL);
129 g_assert_cmpint (4, ==, ret->len);
134 atk_test_table_cell_get_row_column_span (gpointer fixture, gconstpointer user_data)
136 AtspiAccessible *_obj = get_root_obj (DATA_FILE);
138 AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
141 AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 9, NULL);
142 AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
148 gint column_span = 10;
150 atspi_table_cell_get_row_column_span (obj, &row, &column, &row_span, &column_span, NULL);
152 g_assert_cmpint (row, ==, 0);
153 g_assert_cmpint (column, ==, 0);
154 g_assert_cmpint (row_span, ==, 2);
155 g_assert_cmpint (column_span, ==, 1);
159 atk_test_table_cell_get_table (gpointer fixture, gconstpointer user_data)
161 AtspiAccessible *_obj = get_root_obj (DATA_FILE);
163 AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
166 AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 9, NULL);
167 AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
170 AtspiAccessible *tab = atspi_table_cell_get_table (obj, NULL);
172 g_assert (child == tab);
176 teardown_table_cell_test (gpointer fixture, gconstpointer user_data)
178 kill (child_pid, SIGTERM);
182 atk_test_table_cell (void)
184 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_accessible_get_table_cell",
185 0, NULL, NULL, atk_test_accessible_get_table_cell, teardown_table_cell_test);
186 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_column_span",
187 0, NULL, NULL, atk_test_table_cell_get_column_span, teardown_table_cell_test);
189 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_column_header_cells",
190 0, NULL, NULL, atk_test_table_cell_get_column_header_cells, teardown_table_cell_test);
192 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_column_index",
193 0, NULL, NULL, atk_test_table_cell_get_column_index, teardown_table_cell_test);
194 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_row_span",
195 0, NULL, NULL, atk_test_table_cell_get_row_span, teardown_table_cell_test);
197 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_row_header_cells",
198 0, NULL, NULL, atk_test_table_cell_get_row_header_cells, teardown_table_cell_test);
200 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_row_column_span",
201 0, NULL, NULL, atk_test_table_cell_get_row_column_span, teardown_table_cell_test);
202 g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_table",
203 0, NULL, NULL, atk_test_table_cell_get_table, teardown_table_cell_test);