summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-04-22 13:18:25 -0400
committerStefan Schmidt <s.schmidt@samsung.com>2020-04-28 13:48:35 +0200
commit55c2ffbe42c0547b1fba5d9cccc1bf4303ff0302 (patch)
treefcf117c4d4247b0dcdcbaddca8a117e5df3cf190 /src/tests
parent03d56674c3a02e7a5cc380467368d576676696df (diff)
tests/elm: add more naviframe tests
some tests to explicitly verify callback and internal behavior Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D11752
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/elementary/elm_test_naviframe.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/tests/elementary/elm_test_naviframe.c b/src/tests/elementary/elm_test_naviframe.c
index 01f5dfc011..4f1b6d29ae 100644
--- a/src/tests/elementary/elm_test_naviframe.c
+++ b/src/tests/elementary/elm_test_naviframe.c
@@ -110,10 +110,68 @@ EFL_START_TEST(elm_naviframe_test_content_preserve_on_pop)
110} 110}
111EFL_END_TEST 111EFL_END_TEST
112 112
113static Eo *
114create_content(Eo *parent)
115{
116 Eo *content = elm_layout_add(parent);
117
118 evas_object_size_hint_min_set(content, 50, 50);
119
120 return content;
121}
122
123#define NUM_ITEMS 10
124EFL_START_TEST(elm_naviframe_test_behavior)
125{
126 Evas_Object *win, *naviframe;
127 //int title_transition = 0;
128 int title_clicked = 0;
129 Elm_Object_Item *active_it = NULL;
130 Elm_Object_Item *it[NUM_ITEMS];
131 int i;
132
133 win = win_add(NULL, "naviframe", ELM_WIN_BASIC);
134 evas_object_resize(win, 500, 500);
135
136 naviframe = elm_naviframe_add(win);
137 //this seems broken beyond space and time
138 //evas_object_smart_callback_add(naviframe, "title,transition,finished", event_callback_single_call_int_data, &title_transition);
139 evas_object_smart_callback_add(naviframe, "title,clicked", event_callback_single_call_int_data, &title_clicked);
140 evas_object_smart_callback_add(naviframe, "transition,finished", event_callback_that_quits_the_main_loop_when_called, NULL);
141 evas_object_smart_callback_add(naviframe, "item,activated", smart_callback_that_stores_event_info_to_data, &active_it);
142 evas_object_resize(naviframe, 500, 500);
143 evas_object_show(naviframe);
144
145 for (i = 0; i < NUM_ITEMS; i++)
146 {
147 char buf[12];
148 snprintf(buf, sizeof(buf), "page%d", i);
149 it[i] = elm_naviframe_item_push(naviframe, buf, NULL, NULL, create_content(naviframe), NULL);
150 elm_naviframe_item_title_enabled_set(it[i], EINA_TRUE, EINA_TRUE);
151 }
152 ck_assert_ptr_eq(it[0], active_it);
153
154 evas_object_show(win);
155 get_me_to_those_events(win);
156
157 ecore_main_loop_begin();
158
159 ck_assert_ptr_eq(it[9], active_it);
160 click_part(naviframe, "elm.text.title");
161 get_me_to_those_events(win);
162 ck_assert_int_eq(title_clicked, 1);
163
164 click_part(naviframe, "elm.swallow.prev_btn");
165 ecore_main_loop_begin();
166 /* reaching this point verifies that the back button works */
167}
168EFL_END_TEST
169
113void elm_test_naviframe(TCase *tc) 170void elm_test_naviframe(TCase *tc)
114{ 171{
115 tcase_add_test(tc, elm_naviframe_test_legacy_type_check); 172 tcase_add_test(tc, elm_naviframe_test_legacy_type_check);
116 tcase_add_test(tc, elm_naviframe_test_atspi_role_get); 173 tcase_add_test(tc, elm_naviframe_test_atspi_role_get);
117 174
118 tcase_add_test(tc, elm_naviframe_test_content_preserve_on_pop); 175 tcase_add_test(tc, elm_naviframe_test_content_preserve_on_pop);
176 tcase_add_test(tc, elm_naviframe_test_behavior);
119} 177}