2 * Tested interface: AtkText
4 * Tested AtkObject: EailLabel
6 * Description: Test AtkObject interface
8 * Test input: accessible object representing EailLabel
10 * Expected test result: test should return 0 (success)
13 #include <Elementary.h>
15 #include "eail_test_utils.h"
17 INIT_TEST("EailLabel")
20 _init_label(Evas_Object *win)
22 Evas_Object *bg, *label;
25 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
26 elm_win_resize_object_add(win, bg);
29 label = elm_label_add(win);
30 elm_object_text_set(label, "Lorem ipsum dolor sit amet, consectetur adipisicing elit,"
31 "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
32 "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris"
33 "nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in"
34 "reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla"
35 "pariatur. Excepteur sint occaecat cupidatat non proident, sunt"
36 "in culpa qui officia deserunt mollit anim id est laborum.");
37 elm_label_line_wrap_set(label, ELM_WRAP_WORD);
38 evas_object_resize(label, 200, 170);
39 evas_object_move(label, 0, 0);
40 evas_object_show(label);
42 evas_object_resize(win, 200, 320);
46 _do_test(AtkObject *obj)
48 int start_offset, end_offset;
49 AtkAttributeSet *elem = NULL, *at_set = NULL;
50 AtkAttribute *attr = NULL;
51 gboolean wrap_exist = FALSE, editable_exist = FALSE;
53 g_assert(ATK_IS_TEXT(obj));
55 gchar *text = atk_text_get_text(ATK_TEXT(obj), 6, 11);
56 g_assert_cmpstr(text, ==, "ipsum");
59 g_assert(atk_text_get_character_at_offset(ATK_TEXT(obj), 12) == 'd');
61 g_assert(atk_text_get_character_count(ATK_TEXT(obj)) == 440);
63 at_set = atk_text_get_run_attributes
64 (ATK_TEXT(obj), 0, &start_offset, &end_offset);
67 for (elem = at_set; elem; elem = elem->next)
69 attr = (AtkAttribute *)elem->data;
70 if (0 == g_strcmp0(attr->name, atk_text_attribute_get_name
71 (ATK_TEXT_ATTR_WRAP_MODE)))
73 else if (0 == g_strcmp0(attr->name, atk_text_attribute_get_name
74 (ATK_TEXT_ATTR_EDITABLE)))
75 editable_exist = TRUE;
78 g_assert(0 == start_offset);
79 g_assert(atk_text_get_character_count(ATK_TEXT(obj)) == end_offset);
82 g_assert(editable_exist);
84 /* out of bounds offset in run attributes test*/
85 at_set = atk_text_get_run_attributes
86 (ATK_TEXT(obj), atk_text_get_character_count
87 (ATK_TEXT(obj)), &start_offset, &end_offset);
88 g_assert(NULL == at_set);
89 g_assert(-1 == start_offset);
90 g_assert(-1 == end_offset);
92 eailu_test_code_called = 1;
96 elm_main(int argc, char **argv)
100 win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
104 evas_object_show(win);