stefan pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=55c2ffbe42c0547b1fba5d9cccc1bf4303ff0302

commit 55c2ffbe42c0547b1fba5d9cccc1bf4303ff0302
Author: Mike Blumenkrantz <zm...@samsung.com>
Date:   Wed Apr 22 13:18:25 2020 -0400

    tests/elm: add more naviframe tests
    
    some tests to explicitly verify callback and internal behavior
    
    Reviewed-by: Stefan Schmidt <ste...@datenfreihafen.org>
    Differential Revision: https://phab.enlightenment.org/D11752
---
 src/tests/elementary/elm_test_naviframe.c | 58 +++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

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)
 }
 EFL_END_TEST
 
+static Eo *
+create_content(Eo *parent)
+{
+   Eo *content = elm_layout_add(parent);
+
+   evas_object_size_hint_min_set(content, 50, 50);
+
+   return content;
+}
+
+#define NUM_ITEMS 10
+EFL_START_TEST(elm_naviframe_test_behavior)
+{
+   Evas_Object *win, *naviframe;
+   //int title_transition = 0;
+   int title_clicked = 0;
+   Elm_Object_Item *active_it = NULL;
+   Elm_Object_Item *it[NUM_ITEMS];
+   int i;
+
+   win = win_add(NULL, "naviframe", ELM_WIN_BASIC);
+   evas_object_resize(win, 500, 500);
+
+   naviframe = elm_naviframe_add(win);
+   //this seems broken beyond space and time
+   //evas_object_smart_callback_add(naviframe, "title,transition,finished", 
event_callback_single_call_int_data, &title_transition);
+   evas_object_smart_callback_add(naviframe, "title,clicked", 
event_callback_single_call_int_data, &title_clicked);
+   evas_object_smart_callback_add(naviframe, "transition,finished", 
event_callback_that_quits_the_main_loop_when_called, NULL);
+   evas_object_smart_callback_add(naviframe, "item,activated", 
smart_callback_that_stores_event_info_to_data, &active_it);
+   evas_object_resize(naviframe, 500, 500);
+   evas_object_show(naviframe);
+
+   for (i = 0; i < NUM_ITEMS; i++)
+     {
+        char buf[12];
+        snprintf(buf, sizeof(buf), "page%d", i);
+        it[i] = elm_naviframe_item_push(naviframe, buf, NULL, NULL, 
create_content(naviframe), NULL);
+        elm_naviframe_item_title_enabled_set(it[i], EINA_TRUE, EINA_TRUE);
+     }
+   ck_assert_ptr_eq(it[0], active_it);
+
+   evas_object_show(win);
+   get_me_to_those_events(win);
+
+   ecore_main_loop_begin();
+
+   ck_assert_ptr_eq(it[9], active_it);
+   click_part(naviframe, "elm.text.title");
+   get_me_to_those_events(win);
+   ck_assert_int_eq(title_clicked, 1);
+
+   click_part(naviframe, "elm.swallow.prev_btn");
+   ecore_main_loop_begin();
+   /* reaching this point verifies that the back button works */
+}
+EFL_END_TEST
+
 void elm_test_naviframe(TCase *tc)
 {
    tcase_add_test(tc, elm_naviframe_test_legacy_type_check);
    tcase_add_test(tc, elm_naviframe_test_atspi_role_get);
 
    tcase_add_test(tc, elm_naviframe_test_content_preserve_on_pop);
+   tcase_add_test(tc, elm_naviframe_test_behavior);
 }

-- 


Reply via email to