2 * Tested interface: AtkObject
4 * Tested AtkObject: EailLayout
6 * Description: Test AtkObject interface
8 * Test input: accessible object representing EailLayout
10 * Expected test result: test should return 0 (success)
13 #include <Elementary.h>
16 #include "eail_test_utils.h"
18 INIT_TEST("EailLayout")
21 _do_test(AtkObject *object)
25 atk_object_set_description(object, "test");
26 g_assert_cmpstr(atk_object_get_description(object), ==, "test");
28 atk_object_set_name(object, "test name");
29 g_assert_cmpstr(atk_object_get_name(object), ==, "test name");
31 eailu_test_code_called++;
32 child_count = atk_object_get_n_accessible_children(object);
33 if (eailu_test_code_called == 1)
34 g_assert(2 == child_count);
36 g_assert(3 == child_count);
38 for(int i =0; i < child_count; i++)
40 AtkObject *child = atk_object_ref_accessible_child(object, i);
41 gboolean success = FALSE;
42 if (eailu_test_code_called == 1)
43 success = eailu_is_object_with_role(child, ATK_ROLE_ICON);
45 success = eailu_is_object_with_role(child, ATK_ROLE_PUSH_BUTTON);
46 g_object_unref(child);
50 g_assert(eailu_is_object_with_role(object, ATK_ROLE_FILLER));
51 g_assert(2 >= eailu_test_code_called);
56 _init_layout(Evas_Object *win)
58 Evas_Object *box, *ly, *bt;
61 box = elm_box_add(win);
62 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
63 elm_win_resize_object_add(win, box);
64 evas_object_show(box);
66 ly = elm_layout_add(win);
68 if (!elm_layout_theme_set(
69 ly, "layout", "application", "titlebar"))
70 fprintf(stderr, "Failed to set layout");
72 elm_object_part_text_set(ly, "elm.text", "Some title");
73 evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
74 evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
75 elm_box_pack_end(box, ly);
78 bt = elm_icon_add(win);
79 elm_icon_standard_set(bt, "chat");
80 evas_object_size_hint_min_set(bt, 20, 20);
81 elm_layout_icon_set(ly, bt);
83 bt = elm_icon_add(win);
84 elm_icon_standard_set(bt, "close");
85 evas_object_size_hint_min_set(bt, 20, 20);
86 elm_layout_end_set(ly, bt);
88 ly = elm_layout_add(win);
89 g_snprintf(buf, sizeof(buf), "%s/test.edj","./data/");
90 elm_layout_file_set(ly, buf, "layout");
91 evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
92 elm_box_pack_end(box, ly);
95 bt = elm_button_add(win);
96 elm_object_text_set(bt, "Button 1");
97 elm_object_part_content_set(ly, "element1", bt);
100 bt = elm_button_add(win);
101 elm_object_text_set(bt, "Button 2");
102 elm_object_part_content_set(ly, "element2", bt);
103 evas_object_show(bt);
105 bt = elm_button_add(win);
106 elm_object_text_set(bt, "Button 3");
107 elm_object_part_content_set(ly, "element3", bt);
108 evas_object_show(bt);
110 evas_object_show(win);
114 elm_main(int argc, char **argv)
118 win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);