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.
23 #include "atk_suite.h"
24 #include "atk_test_util.h"
26 #define DATA_FILE TESTS_DATA_DIR"/test-document.xml"
29 teardown_document_test (gpointer fixture, gconstpointer user_data)
31 kill (child_pid, SIGTERM);
35 atk_test_document_get_document_iface (gpointer fixture, gconstpointer user_data)
37 AtspiAccessible *obj = get_root_obj (DATA_FILE);
38 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
39 AtspiDocument *iface = atspi_accessible_get_document_iface (child);
40 g_assert (iface != NULL);
44 atk_test_document_get_locale (gpointer fixture, gconstpointer user_data)
46 AtspiAccessible *obj = get_root_obj (DATA_FILE);
47 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
48 AtspiDocument *iface = atspi_accessible_get_document_iface (child);
49 g_assert (iface != NULL);
51 g_assert_cmpstr (atspi_document_get_locale (iface, NULL), ==, "document_locale");
55 atk_test_document_get_attribute_value (gpointer fixture, gconstpointer user_data)
57 AtspiAccessible *obj = get_root_obj (DATA_FILE);
58 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
59 AtspiDocument *iface = atspi_accessible_get_document_iface (child);
60 g_assert (iface != NULL);
62 g_assert_cmpstr (atspi_document_get_document_attribute_value (iface, "atspi1", NULL), ==, "test1");
63 g_assert_cmpstr (atspi_document_get_document_attribute_value (iface, "atspi2", NULL), ==, "test2");
67 atk_test_document_get_attributes (gpointer fixture, gconstpointer user_data)
69 AtspiAccessible *obj = get_root_obj (DATA_FILE);
70 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
71 AtspiDocument *iface = atspi_accessible_get_document_iface (child);
72 g_assert (iface != NULL);
74 GHashTable *attr = atspi_document_get_document_attributes (iface, NULL);
77 g_hash_table_iter_init (&iter, attr);
79 gchar *valid_keys[] = {"atspi1", "atspi2"};
80 gchar *valid_values[] = {"test1", "test2"};
83 while (g_hash_table_iter_next (&iter, &key, &value)) {
84 g_assert_cmpstr (valid_keys[i], ==, (gchar *)key);
85 g_assert_cmpstr (valid_values[i], ==, (gchar *)value);
91 atk_test_document(void )
93 g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_document_get_document_iface",
94 0, NULL, NULL, atk_test_document_get_document_iface, teardown_document_test);
95 g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_document_get_locale",
96 0, NULL, NULL, atk_test_document_get_locale, teardown_document_test);
97 g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_document_get_attribute_value",
98 0, NULL, NULL, atk_test_document_get_attribute_value, teardown_document_test);
99 g_test_add_vtable (ATK_TEST_PATH_ACCESSIBLE "/atk_test_document_get_attributes",
100 0, NULL, NULL, atk_test_document_get_attributes, teardown_document_test );