summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-05-05 18:13:12 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-05-05 18:13:12 +0200
commitcbba58bf0e24fb731fc139c08debb892bcf6186b (patch)
treeaa29bd5ef72e6a7bf5e656676880d9575f6b1266
parent2123a813459f291553303c29d834436d2058cb6c (diff)
naviframe: add a test for checking expected behavior or item_pop.
-rw-r--r--src/bin/test.c2
-rw-r--r--src/bin/test_naviframe.c57
2 files changed, 59 insertions, 0 deletions
diff --git a/src/bin/test.c b/src/bin/test.c
index 4a109839c..3a747678d 100644
--- a/src/bin/test.c
+++ b/src/bin/test.c
@@ -225,6 +225,7 @@ void test_glview_manygears(void *data, Evas_Object *obj, void *event_info);
225void test_3d(void *data, Evas_Object *obj, void *event_info); 225void test_3d(void *data, Evas_Object *obj, void *event_info);
226void test_naviframe(void *data, Evas_Object *obj, void *event_info); 226void test_naviframe(void *data, Evas_Object *obj, void *event_info);
227void test_naviframe2(void *data, Evas_Object *obj, void *event_info); 227void test_naviframe2(void *data, Evas_Object *obj, void *event_info);
228void test_naviframe3(void *data, Evas_Object *obj, void *event_info);
228void test_naviframe_complex(void *data, Evas_Object *obj, void *event_info); 229void test_naviframe_complex(void *data, Evas_Object *obj, void *event_info);
229//void test_factory(void *data, Evas_Object *obj, void *event_info); 230//void test_factory(void *data, Evas_Object *obj, void *event_info);
230void test_datetime(void *data, Evas_Object *obj, void *event_info); 231void test_datetime(void *data, Evas_Object *obj, void *event_info);
@@ -803,6 +804,7 @@ add_tests:
803 //------------------------------// 804 //------------------------------//
804 ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe); 805 ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe);
805 ADD_TEST(NULL, "Naviframe", "Naviframe 2", test_naviframe2); 806 ADD_TEST(NULL, "Naviframe", "Naviframe 2", test_naviframe2);
807 ADD_TEST(NULL, "Naviframe", "Naviframe 3", test_naviframe3);
806 ADD_TEST(NULL, "Naviframe", "Naviframe: Complex", test_naviframe_complex); 808 ADD_TEST(NULL, "Naviframe", "Naviframe: Complex", test_naviframe_complex);
807 809
808 //------------------------------// 810 //------------------------------//
diff --git a/src/bin/test_naviframe.c b/src/bin/test_naviframe.c
index 3a70662b6..222b450e6 100644
--- a/src/bin/test_naviframe.c
+++ b/src/bin/test_naviframe.c
@@ -329,3 +329,60 @@ test_naviframe2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *even
329 evas_object_resize(win, 400, 400); 329 evas_object_resize(win, 400, 400);
330 evas_object_show(win); 330 evas_object_show(win);
331} 331}
332
333static void
334_bt_pop_all(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
335{
336 Elm_Object_Item *it = evas_object_data_get(obj, "root");
337
338 while (elm_naviframe_top_item_get(data) != it)
339 elm_naviframe_item_pop(data);
340}
341
342void
343test_naviframe3(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
344{
345 Evas_Object *win, *tb, *bxh, *nf, *btn, *content;
346 Elm_Object_Item *it;
347
348 snprintf(img1, sizeof(img1), "%s/images/logo.png", elm_app_data_dir_get());
349 win = elm_win_util_standard_add("naviframe", "Naviframe");
350 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
351 elm_win_autodel_set(win, EINA_TRUE);
352
353 bxh = elm_box_add(win);
354 evas_object_size_hint_weight_set(bxh, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
355 elm_box_horizontal_set(bxh, EINA_TRUE);
356 elm_win_resize_object_add(win, bxh);
357 evas_object_show(bxh);
358
359 tb = elm_toolbar_add(win);
360 evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
361 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
362 elm_toolbar_horizontal_set(tb, EINA_FALSE);
363 elm_toolbar_select_mode_set(tb, ELM_OBJECT_SELECT_MODE_ALWAYS);
364 elm_box_pack_end(bxh, tb);
365 evas_object_show(tb);
366
367 nf = elm_naviframe_add(win);
368 evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
369 evas_object_size_hint_align_set(nf, EVAS_HINT_FILL, EVAS_HINT_FILL);
370 elm_box_pack_end(bxh, nf);
371 evas_object_show(nf);
372
373 btn = elm_button_add(nf);
374 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
375 evas_object_smart_callback_add(btn, "clicked", _page2, nf);
376 BUTTON_TEXT_SET(btn, "Next");
377 evas_object_show(btn);
378
379 content = _content_new(nf, img1);
380 it = elm_naviframe_item_push(nf, "Page 1", NULL, btn, content, NULL);
381 evas_object_data_set(nf, "page1", it);
382
383 evas_object_data_set(tb, "root", it);
384 elm_toolbar_item_append(tb, NULL, "Pop all", _bt_pop_all, nf);
385
386 evas_object_resize(win, 400, 400);
387 evas_object_show(win);
388}