2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
5 * Copyright (c) 2014 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 Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 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 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
29 #include "atk_suite.h"
30 #include "atk_test_util.h"
32 static gchar *tdata_list = NULL;
33 static gchar *one_test = NULL;
35 typedef struct _Atk_Test_Case Atk_Test_Case;
37 struct _Atk_Test_Case {
38 const char *test_case;
42 static const Atk_Test_Case atc[] = {
43 { ATK_TEST_PATH_ACCESSIBLE, atk_test_accessible },
44 { ATK_TEST_PATH_ACTION, atk_test_action },
45 { ATK_TEST_PATH_COMP, atk_test_component },
46 { ATK_TEST_PATH_COLLECTION, atk_test_collection },
47 { ATK_TEST_PATH_DOC, atk_test_document },
48 { ATK_TEST_PATH_EDIT_TEXT, atk_test_editable_text },
49 { ATK_TEST_PATH_HYPERLINK, atk_test_hyperlink },
50 { ATK_TEST_PATH_HYPERTEXT, atk_test_hypertext },
51 { ATK_TEST_PATH_IMAGE, atk_test_image },
52 { ATK_TEST_PATH_SELECTION, atk_test_selection },
53 { ATK_TEST_PATH_STATE_SET, atk_test_state_set },
54 { ATK_TEST_PATH_TABLE, atk_test_table },
55 { ATK_TEST_PATH_TABLE_CELL, atk_test_table_cell },
56 { ATK_TEST_PATH_TEXT, atk_test_text },
57 { ATK_TEST_PATH_VALUE, atk_test_value },
64 const Atk_Test_Case *itr;
67 g_print ("Available Test Cases:\n");
68 for (; itr->test_case; itr++)
69 g_print ("\t%s\n", itr->test_case);
73 atk_suite_build (int argc, char **argv )
75 g_test_init (&argc, &argv, NULL);
76 atk_test_accessible ();
78 atk_test_component ();
79 atk_test_collection ();
82 atk_test_editable_text ();
83 atk_test_hyperlink ();
84 atk_test_hypertext ();
86 atk_test_selection ();
87 atk_test_state_set ();
89 atk_test_table_cell ();
94 static GOptionEntry optentries[] = {
95 {"list", 'l', 0, G_OPTION_ARG_NONE, &tdata_list, "Display all available test cases", NULL},
96 {"separate", 0, 0, G_OPTION_ARG_STRING, &one_test, "Run only NAME test", "NAME"},
101 main(int argc, char **argv)
105 opt = g_option_context_new (NULL);
106 g_option_context_add_main_entries (opt, optentries, NULL);
107 g_option_context_set_help_enabled (opt, TRUE);
108 g_option_context_set_ignore_unknown_options (opt, TRUE);
110 if (!g_option_context_parse (opt, &argc, &argv, NULL))
118 clean_exit_on_fail ();
121 if (!g_strcmp0 (one_test, "Accessible")) {
122 g_test_init (&argc, &argv, NULL);
123 atk_test_accessible ();
124 test_result = g_test_run ();
125 return (test_result == 0 ) ? 0 : 255;
127 if (!g_strcmp0 (one_test, "Action")) {
128 g_test_init (&argc, &argv, NULL);
130 test_result = g_test_run ();
131 return (test_result == 0 ) ? 0 : 255;
133 if (!g_strcmp0 (one_test, "Component")) {
134 g_test_init (&argc, &argv, NULL);
135 atk_test_component ();
136 test_result = g_test_run ();
137 return ( test_result == 0 ) ? 0 : 255;
139 if (!g_strcmp0 (one_test, "Collection")) {
140 g_test_init (&argc, &argv, NULL);
141 atk_test_collection ();
142 test_result = g_test_run ();
143 return ( test_result == 0 ) ? 0 : 255;
145 if (!g_strcmp0 (one_test, "Document")) {
146 g_test_init (&argc, &argv, NULL);
147 atk_test_document ();
148 test_result = g_test_run ();
149 return ( test_result == 0 ) ? 0 : 255;
151 if (!g_strcmp0 (one_test, "Editable_Text")) {
152 g_test_init (&argc, &argv, NULL);
153 atk_test_editable_text ();
154 test_result = g_test_run ();
155 return ( test_result == 0 ) ? 0 : 255;
157 if (!g_strcmp0 (one_test, "Hyperlink")) {
158 g_test_init (&argc, &argv, NULL);
159 atk_test_hyperlink ();
160 test_result = g_test_run ();
161 return ( test_result == 0 ) ? 0 : 255;
163 if (!g_strcmp0 (one_test, "Hypertext")) {
164 g_test_init (&argc, &argv, NULL);
165 atk_test_hypertext ();
166 test_result = g_test_run ();
167 return ( test_result == 0 ) ? 0 : 255;
169 if (!g_strcmp0 (one_test, "Image")) {
170 g_test_init (&argc, &argv, NULL);
172 test_result = g_test_run ();
173 return ( test_result == 0 ) ? 0 : 255;
175 if (!g_strcmp0 (one_test, "Selection")) {
176 g_test_init (&argc, &argv, NULL);
177 atk_test_selection ();
178 test_result = g_test_run ();
179 return ( test_result == 0 ) ? 0 : 255;
181 if (!g_strcmp0 (one_test, "State_Set")) {
182 g_test_init (&argc, &argv, NULL);
183 atk_test_state_set ();
184 test_result = g_test_run ();
185 return ( test_result == 0 ) ? 0 : 255;
187 if (!g_strcmp0 (one_test, "Table")) {
188 g_test_init (&argc, &argv, NULL);
190 test_result = g_test_run ();
191 return ( test_result == 0 ) ? 0 : 255;
193 if (!g_strcmp0 (one_test, "Table_Cell")) {
194 g_test_init (&argc, &argv, NULL);
195 atk_test_table_cell ();
196 test_result = g_test_run ();
197 return ( test_result == 0 ) ? 0 : 255;
199 if (!g_strcmp0 (one_test, "Text")) {
200 g_test_init (&argc, &argv, NULL);
202 test_result = g_test_run ();
203 return ( test_result == 0 ) ? 0 : 255;
205 if (!g_strcmp0 (one_test, "Value")) {
206 g_test_init (&argc, &argv, NULL);
208 test_result = g_test_run ();
209 return ( test_result == 0 ) ? 0 : 255;
211 g_print ("Unknown test name\n");
215 atk_suite_build (argc, argv);
216 test_result = g_test_run ();
218 return (test_result == 0 ) ? 0 : 255;