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-image.xml"
29 teardown_image_test (gpointer fixture, gconstpointer user_data)
35 atk_test_image_sample_get_interface (gpointer fixture, gconstpointer user_data)
37 AtspiAccessible *obj = get_root_obj (DATA_FILE);
38 g_assert_cmpstr (atspi_accessible_get_name (obj, NULL), ==, "root_object");
39 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
40 AtspiImage *iface = atspi_accessible_get_image_iface (child);
41 g_assert (iface != NULL);
45 atk_test_image_get_image_description (gpointer fixture, gconstpointer user_data)
47 AtspiAccessible *obj = get_root_obj (DATA_FILE);
48 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
49 AtspiImage *image = atspi_accessible_get_image_iface (child);
50 gchar *desc = atspi_image_get_image_description (image, NULL);
52 g_assert_cmpstr (desc, == ,"image description");
57 atk_test_image_get_image_size (gpointer fixture, gconstpointer user_data)
59 AtspiAccessible *obj = get_root_obj (DATA_FILE);
60 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
61 AtspiImage *image = atspi_accessible_get_image_iface (child);
62 AtspiPoint *p = atspi_image_get_image_size (image, NULL);
65 g_assert_cmpint (p->x,==,100);
66 g_assert_cmpint (p->y,==,50);
71 atk_test_image_get_image_position (gpointer fixture, gconstpointer user_data)
73 AtspiAccessible *obj = get_root_obj (DATA_FILE);
74 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
75 AtspiImage *image = atspi_accessible_get_image_iface (child);
76 AtspiPoint *p = atspi_image_get_image_position (image, ATSPI_COORD_TYPE_SCREEN, NULL);
78 g_assert_cmpint (p->x,==,500);
79 g_assert_cmpint (p->y,==,50);
84 atk_test_image_get_image_extents (gpointer fixture, gconstpointer user_data)
86 AtspiAccessible *obj = get_root_obj (DATA_FILE);
87 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
88 AtspiImage *image = atspi_accessible_get_image_iface (child);
89 AtspiRect *r = atspi_image_get_image_extents (image, ATSPI_COORD_TYPE_SCREEN, NULL);
92 g_assert_cmpint (r->x, ==, 500);
93 g_assert_cmpint (r->y, ==, 50);
94 g_assert_cmpint (r->width, ==, 100);
95 g_assert_cmpint (r->height, ==, 50);
101 atk_test_image_get_image_locale (gpointer fixture, gconstpointer user_data)
103 AtspiAccessible *obj = get_root_obj (DATA_FILE);
104 AtspiAccessible *child = atspi_accessible_get_child_at_index (obj,1, NULL);
105 AtspiImage *image = atspi_accessible_get_image_iface (child);
106 gchar *locale = atspi_image_get_image_locale (image, NULL);
109 g_assert_cmpstr (locale, ==,"image_locale");
114 atk_test_image (void)
116 g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_sample_get_interface",
117 0, NULL, NULL, atk_test_image_sample_get_interface, teardown_image_test);
118 g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_description",
119 0, NULL, NULL, atk_test_image_get_image_description, teardown_image_test);
120 g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_size",
121 0, NULL, NULL, atk_test_image_get_image_size, teardown_image_test);
122 g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_position",
123 0, NULL, NULL, atk_test_image_get_image_position, teardown_image_test);
124 g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_extents",
125 0, NULL, NULL, atk_test_image_get_image_extents, teardown_image_test);
126 g_test_add_vtable (ATK_TEST_PATH_IMAGE "/atk_test_image_get_image_locale",
127 0, NULL, NULL, atk_test_image_get_image_locale, teardown_image_test);