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-editable-text.xml"
29 teardown_editable_text_test (gpointer fixture, gconstpointer user_data)
35 atk_test_editable_text_get_editable_text_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 AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child);
40 g_assert (iface != NULL);
44 /* Function is in docs but not implemented */
46 atk_test_editable_text_set_attributes (gpointer fixture, gconstpointer user_data)
48 AtspiAccessible *obj = get_root_obj (DATA_FILE);
49 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
50 AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child);
51 g_assert (iface != NULL);
53 g_assert (atspi_editable_text_set_attributes (iface, "attribute", 1, 2, NULL));
58 atk_test_editable_text_insert_text (gpointer fixture, gconstpointer user_data)
60 AtspiAccessible *obj = get_root_obj (DATA_FILE);
61 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
62 AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child);
63 g_assert (iface != NULL);
64 g_assert (atspi_editable_text_insert_text (iface, 0, "test_text", 9, NULL));
68 atk_test_editable_text_copy_text (gpointer fixture, gconstpointer user_data)
70 AtspiAccessible *obj = get_root_obj (DATA_FILE);
71 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
72 AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child);
73 g_assert (iface != NULL);
74 g_assert (atspi_editable_text_copy_text (iface, 1, 2, NULL));
78 atk_test_editable_text_cut_text (gpointer fixture, gconstpointer user_data)
80 AtspiAccessible *obj = get_root_obj (DATA_FILE);
81 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
82 AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child);
83 g_assert (iface != NULL);
84 g_assert (atspi_editable_text_cut_text (iface, 1, 2, NULL));
88 atk_test_editable_text_delete_text (gpointer fixture, gconstpointer user_data)
90 AtspiAccessible *obj = get_root_obj (DATA_FILE);
91 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
92 AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child);
93 g_assert (iface != NULL);
95 g_assert (atspi_editable_text_delete_text (iface, 1, 2, NULL));
99 atk_test_editable_text_paste_text (gpointer fixture, gconstpointer user_data)
101 AtspiAccessible *obj = get_root_obj (DATA_FILE);
102 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj, 1, NULL);
103 AtspiEditableText *iface = atspi_accessible_get_editable_text_iface (child);
104 g_assert (iface != NULL);
106 g_assert (atspi_editable_text_paste_text (iface, 2, NULL));
110 atk_test_editable_text(void )
112 g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_get_editable_text_iface",
113 0, NULL, NULL, atk_test_editable_text_get_editable_text_iface, teardown_editable_text_test);
115 g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_set_attributes",
116 0, NULL, NULL, atk_test_editable_text_set_attributes, teardown_editable_text_test);
118 g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_insert_text",
119 0, NULL, NULL, atk_test_editable_text_insert_text, teardown_editable_text_test);
120 g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_copy_text",
121 0, NULL, NULL, atk_test_editable_text_copy_text, teardown_editable_text_test);
122 g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_cut_text",
123 0, NULL, NULL, atk_test_editable_text_cut_text, teardown_editable_text_test);
124 g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_delete_text",
125 0, NULL, NULL, atk_test_editable_text_delete_text, teardown_editable_text_test);
126 g_test_add_vtable (ATK_TEST_PATH_EDIT_TEXT "/atk_test_editable_text_paste_text",
127 0, NULL, NULL, atk_test_editable_text_paste_text, teardown_editable_text_test);