2 * Tested interface: AtkAction
4 * Tested AtkObject: EailNaviframe
6 * Description: Test AtkAction interface
8 * Test input: accessible object representing EailNaviframe
10 * Expected test result: test should return 0 (success)
13 #include <Elementary.h>
16 #include "eail_test_utils.h"
18 INIT_TEST("EailNaviframe")
20 #include "eail_test_utils.h"
22 #define BUTTON_TEXT_SET(BT, TEXT) \
23 elm_object_text_set((BT), (TEXT)); \
24 elm_object_tooltip_text_set((BT), (TEXT)); \
25 elm_object_tooltip_window_mode_set((BT), EINA_TRUE)
27 #define PACKAGE_DATA_DIR "./data"
29 static const char *img1 = PACKAGE_DATA_DIR "/whiterabbit01.jpg";
30 static const char *img2 = PACKAGE_DATA_DIR "/01.jpg";
31 static const char *img3 = PACKAGE_DATA_DIR "/02.jpg";
32 static const char *img4 = PACKAGE_DATA_DIR "/03.jpg";
33 static const char *img5 = PACKAGE_DATA_DIR "/04.jpg";
34 static const char *img8 = PACKAGE_DATA_DIR "/small-01.jpg";
36 static int action_test_passed;
39 _content_new(Evas_Object *parent, const char *img)
41 Evas_Object *photo = elm_photo_add(parent);
42 elm_photo_file_set(photo, img);
43 elm_photo_fill_inside_set(photo, EINA_TRUE);
44 elm_object_style_set(photo, "shadow");
49 _page5(Evas_Object *nf)
51 Evas_Object *bt, *bt2, *content;
54 bt = elm_button_add(nf);
55 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
56 BUTTON_TEXT_SET(bt, "Page 4");
58 bt2 = elm_button_add(nf);
59 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
60 BUTTON_TEXT_SET(bt2, "Page 1");
62 content = _content_new(nf, img5);
63 it = elm_naviframe_item_insert_after(nf,
64 elm_naviframe_top_item_get(nf),
70 elm_object_item_part_text_set(it, "subtitle",
71 "This page is inserted without transition");
73 evas_object_data_set(nf, "page5", it);
74 elm_naviframe_item_promote(it);
78 _page4(Evas_Object *nf)
80 Evas_Object *bt, *ic, *content;
84 ic = elm_icon_add(nf);
85 elm_icon_standard_set(ic, "arrow_right");
87 bt = elm_button_add(nf);
88 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
89 elm_layout_content_set(bt, "icon", ic);
91 content = _content_new(nf, img4);
93 it = elm_naviframe_item_push(nf,
99 elm_object_item_part_text_set(it, "subtitle", "Title area visibility test");
101 ic = elm_icon_add(nf);
102 g_snprintf(buf, sizeof(buf), "%s",
104 elm_image_file_set(ic, buf, NULL);
105 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
106 elm_object_item_part_content_set(it, "icon", ic);
107 elm_naviframe_item_title_visible_set(it, EINA_FALSE);
109 evas_object_data_set(nf, "page4", it);
113 _page3(Evas_Object *nf)
115 Evas_Object *bt2, *ic, *content;
119 bt2 = elm_button_add(nf);
120 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
121 BUTTON_TEXT_SET(bt2, "Next");
123 content = _content_new(nf, img3);
125 it = elm_naviframe_item_push(nf,
131 ic = elm_icon_add(nf);
132 g_snprintf(buf, sizeof(buf), "%s", img8);
133 elm_image_file_set(ic, buf, NULL);
134 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
136 elm_object_item_part_content_set(it, "icon", ic);
138 evas_object_data_set(nf, "page3", it);
142 _page2(Evas_Object *nf)
144 Evas_Object *bt, *content, *ic;
147 bt = elm_button_add(nf);
148 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
150 ic = elm_icon_add(nf);
151 elm_icon_standard_set(ic, "arrow_right");
152 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
153 elm_layout_content_set(bt, "icon", ic);
155 content = _content_new(nf, img2);
157 it = elm_naviframe_item_push(nf, "Page 2 - Long Title Here",
158 NULL, bt, content, NULL);
159 elm_object_item_part_text_set(it, "subtitle", "Here is sub-title part!");
160 evas_object_data_set(nf, "page2", it);
165 _page1(Evas_Object *nf)
167 Evas_Object *btn, *content;
170 btn = elm_button_add(nf);
171 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
172 BUTTON_TEXT_SET(btn, "Next");
173 evas_object_show(btn);
175 content = _content_new(nf, img1);
176 it = elm_naviframe_item_push(nf, "Page 1", NULL, btn, content, NULL);
177 evas_object_data_set(nf, "page1", it);
181 _title_clicked(void *data, Evas_Object *obj, void *event_info)
183 _printf("Title Clicked!\n");
184 ++action_test_passed;
188 _do_test(AtkObject *obj)
191 const char *action_name, *desc;
195 g_assert(ATK_IS_ACTION(obj));
196 action = ATK_ACTION(obj);
197 actions_n = atk_action_get_n_actions(action);
198 _printf("action count %d\n", atk_action_get_n_actions(action));
199 g_assert(actions_n == 1);
200 action_name = atk_action_get_name(action, 0);
201 g_assert(!strcmp("click", action_name));
202 result = atk_action_set_description(action, 0, "click_title description");
204 desc = atk_action_get_description(action, 0);
205 g_assert(!strcmp(desc, "click_title description"));
206 result = atk_action_do_action(action, 0);
210 g_assert(action_test_passed);
212 eailu_test_code_called = 1;
216 _init_naviframe(Evas_Object *win)
220 nf = elm_naviframe_add(win);
221 evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
222 elm_win_resize_object_add(win, nf);
223 evas_object_show(nf);
224 evas_object_smart_callback_add(nf, "title,clicked", _title_clicked, 0);
232 evas_object_resize(win, 800, 600);
236 elm_main(int argc, char **argv)
239 win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
240 _init_naviframe(win);
241 evas_object_show(win);