From f63970a154f839f2a9433e2868506fe9b63eab61 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Thu, 31 May 2018 14:38:36 +0900 Subject: [PATCH 01/16] 0008_focus: Added focus skip set test case. Change-Id: I0bb4dc82f25a3f466cac96fc34ba922ea14e1339 --- src/testcase/0008_focus.cpp | 133 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/src/testcase/0008_focus.cpp b/src/testcase/0008_focus.cpp index 4434690..210b13e 100644 --- a/src/testcase/0008_focus.cpp +++ b/src/testcase/0008_focus.cpp @@ -546,6 +546,80 @@ TEST_F(etTestFocus, focus_touch_basic) } etRunner::get().freeWinInfoList(list); } + +TEST_F(etTestFocus, focus_skip_set) +{ + etWin *tw = NULL; + Eina_Bool res = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + + res = initTC(EINA_TRUE, EINA_TRUE); + ASSERT_TRUE(res); + + // set focus_skip on tw_blue + etRunner::get().setFocusSkip(tw_blue, EINA_TRUE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + + // Expected focus res: + // [Top] Blue -> Green[focused] -> Red [Bottom] + list = etRunner::get().getWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, etWin*) + { + if (tw->native_win == tw_blue->native_win) + ASSERT_FALSE(tw->Focus.obj); + else if (tw->native_win == tw_green->native_win) + ASSERT_TRUE(tw->Focus.obj); + else + ASSERT_FALSE(tw->Focus.obj); + } + etRunner::get().freeWinInfoList(list); +} + +TEST_F(etTestFocus, focus_skip_unset) +{ + etWin *tw = NULL; + Eina_Bool res = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + + res = initTC(EINA_TRUE, EINA_TRUE); + ASSERT_TRUE(res); + + // set focus_skip on tw_blue + etRunner::get().setFocusSkip(tw_blue, EINA_TRUE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + + // Expected focus res: + // [Top] Blue -> Green[focused] -> Red [Bottom] + list = etRunner::get().getWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, etWin*) + { + if (tw->native_win == tw_blue->native_win) + ASSERT_FALSE(tw->Focus.obj); + } + etRunner::get().freeWinInfoList(list); + + // unset focus_skip on tw_blue + etRunner::get().setFocusSkip(tw_blue, EINA_FALSE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + + // Expected focus res: + // [Top] Blue -> Green[focused] -> Red [Bottom] + list = etRunner::get().getWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, etWin*) + { + if (tw->native_win == tw_green->native_win) + ASSERT_TRUE(tw->Focus.obj); + else + ASSERT_FALSE(tw->Focus.obj); + } + etRunner::get().freeWinInfoList(list); +} TEST_F(etTestFocus, focus_fullsize_basic) { etWin *tw = NULL; @@ -783,3 +857,62 @@ TEST_F(etTestFocus, focus_fullsize_uniconify) } etRunner::get().freeWinInfoList(list); } + +TEST_F(etTestFocus, focus_fullsize_skip_set) +{ + etWin *tw = NULL; + Eina_Bool res = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + + res = initTC(EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(res); + + // set focus_skip on tw_blue + etRunner::get().setFocusSkip(tw_blue, EINA_TRUE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + + // Expected focus res: + // [Top] Blue -> Green -> Red [Bottom] + list = etRunner::get().getWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, etWin*) + { + ASSERT_FALSE(tw->Focus.obj); + } + etRunner::get().freeWinInfoList(list); +} + +TEST_F(etTestFocus, focus_fullsize_skip_unset) +{ + etWin *tw = NULL; + Eina_Bool res = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + + res = initTC(EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(res); + + // set focus_skip on tw_blue + // Expected focus res: + // [Top] Blue -> Green -> Red [Bottom] + etRunner::get().setFocusSkip(tw_blue, EINA_TRUE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + + // unset focus_skip on tw_blue + etRunner::get().setFocusSkip(tw_blue, EINA_FALSE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + + // Expected focus res: + // [Top] Blue[focused] -> Green -> Red [Bottom] + list = etRunner::get().getWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, etWin*) + { + if (tw->native_win == tw_blue->native_win) + ASSERT_TRUE(tw->Focus.obj); + else + ASSERT_FALSE(tw->Focus.obj); + } + etRunner::get().freeWinInfoList(list); +} -- 2.7.4 From 2b60dfa89b0fcd2f4929eaff7898aa7e1e611f82 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Tue, 26 Jun 2018 14:32:35 +0900 Subject: [PATCH 02/16] e-tizen-testcase: remove miscopied function and add EINA_CAST_FOREACH_SAFE Change-Id: I3047cdb66fc0beeb0c5d08947bc6297cdd0f1eca --- src/eina_list_ext.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/eina_list_ext.h b/src/eina_list_ext.h index 216747a..9798508 100644 --- a/src/eina_list_ext.h +++ b/src/eina_list_ext.h @@ -24,12 +24,18 @@ l = eina_list_next(l), \ data = (caster) eina_list_data_get(l)) -#define EINA_LIST_CAST_REVERSE_FOREACH(list, l, data, caster) \ - for (l = eina_list_last(list), \ - data = (caster)eina_list_data_get(l); \ - l; \ - l = eina_list_prev(l), \ - data = (caster)eina_list_data_get(l)) +#define EINA_LIST_CAST_FOREACH_SAFE(list, l, l_next, data, caster) \ + for (l = list, \ + l_next = eina_list_next(l), \ + EINA_PREFETCH(l_next), \ + data = (caster)eina_list_data_get(l); \ + EINA_PREFETCH(data), \ + l; \ + l = l_next, \ + l_next = eina_list_prev(l), \ + EINA_PREFETCH(l_next), \ + data = (caster)eina_list_data_get(l), \ + EINA_PREFETCH(data)) #define EINA_LIST_CAST_REVERSE_FOREACH(list, l, data, caster) \ for (l = eina_list_last(list), \ -- 2.7.4 From b04fff90e3602179fa63cf496ab789274bbb98d4 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Tue, 26 Jun 2018 14:42:04 +0900 Subject: [PATCH 03/16] e_test_win: fix to show correct test case window name Change-Id: I8a19d98126ab6fc29011558a46895fafb3afe546 --- src/e_test_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/e_test_win.cpp b/src/e_test_win.cpp index 5d70843..591ddb0 100644 --- a/src/e_test_win.cpp +++ b/src/e_test_win.cpp @@ -77,7 +77,7 @@ finish: // set information animating = EINA_FALSE; native_win = 0; // TODO:: get Ecore_Window from static get_win_id function - name = eina_stringshare_add(name); + this->name = eina_stringshare_add(name); this->x = usr_geom ? x : 0; this->y = usr_geom ? y : 0; this->w = usr_geom ? w : screen_width; -- 2.7.4 From 25a783c0fb2809eecc4ea5371b84eba0b5d5bca1 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Tue, 26 Jun 2018 17:32:12 +0900 Subject: [PATCH 04/16] e-tizen-testcase: remove unused source file Change-Id: I036ce0b2829fcd83fec19bf5b7ea74184fff0344 --- src/0600_focus.c | 381 ------------------------------------------------------- 1 file changed, 381 deletions(-) delete mode 100644 src/0600_focus.c diff --git a/src/0600_focus.c b/src/0600_focus.c deleted file mode 100644 index 69e6180..0000000 --- a/src/0600_focus.c +++ /dev/null @@ -1,381 +0,0 @@ -#include "e_test_runner.h" - -struct _E_TC_Data -{ - E_TC_Win *tw_red; - E_TC_Win *tw_green; - E_TC_Win *tw_blue; - E_TC_Win *tw_register; -}; - -static Eina_Bool _tc_win_register(E_TC *tc, E_TC_Win *win); -static void _tc_win_unregister(E_TC *tc); -static Eina_Bool _tc_focus_pre_run(E_TC *tc, Eina_Bool show_win, Eina_Bool use_geom); -static void _tc_focus_post_run(E_TC *tc); -static void _tc_focus_shutdown(E_TC *tc); - - -static Eina_Bool -_tc_win_register(E_TC *tc, E_TC_Win *win) -{ - Eina_Bool res; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(tc->data, EINA_FALSE); - - EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE); - - if (tc->data->tw_register) - { - e_test_runner_req_win_deregister(tc->runner, tc->data->tw_register); - tc->data->tw_register = NULL; - } - - tc->data->tw_register = win; - - res = e_test_runner_req_win_register(tc->runner, tc->data->tw_register); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - - return EINA_TRUE; -} - -static void -_tc_win_unregister(E_TC *tc) -{ - EINA_SAFETY_ON_NULL_RETURN(tc); - EINA_SAFETY_ON_NULL_RETURN(tc->data); - EINA_SAFETY_ON_NULL_RETURN(tc->data->tw_register); - - e_test_runner_req_win_deregister(tc->runner, tc->data->tw_register); - tc->data->tw_register = NULL; -} - - -static Eina_Bool -_tc_focus_pre_run(E_TC *tc, Eina_Bool show_win, Eina_Bool use_geom) -{ - tc->data = E_NEW(E_TC_Data, 1); - EINA_SAFETY_ON_NULL_RETURN_VAL(tc->data, EINA_FALSE); - - tc->data->tw_red = e_tc_win_add(NULL, ELM_WIN_BASIC, - EINA_FALSE, "red", - 0, 0, 720, 640, EINA_FALSE, - 200, E_TC_WIN_COLOR_RED); - EINA_SAFETY_ON_NULL_GOTO(tc->data->tw_red, cleanup); - - if (show_win) - { - e_tc_win_geom_update(tc->data->tw_red); - e_tc_win_show(tc->data->tw_red); - } - - tc->data->tw_green = e_tc_win_add(NULL, ELM_WIN_BASIC, - EINA_FALSE, "green", - 0, 0, 720, 640, EINA_FALSE, - 200, E_TC_WIN_COLOR_GREEN); - EINA_SAFETY_ON_NULL_GOTO(tc->data->tw_green, cleanup); - - if (show_win) - { - e_tc_win_geom_update(tc->data->tw_green); - e_tc_win_show(tc->data->tw_green); - } - - tc->data->tw_blue = e_tc_win_add(NULL, ELM_WIN_BASIC, - EINA_FALSE, "blue", - 0, 0, 720, 640, use_geom, - 200, E_TC_WIN_COLOR_BLUE); - EINA_SAFETY_ON_NULL_GOTO(tc->data->tw_blue, cleanup); - - if (show_win) - { - _tc_win_register(tc, tc->data->tw_blue); - - e_tc_win_geom_update(tc->data->tw_blue); - e_tc_win_show(tc->data->tw_blue); - } - - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); - e_test_runner_work(); - - return EINA_TRUE; - -cleanup: - _tc_focus_shutdown(tc); - return EINA_FALSE; -} - -static void -_tc_focus_post_run(E_TC *tc) -{ - EINA_SAFETY_ON_NULL_RETURN(tc->data); - - e_tc_win_hide(tc->data->tw_red); - e_tc_win_hide(tc->data->tw_green); - e_tc_win_hide(tc->data->tw_blue); -} - -static void -_tc_focus_shutdown(E_TC *tc) -{ - EINA_SAFETY_ON_NULL_RETURN(tc->data); - - _tc_win_unregister(tc); - e_tc_win_del(tc->data->tw_red); - e_tc_win_del(tc->data->tw_green); - e_tc_win_del(tc->data->tw_blue); - - E_FREE(tc->data); -} - -Eina_Bool -tc_0600_focus_basic(E_TC *tc) -{ - E_TC_Win *tw; - E_TC_Win *tw_red, *tw_green, *tw_blue; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_focus_pre_run(tc, EINA_TRUE, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_red = tc->data->tw_red; - tw_green = tc->data->tw_green; - tw_blue = tc->data->tw_blue; - - // Expected focus result: - // [Top] Blue[focused] -> Green -> Red [Bottom] - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->native_win == tw_blue->native_win) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->focus.obj == EINA_TRUE), cleanup); - } - else if (tw->native_win == tw_green->native_win) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->focus.obj == EINA_FALSE), cleanup); - } - else if (tw->native_win == tw_red->native_win) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->focus.obj == EINA_FALSE), cleanup); - } - } - - tc->passed = EINA_TRUE; - -cleanup: - _tc_focus_post_run(tc); - _tc_focus_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0601_focus_lower(E_TC *tc) -{ - E_TC_Win *tw; - E_TC_Win *tw_red, *tw_green, *tw_blue; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_focus_pre_run(tc, EINA_TRUE, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_red = tc->data->tw_red; - tw_green = tc->data->tw_green; - tw_blue = tc->data->tw_blue; - - // make tw_blue stack lower - e_test_runner_req_win_stack_set(tc->runner, tw_blue, NULL, EINA_FALSE); - res = e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_FOCUS_CHANGED); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // Expected focus result: - // [Top] Green[focused] -> Red -> ... -> Blue [Bottom] - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->native_win == tw_blue->native_win) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->focus.obj == EINA_FALSE), cleanup); - } - else if (tw->native_win == tw_green->native_win) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->focus.obj == EINA_TRUE), cleanup); - } - else if (tw->native_win == tw_red->native_win) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->focus.obj == EINA_FALSE), cleanup); - } - } - - tc->passed = EINA_TRUE; - -cleanup: - _tc_focus_post_run(tc); - _tc_focus_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0602_focus_raise(E_TC *tc) -{ - E_TC_Win *tw; - E_TC_Win *tw_red, *tw_green, *tw_blue; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_focus_pre_run(tc, EINA_TRUE, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_red = tc->data->tw_red; - tw_green = tc->data->tw_green; - tw_blue = tc->data->tw_blue; - - // make tw_red stack raise - e_test_runner_req_win_stack_set(tc->runner, tw_red, NULL, EINA_TRUE); - res = e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_FOCUS_CHANGED); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // Expected focus result: - // [Top] Red[focused] -> Blue -> Green [Bottom] - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->native_win == tw_blue->native_win) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->focus.obj == EINA_FALSE), cleanup); - } - else if (tw->native_win == tw_green->native_win) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->focus.obj == EINA_FALSE), cleanup); - } - else if (tw->native_win == tw_red->native_win) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->focus.obj == EINA_TRUE), cleanup); - } - } - - tc->passed = EINA_TRUE; - -cleanup: - _tc_focus_post_run(tc); - _tc_focus_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0603_focus_destroy(E_TC *tc) -{ - E_TC_Win *tw; - E_TC_Win *tw_red, *tw_green; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_focus_pre_run(tc, EINA_TRUE, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_red = tc->data->tw_red; - tw_green = tc->data->tw_green; - - // delete tw_blue - e_tc_win_hide(tc->data->tw_blue); - e_tc_win_del(tc->data->tw_blue); - tc->data->tw_blue = NULL; // for skipping delete of tw_blue in _tc_focus_shutdown - - // wait for delete tw_blue - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_OFF); - - // Expected focus result: - // [Top] Green[focused] -> Red [Bottom] - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->native_win == tw_green->native_win) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->focus.obj == EINA_TRUE), cleanup); - } - else if (tw->native_win == tw_red->native_win) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->focus.obj == EINA_FALSE), cleanup); - } - } - - tc->passed = EINA_TRUE; - -cleanup: - _tc_focus_post_run(tc); - _tc_focus_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} -Eina_Bool -tc_0604_focus_partial_basic(E_TC *tc) -{ - E_TC_Win *tw = NULL; - E_TC_Win *tw_red = NULL, *tw_green = NULL, *tw_blue = NULL; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l = NULL; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_focus_pre_run(tc, EINA_TRUE, EINA_TRUE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_red = tc->data->tw_red; - tw_green = tc->data->tw_green; - tw_blue = tc->data->tw_blue; - - // Expected focus result: - // [Top] Blue[focused] -> Green -> Red [Bottom] - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->native_win == tw_blue->native_win) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->focus.obj == EINA_TRUE), cleanup); - } - else if (tw->native_win == tw_green->native_win) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->focus.obj == EINA_FALSE), cleanup); - } - else if (tw->native_win == tw_red->native_win) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->focus.obj == EINA_FALSE), cleanup); - } - } - - tc->passed = EINA_TRUE; - -cleanup: - _tc_focus_post_run(tc); - _tc_focus_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} -- 2.7.4 From 703b68df7410e793a7e288f266b47b6ca4548ced Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Wed, 27 Jun 2018 16:43:12 +0900 Subject: [PATCH 05/16] e_test_base: Add base test case and make all test case to inherit e_test_base. Change-Id: I2da618d78ef73ab9c9438edaddbac54b2de3a6a9 --- src/Makefile.am | 2 + src/e_test_base.cpp | 194 ++++++++++++ src/e_test_base.h | 31 ++ src/e_test_win.cpp | 1 - src/e_test_win.h | 1 - src/testcase/0001_easy.cpp | 11 +- src/testcase/0002_base_operation.cpp | 83 ++---- src/testcase/0003_base_operation_multi_wins.cpp | 269 +++++------------ src/testcase/0004_transient_for.cpp | 155 +++------- src/testcase/0005_notification.cpp | 161 +++------- src/testcase/0006_tzsh.cpp | 98 +++--- src/testcase/0007_rotation.cpp | 68 ++--- src/testcase/0008_focus.cpp | 381 ++++++++++++------------ 13 files changed, 649 insertions(+), 806 deletions(-) create mode 100644 src/e_test_base.cpp create mode 100644 src/e_test_base.h diff --git a/src/Makefile.am b/src/Makefile.am index e689757..c268992 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,6 +23,8 @@ e_test_runner_SOURCES = \ e_test_main.cpp \ e_test_event.h \ e_test_event.cpp \ +e_test_base.h \ +e_test_base.cpp \ e_test_win.h \ e_test_win.cpp \ e_test_util.h \ diff --git a/src/e_test_base.cpp b/src/e_test_base.cpp new file mode 100644 index 0000000..05d1c53 --- /dev/null +++ b/src/e_test_base.cpp @@ -0,0 +1,194 @@ +#include "e_test_base.h" + +using ::testing::Test; + +etTCBase::~etTCBase() +{ + etWin *tw = NULL; + numGeomTw = 0; + numTw = 0; + + // if there are any error, print list of window + if (HasFailure()) + { + etRunner::get().printWinInfoList(); + etRunner::get().waitForDestroy(); + } + + // remove register win + if (tw_register) + { + etRunner::get().deregisterWin(tw_register); + tw_register = NULL; + } + + // remove all testcase win + if (tw_list) + { + EINA_LIST_CAST_FREE(tw_list, tw, etWin*) + { + if (tw) + { + tw->hide(); + delete tw; + tw = NULL; + } + } + } + + // remove win info list + if (etRunner::get().hasLastWinInfoList()) + etRunner::get().freeLastWinInfoList(); +} + +etWin * +etTCBase::initNormalWin(const char *name, Eina_Bool show_win, Eina_Bool usr_geom) +{ + Eina_Bool res = EINA_FALSE; + etWin *tw = new etWin(); + + res = tw->init(NULL, + ELM_WIN_BASIC, + EINA_FALSE, + name? name : "TCWin_Normal", + (100*numGeomTw), (100*numGeomTw), 400, 400, usr_geom, + (E_TC_Win_Color) ((numTw % E_TC_WIN_COLOR_CYAN) + 2)); + EINA_SAFETY_ON_FALSE_GOTO(res, err); + tw->native_win = etRunner::get().getWinId(tw->elm_win); + + if (show_win) + { + res = showTCWin(tw); + EINA_SAFETY_ON_FALSE_GOTO(res, err); + } + + numTw++; + if (usr_geom) numGeomTw++; + + tw_list = eina_list_append(tw_list, tw); + + return tw; + +err: + delete tw; + return NULL; +} + +etWin * +etTCBase::initNotiWin(const char *name, Eina_Bool show_win, Eina_Bool usr_geom, Eina_Bool set_noti_level_normal) +{ + Eina_Bool res = EINA_FALSE; + etWin *tw = new etWin(); + + res = tw->init(NULL, + ELM_WIN_NOTIFICATION, + EINA_FALSE, + name? name : "TCWin_Noti", + (100*numGeomTw), (100*numGeomTw), 400, 400, usr_geom, + (E_TC_Win_Color) ((numTw % E_TC_WIN_COLOR_CYAN) + 2)); + EINA_SAFETY_ON_FALSE_GOTO(res, err); + tw->native_win = etRunner::get().getWinId(tw->elm_win); + + if (set_noti_level_normal) + etRunner::get().setWinNotiLevel(tw, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); + + if (show_win) + { + res = showTCWin(tw); + EINA_SAFETY_ON_FALSE_GOTO(res, err); + } + + numTw++; + if (usr_geom) numGeomTw++; + + tw_list = eina_list_append(tw_list, tw); + + return tw; + +err: + delete tw; + return NULL; +} + +Eina_Bool +etTCBase::registerTCWin(etWin *tw) +{ + Eina_Bool res = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); + EINA_SAFETY_ON_TRUE_RETURN_VAL(tw == tw_register, EINA_TRUE); + + if (tw_register) + { + res = etRunner::get().deregisterWin(tw_register); + EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); + + tw_register = NULL; + } + + res = etRunner::get().registerWin(tw); + EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); + + tw_register = tw; + + return EINA_TRUE; +} + +Eina_Bool +etTCBase::deregisterTCWin(etWin *tw) +{ + Eina_Bool res = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(tw_register, EINA_TRUE); + EINA_SAFETY_ON_TRUE_RETURN_VAL(tw != tw_register, EINA_FALSE); + + res = etRunner::get().deregisterWin(tw); + EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); + + tw_register = NULL; + + return EINA_TRUE; +} + +Eina_Bool +etTCBase::showTCWin(etWin *tw) +{ + Eina_Bool res = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(tw->elm_win, EINA_FALSE); + + res = registerTCWin(tw); + EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); + + tw->updateGeometry(); + tw->show(); + + etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_ON); + + return EINA_TRUE; +} + +Eina_Bool +etTCBase::removeTCWin(etWin *tw) +{ + Eina_Bool res = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(tw->elm_win, EINA_FALSE); + + res = registerTCWin(tw); + EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); + + tw->hide(); + + etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_OFF); + + res = deregisterTCWin(tw); + tw_list = eina_list_remove(tw_list, tw); + delete tw; + + return EINA_TRUE; +} + diff --git a/src/e_test_base.h b/src/e_test_base.h new file mode 100644 index 0000000..5572f4f --- /dev/null +++ b/src/e_test_base.h @@ -0,0 +1,31 @@ +#ifndef __ET_TESTCASE_BASE__ +#define __ET_TESTCASE_BASE__ + +#include "e_test_event.h" + +using ::testing::Test; + +class etTCBase : public ::testing::Test +{ + public: + etTCBase() { }; + ~etTCBase(); + + public: + etWin *initNormalWin(const char *name, Eina_Bool show_win, Eina_Bool usr_geom); + etWin *initNotiWin(const char *name, Eina_Bool show_win, Eina_Bool usr_geom, Eina_Bool set_noti_level_normal); + + Eina_Bool registerTCWin(etWin *tw); + Eina_Bool deregisterTCWin(etWin *tw); + Eina_Bool showTCWin(etWin *tw); + Eina_Bool removeTCWin(etWin *tw); + + private: + etWin *tw_register = NULL; + Eina_List *tw_list = NULL; + + int numTw = 0; // number of wins + int numGeomTw = 0; // number of wins using usr_geom +}; + +#endif // end of __ET_TESTCASE_BASE__ diff --git a/src/e_test_win.cpp b/src/e_test_win.cpp index 591ddb0..57810da 100644 --- a/src/e_test_win.cpp +++ b/src/e_test_win.cpp @@ -25,7 +25,6 @@ etWin::init(etWin *parent, int x, int y, int w, int h, Eina_Bool usr_geom, - E_Layer layer, E_TC_Win_Color color) { Evas_Object *bg = NULL; diff --git a/src/e_test_win.h b/src/e_test_win.h index a80207d..a2b7566 100644 --- a/src/e_test_win.h +++ b/src/e_test_win.h @@ -44,7 +44,6 @@ public: const char *name, int x, int y, int w, int h, Eina_Bool usr_geom, - E_Layer layer, E_TC_Win_Color color); void deInit(); void updateGeometry() diff --git a/src/testcase/0001_easy.cpp b/src/testcase/0001_easy.cpp index 4733e99..f174a48 100644 --- a/src/testcase/0001_easy.cpp +++ b/src/testcase/0001_easy.cpp @@ -1,18 +1,13 @@ -#include #include "e_test_event.h" +#include "e_test_base.h" #define _WIN_ID 0x123456 -using ::testing::Test; - -class etTestEasy : public ::testing::Test +class etTestEasy : public ::etTCBase { public: etTestEasy() { }; - ~etTestEasy() - { - if (HasFailure()) etRunner::get().waitForDestroy(); - }; + ~etTestEasy() { }; }; static void diff --git a/src/testcase/0002_base_operation.cpp b/src/testcase/0002_base_operation.cpp index 2f17c63..89690d9 100644 --- a/src/testcase/0002_base_operation.cpp +++ b/src/testcase/0002_base_operation.cpp @@ -1,67 +1,33 @@ -#include #include "e_test_event.h" +#include "e_test_base.h" -using ::testing::Test; - -class etTestBaseOperation : public ::testing::Test -{ -public: - etTestBaseOperation() { }; - ~etTestBaseOperation() - { - if (HasFailure()) etRunner::get().waitForDestroy(); - - if (tw) - { - etRunner::get().deregisterWin(tw); - tw->deInit(); - delete tw; - tw = NULL; - } - - if (etRunner::get().hasLastWinInfoList()) - etRunner::get().freeLastWinInfoList(); - }; - -protected: - etWin *tw = NULL; - - Eina_Bool initTC(Eina_Bool alpha); -}; - -Eina_Bool -etTestBaseOperation::initTC(Eina_Bool alpha) +class etTestBaseOperation : public ::etTCBase { - Eina_Bool res = EINA_FALSE; + public: + etTestBaseOperation() { }; + ~etTestBaseOperation() { }; - tw = new etWin(); - tw->init(NULL, - ELM_WIN_BASIC, - alpha, - "E_Testcase_Window", - 0, 0, 320, 320, EINA_FALSE, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_GREEN); - EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); - tw->native_win = etRunner::get().getWinId(tw->elm_win); + protected: + etWin *tw = NULL; - res = etRunner::get().registerWin(tw); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); + void initTC(Eina_Bool alpha_set); +}; - tw->updateGeometry(); - tw->show(); +void +etTestBaseOperation::initTC(Eina_Bool alpha_set) +{ + tw = initNormalWin("TCWin_Normal", EINA_FALSE, EINA_TRUE); + ASSERT_TRUE(tw != NULL) << "failed to initiation window"; - etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_ON); + if (alpha_set) + elm_win_alpha_set(tw->elm_win, alpha_set); - return EINA_TRUE; + ASSERT_TRUE(showTCWin(tw)) << "failed to show window"; } TEST_F(etTestBaseOperation, win_show) { - Eina_Bool res = EINA_FALSE; - - res = initTC(EINA_FALSE); - ASSERT_TRUE(res); + initTC(EINA_FALSE); } TEST_F(etTestBaseOperation, win_stack) @@ -70,8 +36,7 @@ TEST_F(etTestBaseOperation, win_stack) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_FALSE); - ASSERT_TRUE(res); + initTC(EINA_FALSE); list = etRunner::get().getWinInfoList(); ASSERT_TRUE(list != NULL); @@ -93,10 +58,7 @@ TEST_F(etTestBaseOperation, win_stack) TEST_F(etTestBaseOperation, alpha_win_show) { - Eina_Bool res = EINA_FALSE; - - res = initTC(EINA_TRUE); - ASSERT_TRUE(res); + initTC(EINA_TRUE); } TEST_F(etTestBaseOperation, alpha_win_stack) @@ -105,8 +67,7 @@ TEST_F(etTestBaseOperation, alpha_win_stack) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE); - ASSERT_TRUE(res); + initTC(EINA_TRUE); list = etRunner::get().getWinInfoList(); ASSERT_TRUE(list != NULL); @@ -123,5 +84,5 @@ TEST_F(etTestBaseOperation, alpha_win_stack) } etRunner::get().freeWinInfoList(list); - ASSERT_TRUE(EINA_TRUE); + ASSERT_TRUE(res); } diff --git a/src/testcase/0003_base_operation_multi_wins.cpp b/src/testcase/0003_base_operation_multi_wins.cpp index 7ec8aa3..d313416 100644 --- a/src/testcase/0003_base_operation_multi_wins.cpp +++ b/src/testcase/0003_base_operation_multi_wins.cpp @@ -1,145 +1,41 @@ -#include #include "e_test_event.h" +#include "e_test_base.h" -using ::testing::Test; - -class etTestBaseMulti : public ::testing::Test -{ -public: - etTestBaseMulti() { }; - ~etTestBaseMulti() - { - if (HasFailure()) etRunner::get().waitForDestroy(); - if (tw_register) etRunner::get().deregisterWin(tw_register); - if (tw_red) delete tw_red; - if (tw_blue) delete tw_blue; - if (tw_green) delete tw_green; - if (etRunner::get().hasLastWinInfoList()) etRunner::get().freeLastWinInfoList(); - }; - -protected: - etWin *tw_red = NULL; - etWin *tw_green = NULL; - etWin *tw_blue = NULL; - etWin *tw_register = NULL; - - Eina_Bool registerTCWin(etWin *tw); - Eina_Bool initTC(Eina_Bool show_win, Eina_Bool use_geom); - Eina_Bool showTCWin(etWin *tw); -}; - -Eina_Bool -etTestBaseMulti::registerTCWin(etWin *tw) -{ - Eina_Bool res = EINA_FALSE; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); - EINA_SAFETY_ON_TRUE_RETURN_VAL(tw == tw_register, EINA_TRUE); - - if (tw_register) - { - etRunner::get().deregisterWin(tw_register); - tw_register = NULL; - } - - res = etRunner::get().registerWin(tw); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - - tw_register = tw; - - return EINA_TRUE; -} - -Eina_Bool -etTestBaseMulti::initTC(Eina_Bool show_win, - Eina_Bool use_geom) +class etTestBaseMulti : public ::etTCBase { - tw_red = new etWin(); - tw_red->init(NULL, - ELM_WIN_BASIC, - EINA_FALSE, - "etWin Red", - 0, 0, 400, 400, use_geom, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_RED); - EINA_SAFETY_ON_NULL_RETURN_VAL(tw_red, EINA_FALSE); - tw_red->native_win = etRunner::get().getWinId(tw_red->elm_win); - - if (show_win) - { - tw_red->updateGeometry(); - tw_red->show(); - } - - tw_green = new etWin(); - tw_green->init(NULL, - ELM_WIN_BASIC, - EINA_FALSE, - "etWin Green", - 50, 50, 400, 400, use_geom, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_GREEN); - EINA_SAFETY_ON_NULL_RETURN_VAL(tw_green, EINA_FALSE); + public: + etTestBaseMulti() { }; + ~etTestBaseMulti() { }; - tw_green->native_win = etRunner::get().getWinId(tw_green->elm_win); + protected: + etWin *tw_red = NULL; + etWin *tw_green = NULL; + etWin *tw_blue = NULL; - if (show_win) - { - tw_green->updateGeometry(); - tw_green->show(); - } - - tw_blue = new etWin(); - tw_blue->init(NULL, - ELM_WIN_BASIC, - EINA_FALSE, - "etWin Blue", - 100, 100, 400, 400, use_geom, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_BLUE); - EINA_SAFETY_ON_NULL_RETURN_VAL(tw_blue, EINA_FALSE); - - tw_blue->native_win = etRunner::get().getWinId(tw_blue->elm_win); - - if (show_win) - { - registerTCWin(tw_blue); - - tw_blue->updateGeometry(); - tw_blue->show(); - - etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_ON); - } - - return EINA_TRUE; -} + void initTC(Eina_Bool show_win, Eina_Bool usr_geom); +}; -Eina_Bool -etTestBaseMulti::showTCWin(etWin *tw) +void +etTestBaseMulti::initTC(Eina_Bool show_win, Eina_Bool usr_geom) { - Eina_Bool res = EINA_FALSE; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); - - res = registerTCWin(tw); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); + tw_red = initNormalWin("TCWin_Normal_red", show_win, usr_geom); + ASSERT_TRUE(tw_red != NULL) << "failed to initiation window"; - tw->updateGeometry(); - tw->show(); - etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_ON); + tw_green = initNormalWin("TCWin_Normal_green", show_win, usr_geom); + ASSERT_TRUE(tw_green != NULL) << "failed to initiation window"; - return EINA_TRUE; + tw_blue = initNormalWin("TCWin_Normal_blue", show_win, usr_geom); + ASSERT_TRUE(tw_blue != NULL) << "failed to initiation window"; } TEST_F(etTestBaseMulti, multi_all_wins_basic) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // Expected stack res: // [Top] Blue -> Green -> Red [Bottom] @@ -183,8 +79,8 @@ TEST_F(etTestBaseMulti, multi_all_wins_show1) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_FALSE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=false, geom=true + initTC(EINA_FALSE, EINA_TRUE); // show red res = showTCWin(tw_red); @@ -240,8 +136,8 @@ TEST_F(etTestBaseMulti, multi_all_wins_show2) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_FALSE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=false, geom=true + initTC(EINA_FALSE, EINA_TRUE); // show blue res = showTCWin(tw_blue); @@ -297,8 +193,8 @@ TEST_F(etTestBaseMulti, multi_all_wins_show3) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_FALSE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=false, geom=true + initTC(EINA_FALSE, EINA_TRUE); // show green res = showTCWin(tw_green); @@ -350,12 +246,11 @@ TEST_F(etTestBaseMulti, multi_all_wins_show3) TEST_F(etTestBaseMulti, multi_all_wins_raise1) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // Raise Red etRunner::get().setWinStack(tw_red, NULL, EINA_TRUE); @@ -399,12 +294,11 @@ TEST_F(etTestBaseMulti, multi_all_wins_raise1) TEST_F(etTestBaseMulti, multi_all_wins_raise2) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // Raise Green etRunner::get().setWinStack(tw_green, NULL, EINA_TRUE); @@ -448,12 +342,11 @@ TEST_F(etTestBaseMulti, multi_all_wins_raise2) TEST_F(etTestBaseMulti, multi_all_wins_stack_above1) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // Raise Red on the Green etRunner::get().setWinStack(tw_red, tw_green, EINA_TRUE); @@ -497,12 +390,11 @@ TEST_F(etTestBaseMulti, multi_all_wins_stack_above1) TEST_F(etTestBaseMulti, multi_all_wins_stack_above2) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // Raise Blue on the Red etRunner::get().setWinStack(tw_blue, tw_red, EINA_TRUE); @@ -546,12 +438,11 @@ TEST_F(etTestBaseMulti, multi_all_wins_stack_above2) TEST_F(etTestBaseMulti, multi_all_wins_stack_above3) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // Raise Red on the Blue etRunner::get().setWinStack(tw_red, tw_blue, EINA_TRUE); @@ -595,12 +486,11 @@ TEST_F(etTestBaseMulti, multi_all_wins_stack_above3) TEST_F(etTestBaseMulti, multi_all_wins_lower1) { etWin *tw = NULL, *tw_above = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // Lower Blue etRunner::get().setWinStack(tw_blue, NULL, EINA_FALSE); @@ -660,12 +550,11 @@ TEST_F(etTestBaseMulti, multi_all_wins_lower1) TEST_F(etTestBaseMulti, multi_all_wins_lower2) { etWin *tw = NULL, *tw_above = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // Lower Green etRunner::get().setWinStack(tw_green, NULL, EINA_FALSE); @@ -725,12 +614,11 @@ TEST_F(etTestBaseMulti, multi_all_wins_lower2) TEST_F(etTestBaseMulti, multi_all_full_wins_basic) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // Expected stack res: // [Top] Blue -> Green -> Red [Bottom] @@ -774,8 +662,8 @@ TEST_F(etTestBaseMulti, multi_all_full_wins_show1) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_FALSE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=false, geom=false + initTC(EINA_FALSE, EINA_FALSE); // show red res = showTCWin(tw_red); @@ -831,8 +719,8 @@ TEST_F(etTestBaseMulti, multi_all_full_wins_show2) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_FALSE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=false, geom=false + initTC(EINA_FALSE, EINA_FALSE); // show blue res = showTCWin(tw_blue); @@ -888,8 +776,8 @@ TEST_F(etTestBaseMulti, multi_all_full_wins_show3) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_FALSE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=false, geom=false + initTC(EINA_FALSE, EINA_FALSE); // show green res = showTCWin(tw_green); @@ -941,12 +829,11 @@ TEST_F(etTestBaseMulti, multi_all_full_wins_show3) TEST_F(etTestBaseMulti, multi_all_full_wins_raise1) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // Raise Red etRunner::get().setWinStack(tw_red, NULL, EINA_TRUE); @@ -990,12 +877,11 @@ TEST_F(etTestBaseMulti, multi_all_full_wins_raise1) TEST_F(etTestBaseMulti, multi_all_full_wins_raise2) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // Raise Green etRunner::get().setWinStack(tw_green, NULL, EINA_TRUE); @@ -1039,12 +925,11 @@ TEST_F(etTestBaseMulti, multi_all_full_wins_raise2) TEST_F(etTestBaseMulti, multi_all_full_wins_stack_above1) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // Raise Red on the Green etRunner::get().setWinStack(tw_red, tw_green, EINA_TRUE); @@ -1088,12 +973,11 @@ TEST_F(etTestBaseMulti, multi_all_full_wins_stack_above1) TEST_F(etTestBaseMulti, multi_all_full_wins_stack_above2) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // Raise Blue on the Red etRunner::get().setWinStack(tw_blue, tw_red, EINA_TRUE); @@ -1137,12 +1021,11 @@ TEST_F(etTestBaseMulti, multi_all_full_wins_stack_above2) TEST_F(etTestBaseMulti, multi_all_full_wins_stack_above3) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // Raise Red on the Blue etRunner::get().setWinStack(tw_red, tw_blue, EINA_TRUE); @@ -1186,12 +1069,11 @@ TEST_F(etTestBaseMulti, multi_all_full_wins_stack_above3) TEST_F(etTestBaseMulti, multi_all_full_wins_lower1) { etWin *tw = NULL, *tw_above = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // Lower Blue etRunner::get().setWinStack(tw_blue, NULL, EINA_FALSE); @@ -1251,12 +1133,11 @@ TEST_F(etTestBaseMulti, multi_all_full_wins_lower1) TEST_F(etTestBaseMulti, multi_all_full_wins_lower2) { etWin *tw = NULL, *tw_above = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // Lower Green etRunner::get().setWinStack(tw_green, NULL, EINA_FALSE); @@ -1320,8 +1201,8 @@ TEST_F(etTestBaseMulti, multi_2wins_show1) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_FALSE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=false, geom=true + initTC(EINA_FALSE, EINA_TRUE); // show green res = showTCWin(tw_green); @@ -1367,8 +1248,8 @@ TEST_F(etTestBaseMulti, multi_2wins_show2) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_FALSE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=false, geom=true + initTC(EINA_FALSE, EINA_TRUE); // show blue res = showTCWin(tw_blue); @@ -1414,8 +1295,8 @@ TEST_F(etTestBaseMulti, multi_2wins_show3) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_FALSE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=false, geom=true + initTC(EINA_FALSE, EINA_TRUE); // show red res = showTCWin(tw_red); @@ -1461,8 +1342,8 @@ TEST_F(etTestBaseMulti, multi_full_2wins_show1) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_FALSE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=false, geom=false + initTC(EINA_FALSE, EINA_FALSE); // show green res = showTCWin(tw_green); @@ -1508,8 +1389,8 @@ TEST_F(etTestBaseMulti, multi_full_2wins_show2) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_FALSE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=false, geom=false + initTC(EINA_FALSE, EINA_FALSE); // show blue res = showTCWin(tw_blue); @@ -1555,8 +1436,8 @@ TEST_F(etTestBaseMulti, multi_full_2wins_show3) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(EINA_FALSE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=false, geom=false + initTC(EINA_FALSE, EINA_FALSE); // show red res = showTCWin(tw_red); diff --git a/src/testcase/0004_transient_for.cpp b/src/testcase/0004_transient_for.cpp index 4c686e3..a4e9b47 100644 --- a/src/testcase/0004_transient_for.cpp +++ b/src/testcase/0004_transient_for.cpp @@ -1,122 +1,31 @@ #include "e_test_event.h" +#include "e_test_base.h" -using ::testing::Test; - -class etTestTransientFor : public ::testing::Test -{ -public: - etTestTransientFor() { }; - ~etTestTransientFor() - { - if (HasFailure()) etRunner::get().waitForDestroy(); - if (tw_register) etRunner::get().deregisterWin(tw_register); - if (tw_base) delete tw_base; - if (tw_parent) delete tw_parent; - if (tw_child) delete tw_child; - if (etRunner::get().hasLastWinInfoList()) etRunner::get().freeLastWinInfoList(); - }; - -protected: - etWin *tw_base = NULL; - etWin *tw_parent = NULL; - etWin *tw_child = NULL; - etWin *tw_register = NULL; - - Eina_Bool registerTCWin(etWin *tw); - Eina_Bool initTC(); - Eina_Bool showTCWin(etWin *tw); -}; - -Eina_Bool -etTestTransientFor::registerTCWin(etWin *tw) -{ - Eina_Bool res = EINA_FALSE; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); - - if (tw_register) - { - etRunner::get().deregisterWin(tw_register); - tw_register = NULL; - } - - res = etRunner::get().registerWin(tw); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - - tw_register = tw; - - return EINA_TRUE; -} - -Eina_Bool -etTestTransientFor::initTC() +class etTestTransientFor : public ::etTCBase { - Eina_Bool res = EINA_FALSE; + public: + etTestTransientFor() { }; + ~etTestTransientFor() { }; - tw_parent = new etWin(); - tw_parent->init(NULL, - ELM_WIN_BASIC, - EINA_FALSE, - "etWin Parent", - 0, 0, 400, 400, EINA_FALSE, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_BLUE); - EINA_SAFETY_ON_NULL_RETURN_VAL(tw_parent, EINA_FALSE); - - tw_parent->native_win = etRunner::get().getWinId(tw_parent->elm_win); - - res = showTCWin(tw_parent); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - - tw_child = new etWin(); - tw_child->init(NULL, - ELM_WIN_BASIC, - EINA_FALSE, - "etWin Child", - 0, 0, 320, 320, EINA_FALSE, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_RED); - EINA_SAFETY_ON_NULL_RETURN_VAL(tw_child, EINA_FALSE); - tw_child->native_win = etRunner::get().getWinId(tw_child->elm_win); - - res = showTCWin(tw_child); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - - tw_base = new etWin(); - tw_base->init(NULL,ELM_WIN_BASIC, - EINA_FALSE, - "etWin Base", - 200, 200, 500, 500, EINA_FALSE, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_RED); - EINA_SAFETY_ON_NULL_RETURN_VAL(tw_base, EINA_FALSE); - tw_base->native_win = etRunner::get().getWinId(tw_base->elm_win); - - res = showTCWin(tw_base); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); + protected: + etWin *tw_parent = NULL; + etWin *tw_child = NULL; + etWin *tw_base = NULL; - // set transient_for - res = etRunner::get().setWinTransientFor(tw_child, - tw_parent, - EINA_TRUE); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - - return EINA_TRUE; -} + void initTC(Eina_Bool show_win, Eina_Bool usr_geom); +}; -Eina_Bool -etTestTransientFor::showTCWin(etWin *tw) +void +etTestTransientFor::initTC(Eina_Bool show_win, Eina_Bool usr_geom) { - Eina_Bool res = EINA_FALSE; - - res = registerTCWin(tw); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); + tw_parent = initNormalWin("TCWin_Normal_parent", show_win, usr_geom); + ASSERT_TRUE(tw_parent != NULL) << "failed to initiation window"; - tw->updateGeometry(); - tw->show(); - etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_ON); + tw_child = initNormalWin("TCWin_Normal_child", show_win, usr_geom); + ASSERT_TRUE(tw_child != NULL) << "failed to initiation window"; - return EINA_TRUE; + tw_base = initNormalWin("TCWin_Normal_normal", show_win, usr_geom); + ASSERT_TRUE(tw_base != NULL) << "failed to initiation window"; } TEST_F(etTestTransientFor, transient_for_basic) @@ -126,7 +35,11 @@ TEST_F(etTestTransientFor, transient_for_basic) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); + + // set transient_for + res = etRunner::get().setWinTransientFor(tw_child, tw_parent, EINA_TRUE); ASSERT_TRUE(res); // Expected stack res: @@ -170,7 +83,11 @@ TEST_F(etTestTransientFor, transient_for_raise) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); + + // set transient_for + res = etRunner::get().setWinTransientFor(tw_child, tw_parent, EINA_TRUE); ASSERT_TRUE(res); res = registerTCWin(tw_parent); @@ -223,7 +140,11 @@ TEST_F(etTestTransientFor, transient_for_lower) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); + + // set transient_for + res = etRunner::get().setWinTransientFor(tw_child, tw_parent, EINA_TRUE); ASSERT_TRUE(res); res = registerTCWin(tw_parent); @@ -292,12 +213,16 @@ TEST_F(etTestTransientFor, transient_for_above) Eina_List *list = NULL, *l = NULL; int pass_count = 0; - res = initTC(); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); res = registerTCWin(tw_parent); EXPECT_TRUE(res); + // set transient_for + res = etRunner::get().setWinTransientFor(tw_child, tw_parent, EINA_TRUE); + ASSERT_TRUE(res); + // tw_parent raise for prepare lower res = etRunner::get().setWinStack(tw_parent, tw_base, EINA_TRUE); etRunner::get().waitEvent(E_TC_EVENT_TYPE_STACK_ABOVE); diff --git a/src/testcase/0005_notification.cpp b/src/testcase/0005_notification.cpp index c4f6207..28b5ab1 100644 --- a/src/testcase/0005_notification.cpp +++ b/src/testcase/0005_notification.cpp @@ -1,105 +1,32 @@ #include "e_test_event.h" +#include "e_test_base.h" #include -using ::testing::Test; - -class etTestNotification : public ::testing::Test -{ -public: - etTestNotification() { }; - ~etTestNotification() - { - if (HasFailure()) etRunner::get().waitForDestroy(); - if (tw_register) etRunner::get().deregisterWin(tw_register); - if (tw_normal) delete tw_normal; - if (tw_noti1) delete tw_noti1; - if (tw_noti2) delete tw_noti2; - if (etRunner::get().hasLastWinInfoList()) etRunner::get().freeLastWinInfoList(); - }; - -protected: - etWin *tw_normal = NULL; - etWin *tw_noti1 = NULL; - etWin *tw_noti2 = NULL; - etWin *tw_register = NULL; - - Eina_Bool initTC(Eina_Bool use_geom); - Eina_Bool registerTCWin(etWin *tw); -}; - -Eina_Bool -etTestNotification::initTC(Eina_Bool use_geom) +class etTestNotification : public ::etTCBase { - Eina_Bool res = EINA_FALSE; - tw_normal = new etWin(); - tw_normal->init(NULL, - ELM_WIN_BASIC, - EINA_FALSE, - "etWin Normal", - 0, 0, 400, 400, use_geom, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_RED); - EINA_SAFETY_ON_NULL_RETURN_VAL(tw_normal, EINA_FALSE); - tw_normal->native_win = etRunner::get().getWinId(tw_normal->elm_win); - - tw_normal->updateGeometry(); - tw_normal->show(); - - tw_noti1 = new etWin(); - tw_noti1->init(NULL, - ELM_WIN_NOTIFICATION, - EINA_FALSE, - "etWin Noti_1", - 100, 100, 400, 400, use_geom, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_GREEN); - EINA_SAFETY_ON_NULL_RETURN_VAL(tw_noti1, EINA_FALSE); - tw_noti1->native_win = etRunner::get().getWinId(tw_noti1->elm_win); - - tw_noti1->updateGeometry(); - tw_noti1->show(); - - tw_noti2 = new etWin(); - tw_noti2->init(NULL, - ELM_WIN_NOTIFICATION, - EINA_FALSE, - "etWin Noti_2", - 50, 200, 400, 400, use_geom, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_BLUE); - EINA_SAFETY_ON_NULL_RETURN_VAL(tw_noti2, EINA_FALSE); - tw_noti2->native_win = etRunner::get().getWinId(tw_noti2->elm_win); - - tw_noti2->updateGeometry(); - tw_noti2->show(); - - // register window - res = registerTCWin(tw_normal); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - - etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_ON); - - return EINA_TRUE; -} + public: + etTestNotification() { }; + ~etTestNotification() { }; -Eina_Bool -etTestNotification::registerTCWin(etWin *tw) -{ - Eina_Bool res = EINA_FALSE; - EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); + protected: + etWin *tw_normal = NULL; + etWin *tw_noti1 = NULL; + etWin *tw_noti2 = NULL; - if (tw_register) - { - etRunner::get().deregisterWin(tw_register); - tw_register = NULL; - } + void initTC(Eina_Bool usr_geom); +}; - res = etRunner::get().registerWin(tw); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); +void +etTestNotification::initTC(Eina_Bool usr_geom) +{ + tw_normal = initNormalWin("TCWin_Normal_normal", EINA_TRUE, usr_geom); + ASSERT_TRUE(tw_normal != NULL) << "failed to initiation window"; - tw_register = tw; + tw_noti1 = initNotiWin("TCWin_Noti_1", EINA_TRUE, usr_geom, EINA_FALSE); + ASSERT_TRUE(tw_noti1 != NULL) << "failed to initiation window"; - return EINA_TRUE; + tw_noti2 = initNotiWin("TCWin_Noti_2", EINA_TRUE, usr_geom, EINA_FALSE); + ASSERT_TRUE(tw_noti2 != NULL) << "failed to initiation window"; } TEST_F(etTestNotification, notification_level_default) @@ -110,8 +37,8 @@ TEST_F(etTestNotification, notification_level_default) efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; int pass_count = 0; - res = initTC(EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, geom=true + initTC(EINA_TRUE); // set tw_noti1 to notification layer res = etRunner::get().setWinNotiLevel(tw_noti1, @@ -173,8 +100,8 @@ TEST_F(etTestNotification, notification_level_medium) efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; int pass_count = 0; - res = initTC(EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, geom=true + initTC(EINA_TRUE); // set tw_noti1 to notification layer res = etRunner::get().setWinNotiLevel(tw_noti1, @@ -236,8 +163,8 @@ TEST_F(etTestNotification, notification_level_high) efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; int pass_count = 0; - res = initTC(EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, geom=true + initTC(EINA_TRUE); // set tw_noti1 to notification layer res = etRunner::get().setWinNotiLevel(tw_noti1, @@ -299,8 +226,8 @@ TEST_F(etTestNotification, notification_level_top) efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; int pass_count = 0; - res = initTC(EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, geom=true + initTC(EINA_TRUE); // set tw_noti1 to notification layer res = etRunner::get().setWinNotiLevel(tw_noti1, @@ -362,8 +289,8 @@ TEST_F(etTestNotification, notification_level_none) efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; int pass_count = 0; - res = initTC(EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, geom=true + initTC(EINA_TRUE); // set tw_noti1 to notification high res = etRunner::get().setWinNotiLevel(tw_noti1, @@ -480,8 +407,8 @@ TEST_F(etTestNotification, notification_level_change) efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; int pass_count = 0; - res = initTC(EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, geom=true + initTC(EINA_TRUE); // set tw_noti1 to notification default res = etRunner::get().setWinNotiLevel(tw_noti1, @@ -646,8 +573,8 @@ TEST_F(etTestNotification, notification_fullsize_level_default) efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; int pass_count = 0; - res = initTC(EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, geom=false + initTC(EINA_FALSE); // set tw_noti1 to notification layer res = etRunner::get().setWinNotiLevel(tw_noti1, @@ -709,8 +636,8 @@ TEST_F(etTestNotification, notification_fullsize_level_medium) efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; int pass_count = 0; - res = initTC(EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, geom=false + initTC(EINA_FALSE); // set tw_noti1 to notification layer res = etRunner::get().setWinNotiLevel(tw_noti1, @@ -772,8 +699,8 @@ TEST_F(etTestNotification, notification_fullsize_level_high) efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; int pass_count = 0; - res = initTC(EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, geom=false + initTC(EINA_FALSE); // set tw_noti1 to notification layer res = etRunner::get().setWinNotiLevel(tw_noti1, @@ -835,8 +762,8 @@ TEST_F(etTestNotification, notification_fullsize_level_top) efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; int pass_count = 0; - res = initTC(EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, geom=false + initTC(EINA_FALSE); // set tw_noti1 to notification layer res = etRunner::get().setWinNotiLevel(tw_noti1, @@ -898,8 +825,8 @@ TEST_F(etTestNotification, notification_fullsize_level_none) efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; int pass_count = 0; - res = initTC(EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, geom=false + initTC(EINA_FALSE); // set tw_noti1 to notification high res = etRunner::get().setWinNotiLevel(tw_noti1, @@ -1016,8 +943,8 @@ TEST_F(etTestNotification, notification_fullsize_level_change) efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; int pass_count = 0; - res = initTC(EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, geom=false + initTC(EINA_FALSE); // set tw_noti1 to notification default res = etRunner::get().setWinNotiLevel(tw_noti1, diff --git a/src/testcase/0006_tzsh.cpp b/src/testcase/0006_tzsh.cpp index ed06d44..4a76565 100644 --- a/src/testcase/0006_tzsh.cpp +++ b/src/testcase/0006_tzsh.cpp @@ -1,75 +1,50 @@ #include "e_test_event.h" +#include "e_test_base.h" #include #include #define E_TEST_WORK_TIME 3.0 -using ::testing::Test; - -class etTestTzsh : public :: testing::Test +class etTestTzsh : public ::etTCBase { -public: - Eina_Bool chk_timeout_val_ = EINA_FALSE; - Eina_Bool chk_ev_state_idle_timeout_ = EINA_FALSE; - Eina_Bool chk_ev_state_not_idle_ = EINA_FALSE; - int chk_cb_called_ = 0; - - tzsh_h tzsh = NULL; - tzsh_window tz_win = 0x0; - tzsh_screensaver_service_h tz_scrsaver = NULL; - tzsh_screensaver_manager_service_h tz_scrsaver_mng = NULL; - - etTestTzsh() - { - chk_timeout_val_ = EINA_FALSE; - chk_ev_state_idle_timeout_ = EINA_FALSE; - chk_ev_state_not_idle_ = EINA_FALSE; - chk_cb_called_ = 0; - }; - - ~etTestTzsh() - { - if (HasFailure()) etRunner::get().waitForDestroy(); - if (tz_scrsaver_mng) tzsh_screensaver_manager_service_destroy(tz_scrsaver_mng); - if (tz_scrsaver) tzsh_screensaver_service_destroy(tz_scrsaver); - if (tzsh) tzsh_destroy(tzsh); - if (tw_base) - { - etRunner::get().deregisterWin(tw_base); - delete tw_base; - } - - if (etRunner::get().hasLastWinInfoList()) etRunner::get().freeLastWinInfoList(); - }; - -protected: - etWin *tw_base = NULL; - - Eina_Bool initTC(); + public: + Eina_Bool chk_timeout_val_ = EINA_FALSE; + Eina_Bool chk_ev_state_idle_timeout_ = EINA_FALSE; + Eina_Bool chk_ev_state_not_idle_ = EINA_FALSE; + int chk_cb_called_ = 0; + + tzsh_h tzsh = NULL; + tzsh_window tz_win = 0x0; + tzsh_screensaver_service_h tz_scrsaver = NULL; + tzsh_screensaver_manager_service_h tz_scrsaver_mng = NULL; + + etTestTzsh() + { + chk_timeout_val_ = EINA_FALSE; + chk_ev_state_idle_timeout_ = EINA_FALSE; + chk_ev_state_not_idle_ = EINA_FALSE; + chk_cb_called_ = 0; + }; + + ~etTestTzsh() + { + if (tz_scrsaver_mng) tzsh_screensaver_manager_service_destroy(tz_scrsaver_mng); + if (tz_scrsaver) tzsh_screensaver_service_destroy(tz_scrsaver); + if (tzsh) tzsh_destroy(tzsh); + }; + + protected: + etWin *tw_base = NULL; + + void initTC(); }; -Eina_Bool +void etTestTzsh::initTC() { - Eina_Bool res = EINA_FALSE; - - tw_base = new etWin(); - res = tw_base->init(NULL, - ELM_WIN_BASIC, - EINA_FALSE, - "etWin Tzsh", - 0, 0, 0, 0, EINA_FALSE, - (E_Layer) 0, - E_TC_WIN_COLOR_RED); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - - tw_base->native_win = etRunner::get().getWinId(tw_base->elm_win); - - res = etRunner::get().registerWin(tw_base); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - - return EINA_TRUE; + tw_base = initNormalWin("TCWin_Normal_base", EINA_FALSE, EINA_FALSE); + ASSERT_TRUE(tw_base != NULL) << "failed to initiation window"; } /****************** @@ -197,8 +172,7 @@ TEST_F(etTestTzsh, scrsaver_mng_basic) { Eina_Bool res = EINA_FALSE; - res = initTC(); - ASSERT_TRUE(res); + initTC(); tzsh = tzsh_create(TZSH_TOOLKIT_TYPE_EFL); ASSERT_TRUE(tzsh != NULL); diff --git a/src/testcase/0007_rotation.cpp b/src/testcase/0007_rotation.cpp index 297f760..46a41b0 100644 --- a/src/testcase/0007_rotation.cpp +++ b/src/testcase/0007_rotation.cpp @@ -1,61 +1,30 @@ #include "e_test_event.h" +#include "e_test_base.h" -using ::testing::Test; - -class etTestRotation : public ::testing::Test +class etTestRotation : public ::etTCBase { -public: - etTestRotation() { }; - ~etTestRotation() - { - if (HasFailure()) etRunner::get().waitForDestroy(); - if (tw_register) etRunner::get().deregisterWin(tw_register); - if (tw_base) delete tw_base; - - if (etRunner::get().hasLastWinInfoList()) - etRunner::get().freeLastWinInfoList(); - }; - -protected: - const int rots[4] = {0, 90, 180, 270}; - etWin *tw_base = NULL; - etWin *tw_register = NULL; - - int saved_rot_ = 0; - - Eina_Bool initTC(); - Eina_Bool testWinRotation(etWin *tw, int rot); + public: + etTestRotation() { }; + ~etTestRotation() { }; + + protected: + const int rots[4] = {0, 90, 180, 270}; + int saved_rot_ = 0; + + etWin *tw_base = NULL; + + void initTC(); + Eina_Bool testWinRotation(etWin *tw, int rot); }; -Eina_Bool +void etTestRotation::initTC() { - Eina_Bool res = EINA_FALSE; - - tw_base = new etWin(); - res = tw_base->init(NULL, - ELM_WIN_BASIC, - EINA_FALSE, - "etWin Rotation", - 0, 0, 400, 400, EINA_FALSE, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_BLUE); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - tw_base->native_win = etRunner::get().getWinId(tw_base->elm_win); + tw_base = initNormalWin("TCWin_Normal_Rotation",EINA_TRUE, EINA_TRUE); + ASSERT_TRUE(tw_base != NULL) << "failed to initiation window"; // available rotations elm_win_wm_rotation_available_rotations_set(tw_base->elm_win, rots, 4); - - res = etRunner::get().registerWin(tw_base); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - - tw_register = tw_base; - - tw_base->updateGeometry(); - tw_base->show(); - etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_ON); - - return EINA_TRUE; } Eina_Bool @@ -92,8 +61,7 @@ TEST_F(etTestRotation, available_rotations) Eina_Bool res = EINA_FALSE; int rot = 0; - res = initTC(); - ASSERT_TRUE(res); + initTC(); res = etRunner::get().getWinInfo(tw_base); ASSERT_TRUE(res); diff --git a/src/testcase/0008_focus.cpp b/src/testcase/0008_focus.cpp index 210b13e..c0dee66 100644 --- a/src/testcase/0008_focus.cpp +++ b/src/testcase/0008_focus.cpp @@ -1,165 +1,44 @@ #include "e_test_event.h" +#include "e_test_base.h" -using ::testing::Test; - -class etTestFocus : public ::testing::Test +class etTestFocus : public ::etTCBase { -public: - etTestFocus() { }; - ~etTestFocus() - { - if (HasFailure()) etRunner::get().waitForDestroy(); - if (tw_register) - { - etRunner::get().deregisterWin(tw_register); - tw_register = NULL; - } - if (tw_red) - { - delete tw_red; - tw_red = NULL; - } - if (tw_green) - { - delete tw_green; - tw_green = NULL; - } - if (tw_blue) - { - delete tw_blue; - tw_blue = NULL; - } - if (tw_blocker) - { - delete tw_blocker; - tw_blocker = NULL; - } - if (etRunner::get().hasLastWinInfoList()) - etRunner::get().freeLastWinInfoList(); - }; - -protected: - etWin *tw_red = NULL; - etWin *tw_green = NULL; - etWin *tw_blue = NULL; - etWin *tw_blocker = NULL; - etWin *tw_register = NULL; - - Eina_Bool initTC(Eina_Bool show_win, Eina_Bool use_geom); - Eina_Bool registerTCWin(etWin *tw); - Eina_Bool showTCWin(etWin *tw); -}; + public: + etTestFocus() { }; + ~etTestFocus() { }; -Eina_Bool -etTestFocus::initTC(Eina_Bool show_win, Eina_Bool use_geom) -{ - Eina_Bool res = EINA_FALSE; + protected: + etWin *tw_red = NULL; + etWin *tw_green = NULL; + etWin *tw_blue = NULL; + etWin *tw_blocker = NULL; - tw_red = new etWin(); - res = tw_red->init(NULL, - ELM_WIN_BASIC, - EINA_FALSE, - "etWin Red", - 0, 0, 400, 400, use_geom, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_RED); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - tw_red->native_win = etRunner::get().getWinId(tw_red->elm_win); - - if (show_win) - showTCWin(tw_red); - - tw_green = new etWin(); - res = tw_green->init(NULL, - ELM_WIN_BASIC, - EINA_FALSE, - "etWin Green", - 100, 100, 400, 400, use_geom, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_GREEN); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - tw_green->native_win = etRunner::get().getWinId(tw_green->elm_win); - - if (show_win) - showTCWin(tw_green); - - tw_blue = new etWin(); - res = tw_blue->init(NULL, - ELM_WIN_BASIC, - EINA_FALSE, - "etWin Blue", - 200, 200, 400, 400, use_geom, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_BLUE); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - tw_blue->native_win = etRunner::get().getWinId(tw_blue->elm_win); - - if (show_win) - showTCWin(tw_blue); - - tw_blocker = new etWin(); - res = tw_blocker->init(NULL, - ELM_WIN_NOTIFICATION, - EINA_FALSE, - "etWin Blocker", - 0, 0, 0, 0, EINA_FALSE, - E_LAYER_CLIENT_NORMAL, - E_TC_WIN_COLOR_CYAN); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - tw_blocker->native_win = etRunner::get().getWinId(tw_blocker->elm_win); - - return EINA_TRUE; -} + void initTC(Eina_Bool show_win, Eina_Bool usr_geom); +}; -Eina_Bool -etTestFocus::registerTCWin(etWin *tw) +void +etTestFocus::initTC(Eina_Bool show_win, Eina_Bool usr_geom) { - Eina_Bool res = EINA_FALSE; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); - - if (tw_register) - { - res = etRunner::get().deregisterWin(tw_register); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - - tw_register = NULL; - } + tw_red = initNormalWin("TCWin_Normal_red", show_win, usr_geom); + ASSERT_TRUE(tw_red != NULL) << "failed to initiation window"; - res = etRunner::get().registerWin(tw); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); + tw_green = initNormalWin("TCWin_Normal_green", show_win, usr_geom); + ASSERT_TRUE(tw_green != NULL) << "failed to initiation window"; - tw_register = tw; + tw_blue = initNormalWin("TCWin_Normal_blue", show_win, usr_geom); + ASSERT_TRUE(tw_blue != NULL) << "failed to initiation window"; - return EINA_TRUE; -} - -Eina_Bool -etTestFocus::showTCWin(etWin *tw) -{ - Eina_Bool res = EINA_FALSE; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); - - res = registerTCWin(tw); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - - tw->updateGeometry(); - tw->show(); - - etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_ON); - - return EINA_TRUE; + tw_blocker = initNotiWin("TCWin_Noti_Blocker", EINA_FALSE, EINA_FALSE, EINA_FALSE); + ASSERT_TRUE(tw_blue != NULL) << "failed to initiation window"; } TEST_F(etTestFocus, focus_basic) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // Expected focus res: // [Top] Blue[focused] -> Green -> Red [Bottom] @@ -182,8 +61,8 @@ TEST_F(etTestFocus, focus_lower) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // make tw_blue lower res = etRunner::get().setWinStack(tw_blue, NULL, EINA_FALSE); @@ -211,8 +90,8 @@ TEST_F(etTestFocus, focus_raise) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // make tw_red raise res = registerTCWin(tw_red); @@ -239,17 +118,14 @@ TEST_F(etTestFocus, focus_raise) TEST_F(etTestFocus, focus_destroy) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // delete tw_blue - tw_blue->hide(); - delete tw_blue; + removeTCWin(tw_blue); tw_blue = NULL; - etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_OFF); // Expected focus res: // [Top] Green[focused] -> Red [Bottom] @@ -272,8 +148,8 @@ TEST_F(etTestFocus, focus_activate1) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // Activate tw_red res = registerTCWin(tw_red); @@ -303,8 +179,8 @@ TEST_F(etTestFocus, focus_activate2) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // show Blocker showTCWin(tw_blocker); @@ -337,7 +213,8 @@ TEST_F(etTestFocus, focus_transient_for1) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // set transient_for Blue(parent) & Red(child) res = registerTCWin(tw_red); @@ -367,7 +244,8 @@ TEST_F(etTestFocus, focus_transient_for2) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // set transient_for Blue(parent) & Green(child) res = registerTCWin(tw_green); @@ -397,7 +275,8 @@ TEST_F(etTestFocus, focus_transient_for3) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // set transient_for Green(parent) & Blue(child) res = registerTCWin(tw_green); @@ -427,7 +306,8 @@ TEST_F(etTestFocus, focus_iconify1) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // set iconify Blue res = registerTCWin(tw_blue); @@ -457,7 +337,8 @@ TEST_F(etTestFocus, focus_iconify2) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // set iconify Red res = registerTCWin(tw_red); @@ -487,7 +368,8 @@ TEST_F(etTestFocus, focus_uniconify) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // set iconify Red res = registerTCWin(tw_red); @@ -516,14 +398,88 @@ TEST_F(etTestFocus, focus_uniconify) etRunner::get().freeWinInfoList(list); } -TEST_F(etTestFocus, focus_touch_basic) +// TODO:: Set enable when fix focus policy is done. +TEST_F(etTestFocus, DISABLED_focus_uniconify2) { etWin *tw = NULL; Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); + + // set iconify Blue + res = registerTCWin(tw_blue); + EXPECT_TRUE(res); + res = etRunner::get().setWinIconic(tw_blue, EINA_TRUE); + ASSERT_TRUE(res); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_OFF); + + // set uniconify Blue + res = etRunner::get().setWinIconic(tw_blue, EINA_FALSE); ASSERT_TRUE(res); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_ON); + + // Expected focus res: + // [Top] Blue[focused] -> Green -> Red [Bottom] + list = etRunner::get().getWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, etWin*) + { + if (tw->native_win == tw_blue->native_win) + ASSERT_TRUE(tw->Focus.obj); + else + ASSERT_FALSE(tw->Focus.obj); + } + etRunner::get().freeWinInfoList(list); +} + +// TODO:: Set enable when fix focus policy is done. +TEST_F(etTestFocus, DISABLED_focus_visibility) +{ + etWin *tw = NULL; + Eina_Bool res = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); + + // show blocker + res = etRunner::get().setWinNotiLevel(tw_blocker, + EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); + EXPECT_TRUE(res); + showTCWin(tw_blocker); + + // hide blocker + tw_blocker->hide(); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_OFF); + res = registerTCWin(tw_blue); + EXPECT_TRUE(res); + + // Expected focus res: + // [Top] Blue[focused] -> Green -> Red [Bottom] + list = etRunner::get().getWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, etWin*) + { + if (tw->native_win == tw_blue->native_win) + ASSERT_TRUE(tw->Focus.obj); + else + ASSERT_FALSE(tw->Focus.obj); + } + etRunner::get().freeWinInfoList(list); +} + +TEST_F(etTestFocus, focus_touch_basic) +{ + etWin *tw = NULL; + Eina_Bool res = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // touch red win res = registerTCWin(tw_red); @@ -550,11 +506,10 @@ TEST_F(etTestFocus, focus_touch_basic) TEST_F(etTestFocus, focus_skip_set) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // set focus_skip on tw_blue etRunner::get().setFocusSkip(tw_blue, EINA_TRUE); @@ -580,11 +535,10 @@ TEST_F(etTestFocus, focus_skip_set) TEST_F(etTestFocus, focus_skip_unset) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_TRUE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); // set focus_skip on tw_blue etRunner::get().setFocusSkip(tw_blue, EINA_TRUE); @@ -620,14 +574,49 @@ TEST_F(etTestFocus, focus_skip_unset) } etRunner::get().freeWinInfoList(list); } -TEST_F(etTestFocus, focus_fullsize_basic) + +TEST_F(etTestFocus, focus_touch_with_focus_skip) { etWin *tw = NULL; Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); + + // set focus_skip on tw_red + res = registerTCWin(tw_red); + EXPECT_TRUE(res); + etRunner::get().setFocusSkip(tw_red, EINA_TRUE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + + // touch red win + etRunner::get().generateMouseDown(50, 50); + etRunner::get().generateMouseUp(50, 50); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + + // Expected focus res: + // [Top] Blue[focused] -> Green -> Red [Bottom] + list = etRunner::get().getWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, etWin*) + { + if (tw->native_win == tw_blue->native_win) + ASSERT_TRUE(tw->Focus.obj); + else + ASSERT_FALSE(tw->Focus.obj); + } + etRunner::get().freeWinInfoList(list); +} + +TEST_F(etTestFocus, focus_fullsize_basic) +{ + etWin *tw = NULL; + Eina_List *list = NULL, *l = NULL; + + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // Expected focus res: // [Top] Blue[focused] -> Green -> Red [Bottom] @@ -650,8 +639,8 @@ TEST_F(etTestFocus, focus_fullsize_lower) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // make tw_blue lower res = etRunner::get().setWinStack(tw_blue, NULL, EINA_FALSE); @@ -679,8 +668,8 @@ TEST_F(etTestFocus, focus_fullsize_raise) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // make tw_red raise res = etRunner::get().setWinStack(tw_red, NULL, EINA_TRUE); @@ -705,17 +694,14 @@ TEST_F(etTestFocus, focus_fullsize_raise) TEST_F(etTestFocus, focus_fullsize_destroy) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // delete tw_blue - tw_blue->hide(); - delete tw_blue; + removeTCWin(tw_blue); tw_blue = NULL; - etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_OFF); // Expected focus res: // [Top] Green[focused] -> Red [Bottom] @@ -738,8 +724,8 @@ TEST_F(etTestFocus, focus_fullsize_activate) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // Activate tw_red res = registerTCWin(tw_red); @@ -769,7 +755,8 @@ TEST_F(etTestFocus, focus_fullsize_transient_for) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_FALSE); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // set transient_for Blue(parent) & Red(child) res = registerTCWin(tw_red); @@ -799,7 +786,8 @@ TEST_F(etTestFocus, focus_fullsize_iconify) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_FALSE); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // set iconify Blue res = registerTCWin(tw_blue); @@ -829,7 +817,8 @@ TEST_F(etTestFocus, focus_fullsize_uniconify) Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_FALSE); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // set iconify Red res = registerTCWin(tw_red); @@ -861,11 +850,10 @@ TEST_F(etTestFocus, focus_fullsize_uniconify) TEST_F(etTestFocus, focus_fullsize_skip_set) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // set focus_skip on tw_blue etRunner::get().setFocusSkip(tw_blue, EINA_TRUE); @@ -886,11 +874,10 @@ TEST_F(etTestFocus, focus_fullsize_skip_set) TEST_F(etTestFocus, focus_fullsize_skip_unset) { etWin *tw = NULL; - Eina_Bool res = EINA_FALSE; Eina_List *list = NULL, *l = NULL; - res = initTC(EINA_TRUE, EINA_FALSE); - ASSERT_TRUE(res); + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); // set focus_skip on tw_blue // Expected focus res: -- 2.7.4 From 1fdc6f12770fc42eb8a16fabe88907834b308745 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Thu, 28 Jun 2018 13:02:00 +0900 Subject: [PATCH 06/16] e_test_event: Added timer before calling elm_run in method. Change-Id: Iec265be5bb4b07cb45bcfd4eeec5f926af316e1e --- src/e_test_event.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/e_test_event.cpp b/src/e_test_event.cpp index 4a5c229..19e61fb 100644 --- a/src/e_test_event.cpp +++ b/src/e_test_event.cpp @@ -13,7 +13,7 @@ _cb_resource_id(void *data, { Ecore_Window *res_id = (Ecore_Window *)data; *res_id = id; - elm_exit(); + etRunner::get().finishWork(); } /* callbacks - method */ @@ -132,7 +132,7 @@ etRunner::registerWin(etWin *tw) tw->native_win); EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); - elm_run(); + work(); return accepted; } @@ -152,7 +152,7 @@ etRunner::deregisterWin(etWin *tw) tw->native_win); EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); - elm_run(); + work(); return accepted; } @@ -171,7 +171,7 @@ etRunner::resetRegisterWin() ""); EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); - elm_run(); + work(); return accepted; } @@ -307,7 +307,7 @@ etRunner::setZoneRotation(int angle) angle); EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); - elm_run(); + work(); return allowed; } @@ -374,7 +374,7 @@ etRunner::getWinInfoList() ""); EINA_SAFETY_ON_NULL_RETURN_VAL(p, NULL); - elm_run(); + work(); if (info_list->retry) { @@ -454,7 +454,7 @@ etRunner::getWinId(Evas_Object *elm_win) tizen_resource_add_listener(tzres, &_e_test_tizen_resource_listener, &id); - elm_run(); + work(); if (tzres) tizen_resource_destroy(tzres); @@ -927,7 +927,7 @@ finish: ERR("errname:%s errmsg:%s\n", name, text); } - elm_exit(); + etRunner::get().finishWork(); } static void @@ -1008,7 +1008,7 @@ finish: ERR("errname:%s errmsg:%s\n", name, text); } - elm_exit(); + etRunner::get().finishWork(); } static void @@ -1033,7 +1033,7 @@ finish: ERR("errname: %s errmsg: %s\n", name, text); } - elm_exit(); + etRunner::get().finishWork(); } static void @@ -1060,7 +1060,7 @@ finish: ERR("errname: %s errmsg: %s\n", name, text); } - elm_exit(); + etRunner::get().finishWork(); } static void @@ -1175,8 +1175,7 @@ finish: static Eina_Bool _cb_work_timeout(void *data) { - etRunner *ev_loop = (etRunner *)data; - ev_loop->finishWork(); + etRunner::get().finishWork(); return ECORE_CALLBACK_CANCEL; } -- 2.7.4 From 0c5d33337c95f7acb460762ff940071d15a3cb1d Mon Sep 17 00:00:00 2001 From: Gwanglim Lee Date: Fri, 29 Jun 2018 14:26:53 +0900 Subject: [PATCH 07/16] Packaging: update version to 0.3.0 Change-Id: I48b5c92c92dc6c2f4af433a5604308cbd4743012 --- packaging/e-tizen-testcase.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/e-tizen-testcase.spec b/packaging/e-tizen-testcase.spec index 208556d..1faeea4 100644 --- a/packaging/e-tizen-testcase.spec +++ b/packaging/e-tizen-testcase.spec @@ -1,5 +1,5 @@ Name: e-tizen-testcase -Version: 0.2.0 +Version: 0.3.0 Release: 1 Summary: The test case runner for enlightenment URL: http://www.enlightenment.org -- 2.7.4 From 609365131ce2c9ca1ab3ce62020a132390306afc Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Mon, 2 Jul 2018 14:05:13 +0900 Subject: [PATCH 08/16] e_test_event: add initialize code for dbus members fix coverity Change-Id: I5b8e0eb126c507431d78d8087911fa99a59688cb --- src/e_test_event.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/e_test_event.h b/src/e_test_event.h index 0e8cd33..ae961e9 100644 --- a/src/e_test_event.h +++ b/src/e_test_event.h @@ -20,6 +20,8 @@ private: ev.request = E_TC_EVENT_TYPE_NONE; ev.response = E_TC_EVENT_TYPE_NONE; logDomain = 0; + dbus.conn = NULL; + dbus.proxy = NULL; dbus.obj = NULL; listWinInfo = NULL; }; -- 2.7.4 From 966f761c329fc8ff96d96af7ae3a72fabdb1d71d Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Mon, 2 Jul 2018 16:11:39 +0900 Subject: [PATCH 09/16] e_test_event: free globals iterator when function end fix coverity Change-Id: Ibcba9bc85e38b16b6412a75c96f912fd74c7c98c --- src/e_test_event.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/e_test_event.cpp b/src/e_test_event.cpp index 19e61fb..8e0acc5 100644 --- a/src/e_test_event.cpp +++ b/src/e_test_event.cpp @@ -850,8 +850,8 @@ etRunner::initProtocols() registry = ecore_wl2_display_registry_get(ecore_wl2_connected_display_get(NULL)); globals = ecore_wl2_display_globals_get(ecore_wl2_connected_display_get(NULL)); - EINA_SAFETY_ON_NULL_RETURN_VAL(registry, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(globals, EINA_FALSE); + EINA_SAFETY_ON_NULL_GOTO(registry, err); + EINA_SAFETY_ON_NULL_GOTO(globals, err); EINA_ITERATOR_FOREACH(globals, global) { @@ -873,10 +873,16 @@ etRunner::initProtocols() } } - EINA_SAFETY_ON_NULL_RETURN_VAL(tzPolicy, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(tzSurface, EINA_FALSE); + EINA_SAFETY_ON_NULL_GOTO(tzPolicy, err); + EINA_SAFETY_ON_NULL_GOTO(tzSurface, err); + eina_iterator_free(globals); return EINA_TRUE; + +err: + if (globals) + eina_iterator_free(globals); + return EINA_FALSE; } /* callbacks - method */ -- 2.7.4 From e26c34d3ac7e223dfc7e6c6332db85cc4b61178a Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Mon, 2 Jul 2018 16:36:48 +0900 Subject: [PATCH 10/16] e_test_base: Added method of fake window initiation. Change-Id: I2f8a503863d72f78d557c30d7c755eb20795d8ca --- src/e_test_base.cpp | 13 +++++++++++++ src/e_test_base.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/e_test_base.cpp b/src/e_test_base.cpp index 05d1c53..6e834e5 100644 --- a/src/e_test_base.cpp +++ b/src/e_test_base.cpp @@ -42,6 +42,19 @@ etTCBase::~etTCBase() } etWin * +etTCBase::initFakeWin() +{ + etWin *tw = new etWin(); + + EINA_SAFETY_ON_NULL_RETURN_VAL(tw, NULL); + + tw_list = eina_list_append(tw_list, tw); + + return tw; +} + + +etWin * etTCBase::initNormalWin(const char *name, Eina_Bool show_win, Eina_Bool usr_geom) { Eina_Bool res = EINA_FALSE; diff --git a/src/e_test_base.h b/src/e_test_base.h index 5572f4f..39bc6ab 100644 --- a/src/e_test_base.h +++ b/src/e_test_base.h @@ -12,6 +12,7 @@ class etTCBase : public ::testing::Test ~etTCBase(); public: + etWin *initFakeWin(); etWin *initNormalWin(const char *name, Eina_Bool show_win, Eina_Bool usr_geom); etWin *initNotiWin(const char *name, Eina_Bool show_win, Eina_Bool usr_geom, Eina_Bool set_noti_level_normal); -- 2.7.4 From 472916b1086a8358fd222df12073171f503a3074 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Mon, 2 Jul 2018 16:44:32 +0900 Subject: [PATCH 11/16] 0001_easy: Change method to create fake window. fix coverity Change-Id: Iad05f8cb6e1c681a56bf17c0e7386144b3d92d2f --- src/testcase/0001_easy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testcase/0001_easy.cpp b/src/testcase/0001_easy.cpp index f174a48..f0a2e2a 100644 --- a/src/testcase/0001_easy.cpp +++ b/src/testcase/0001_easy.cpp @@ -137,7 +137,7 @@ TEST_F(etTestEasy, win_register) Eina_Bool res = EINA_FALSE; Eldbus_Pending *p = NULL; - etWin *tw = new etWin(); + etWin *tw = initFakeWin(); ASSERT_TRUE(tw != NULL); tw->native_win = _WIN_ID; -- 2.7.4 From f604d9106937213f1f1e790b28639dd184922e1c Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Mon, 2 Jul 2018 17:59:26 +0900 Subject: [PATCH 12/16] e_test_event: Removed duplicated NULL check in getWinID fix coverity Change-Id: Ia84aa7137f4aa1608ceea231ba5d76c932b84c4b --- src/e_test_event.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/e_test_event.cpp b/src/e_test_event.cpp index 8e0acc5..6323159 100644 --- a/src/e_test_event.cpp +++ b/src/e_test_event.cpp @@ -456,7 +456,7 @@ etRunner::getWinId(Evas_Object *elm_win) work(); - if (tzres) tizen_resource_destroy(tzres); + tizen_resource_destroy(tzres); return id; } -- 2.7.4 From 708608c24f109f172aa392cc8cfe0db45525f2ff Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Mon, 2 Jul 2018 20:26:03 +0900 Subject: [PATCH 13/16] Packaging: update version to 0.3.1 Change-Id: I047a2e5104702f8e196705cc8473e5835774e43a --- packaging/e-tizen-testcase.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/e-tizen-testcase.spec b/packaging/e-tizen-testcase.spec index 1faeea4..9839dfd 100644 --- a/packaging/e-tizen-testcase.spec +++ b/packaging/e-tizen-testcase.spec @@ -1,5 +1,5 @@ Name: e-tizen-testcase -Version: 0.3.0 +Version: 0.3.1 Release: 1 Summary: The test case runner for enlightenment URL: http://www.enlightenment.org -- 2.7.4 From 250a32dcd6a27249faa2a79481451c0996e60ade Mon Sep 17 00:00:00 2001 From: JengHyun Kang Date: Fri, 29 Jun 2018 15:55:28 +0900 Subject: [PATCH 14/16] 0009_input: add initial test case codes for keygrab Change-Id: Ifbdccff69ff08fc941ac800ebd39557f8c9eb2dd --- src/Makefile.am | 6 +- src/e_test_event.cpp | 174 +++++++++++++++++++++++++- src/e_test_event.h | 10 ++ src/e_test_util.h | 2 + src/e_test_win.cpp | 2 +- src/testcase/0009_input.cpp | 292 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 480 insertions(+), 6 deletions(-) create mode 100644 src/testcase/0009_input.cpp diff --git a/src/Makefile.am b/src/Makefile.am index c268992..bbcd04c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,7 +17,8 @@ testcase/0004_transient_for.cpp \ testcase/0005_notification.cpp \ testcase/0006_tzsh.cpp \ testcase/0007_rotation.cpp \ -testcase/0008_focus.cpp +testcase/0008_focus.cpp \ +testcase/0009_input.cpp e_test_runner_SOURCES = \ e_test_main.cpp \ @@ -35,7 +36,8 @@ testcase/0004_transient_for.cpp \ testcase/0005_notification.cpp \ testcase/0006_tzsh.cpp \ testcase/0007_rotation.cpp \ -testcase/0008_focus.cpp +testcase/0008_focus.cpp \ +testcase/0009_input.cpp MAINTAINERCLEANFILES = \ Makefile.in diff --git a/src/e_test_event.cpp b/src/e_test_event.cpp index 6323159..6fe98e3 100644 --- a/src/e_test_event.cpp +++ b/src/e_test_event.cpp @@ -28,6 +28,14 @@ static void _cb_signal_stack_changed(void *data, const Eldbus_Message *msg); static void _cb_signal_win_rot_changed(void *data, const Eldbus_Message *msg); static void _cb_signal_focus_changed(void *data, const Eldbus_Message *msg); +/* callbacks - ecore */ +static Eina_Bool _cb_ecore_key(void *data, int type, void *event); +static Eina_Bool _cb_key_delay_timer(void *data); + +/* callbacks - evas */ +static void _cb_evas_key_down(void * data, Evas * evas, Evas_Object * obj, void * event_info); +static void _cb_evas_key_up(void * data, Evas * evas, Evas_Object * obj, void * event_info); + /* callbacks - timer */ static Eina_Bool _cb_work_timeout(void *data); static Eina_Bool _ev_wait_timeout(void *data); @@ -82,7 +90,7 @@ etRunner::init() EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); // init input generator - inputGenerator = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN); + inputGenerator = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN | EFL_UTIL_INPUT_DEVTYPE_KEYBOARD); return EINA_TRUE; } @@ -652,6 +660,65 @@ etRunner::generateMouseUp(int x, int y) } Eina_Bool +etRunner::generateKeyPress(const char *keyname) +{ + // Using efl_util_input_generate instead of generate event by eldbus + int ret = EFL_UTIL_ERROR_NONE; + + if (inputGenerator == NULL) + { + inputGenerator = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN); + work(); + } + + ret = efl_util_input_generate_key(inputGenerator, + keyname, + 1); + if (ret != EFL_UTIL_ERROR_NONE) + { + efl_util_input_deinitialize_generator(inputGenerator); + inputGenerator = NULL; + return EINA_FALSE; + } + + return EINA_TRUE; +} + +Eina_Bool +etRunner::generateKeyRelease(const char *keyname) +{ + // Using efl_util_input_generate instead of generate event by eldbus + int ret = EFL_UTIL_ERROR_NONE; + + if (inputGenerator == NULL) + { + inputGenerator = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN); + work(); + } + + ret = efl_util_input_generate_key(inputGenerator, + keyname, + 0); + if (ret != EFL_UTIL_ERROR_NONE) + { + efl_util_input_deinitialize_generator(inputGenerator); + inputGenerator = NULL; + return EINA_FALSE; + } + + return EINA_TRUE; +} + +void +etRunner::generateKeyEvent(const char *keyname, double delay) +{ + this->ev.key.timer = ecore_timer_add(delay, + _cb_key_delay_timer, + this); +} + + +Eina_Bool etRunner::freezeEvent() { Eldbus_Pending *p = NULL; @@ -684,7 +751,8 @@ etRunner::thawEvent() Eina_Bool etRunner::waitEvent(E_TC_Event_Type ev_type) { - Eldbus_Signal_Handler *sh; + Eldbus_Signal_Handler *sh = NULL; + Ecore_Event_Handler *eh = NULL, *eh2 = NULL; Eina_Bool res = EINA_FALSE; EINA_SAFETY_ON_FALSE_RETURN_VAL((E_TC_EVENT_TYPE_NONE < ev_type), res); @@ -729,6 +797,24 @@ etRunner::waitEvent(E_TC_Event_Type ev_type) EINA_SAFETY_ON_NULL_GOTO(sh, finish); break; + case E_TC_EVENT_TYPE_INPUT_ECORE_KEY: + eh = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _cb_ecore_key, this); + EINA_SAFETY_ON_NULL_GOTO(eh, finish); + eh2 = ecore_event_handler_add(ECORE_EVENT_KEY_UP, _cb_ecore_key, this); + EINA_SAFETY_ON_NULL_GOTO(eh, finish); + + this->ev.key.state = EINA_FALSE; + this->generateKeyEvent(this->ev.key.name, 1.0); + break; + + case E_TC_EVENT_TYPE_INPUT_EVAS_KEY: + evas_object_event_callback_add(this->ev.key.win, EVAS_CALLBACK_KEY_DOWN, _cb_evas_key_down, this); + evas_object_event_callback_add(this->ev.key.win, EVAS_CALLBACK_KEY_UP, _cb_evas_key_up, this); + + this->ev.key.state = EINA_FALSE; + this->generateKeyEvent(this->ev.key.name, 1.0); + break; + default: goto finish; break; @@ -749,7 +835,11 @@ etRunner::waitEvent(E_TC_Event_Type ev_type) ev.expire_timer = NULL; } - eldbus_signal_handler_del(sh); + if (sh) eldbus_signal_handler_del(sh); + if (eh) ecore_event_handler_del(eh); + if (eh2) ecore_event_handler_del(eh2); + evas_object_event_callback_del(this->ev.key.win, EVAS_CALLBACK_KEY_DOWN, _cb_evas_key_down); + evas_object_event_callback_del(this->ev.key.win, EVAS_CALLBACK_KEY_UP, _cb_evas_key_up); res = (ev.response == ev.request); EINA_SAFETY_ON_FALSE_GOTO(res, finish); @@ -1199,3 +1289,81 @@ _ev_wait_timeout(void *data) return ECORE_CALLBACK_DONE; } + +static Eina_Bool +_cb_ecore_key(void *data, int type, void *event) +{ + Ecore_Event_Key *ev = (Ecore_Event_Key *)event; + etRunner *runner = (etRunner *)data; + + if (!strncmp(runner->ev.key.name, ev->keyname, strlen(ev->keyname))) + { + if (runner->ev.key.state == EINA_FALSE && + type == ECORE_EVENT_KEY_DOWN) + { + runner->ev.key.state = EINA_TRUE; + } + else if (runner->ev.key.state == EINA_TRUE && + type == ECORE_EVENT_KEY_UP) + { + runner->ev.response = runner->ev.request; + runner->ev.key.state = EINA_FALSE; + elm_exit(); + } + } + + return ECORE_CALLBACK_PASS_ON; +} + +static void +_cb_evas_key_down(void *data, Evas * evas, Evas_Object * obj, void * event_info) +{ + Evas_Event_Key_Down *ev; + etRunner *runner = (etRunner *)data; + + ev = (Evas_Event_Key_Down *)event_info; + + if (!strncmp(runner->ev.key.name, ev->keyname, strlen(ev->keyname))) + { + if (runner->ev.key.state == EINA_FALSE && + runner->ev.key.win == obj) + { + runner->ev.key.state = EINA_TRUE; + } + } +} + +static void +_cb_evas_key_up(void * data, Evas * evas, Evas_Object * obj, void * event_info) +{ + Evas_Event_Key_Up *ev; + etRunner *runner = (etRunner *)data; + + ev = (Evas_Event_Key_Up *)event_info; + + if (!strncmp(runner->ev.key.name, ev->keyname, strlen(ev->keyname))) + { + if (runner->ev.key.state == EINA_TRUE && + runner->ev.key.win == obj) + { + runner->ev.response = runner->ev.request; + runner->ev.key.state = EINA_FALSE; + runner->ev.key.win = NULL; + elm_exit(); + } + } +} + +static Eina_Bool +_cb_key_delay_timer(void *data) +{ + etRunner *runner = (etRunner *)data; + + runner->generateKeyPress(runner->ev.key.name); + runner->generateKeyRelease(runner->ev.key.name); + + runner->ev.key.timer = NULL; + + return ECORE_CALLBACK_CANCEL; +} + diff --git a/src/e_test_event.h b/src/e_test_event.h index ae961e9..5672363 100644 --- a/src/e_test_event.h +++ b/src/e_test_event.h @@ -59,6 +59,13 @@ public: /* TODO: make it hidden */ Ecore_Timer *expire_timer; E_TC_Event_Type request; E_TC_Event_Type response; + struct + { + Eina_Stringshare *name; + Eina_Bool state; + Evas_Object *win; + Ecore_Timer *timer; + } key; } ev; public: @@ -100,6 +107,9 @@ public: Eina_Bool generateMouseDown(int x, int y); Eina_Bool generateMouseMove(int x, int y); Eina_Bool generateMouseUp(int x, int y); + Eina_Bool generateKeyPress(const char *key); + Eina_Bool generateKeyRelease(const char *key); + void generateKeyEvent(const char *keyname, double delay); Eina_Bool freezeEvent(); Eina_Bool thawEvent(); Eina_Bool waitEvent(E_TC_Event_Type ev); diff --git a/src/e_test_util.h b/src/e_test_util.h index 5591adb..83e404c 100644 --- a/src/e_test_util.h +++ b/src/e_test_util.h @@ -74,6 +74,8 @@ typedef enum _E_TC_Event_Type E_TC_EVENT_TYPE_STACK_BELOW, E_TC_EVENT_TYPE_WINDOW_ROTATION_CHANGE, E_TC_EVENT_TYPE_FOCUS_CHANGED, + E_TC_EVENT_TYPE_INPUT_ECORE_KEY, + E_TC_EVENT_TYPE_INPUT_EVAS_KEY, E_TC_EVENT_TYPE_MAX } E_TC_Event_Type; diff --git a/src/e_test_win.cpp b/src/e_test_win.cpp index 57810da..f847cac 100644 --- a/src/e_test_win.cpp +++ b/src/e_test_win.cpp @@ -27,8 +27,8 @@ etWin::init(etWin *parent, Eina_Bool usr_geom, E_TC_Win_Color color) { - Evas_Object *bg = NULL; int screen_width = 0, screen_height = 0; + Evas_Object *bg = NULL; parent = parent; diff --git a/src/testcase/0009_input.cpp b/src/testcase/0009_input.cpp new file mode 100644 index 0000000..86029ff --- /dev/null +++ b/src/testcase/0009_input.cpp @@ -0,0 +1,292 @@ +#include "e_test_event.h" +#include "e_test_base.h" +#include + +class etTestInput : public ::etTCBase +{ +public: + etTestInput() { }; + ~etTestInput() { }; + +protected: + etWin *tw_shared = NULL; + etWin *tw_topposition = NULL; + etWin *tw_orexcl = NULL; + etWin *tw_excl = NULL; +}; + +TEST_F(etTestInput, keygrab_nowin_shared) +{ + Eina_Bool ret = EINA_FALSE; + ret = ecore_wl2_window_keygrab_set(NULL, "XF86Menu", 0, 0, 0, ECORE_WL2_WINDOW_KEYGRAB_SHARED); + ASSERT_TRUE(ret); + + etRunner::get().ev.key.name = eina_stringshare_add("XF86Menu"); + ret = etRunner::get().waitEvent(E_TC_EVENT_TYPE_INPUT_ECORE_KEY); + ASSERT_TRUE(ret); + + eina_stringshare_del(etRunner::get().ev.key.name); + etRunner::get().ev.key.name = NULL; + + ret = ecore_wl2_window_keygrab_unset(NULL, "XF86Menu", 0, 0); + ASSERT_TRUE(ret); +} + +TEST_F(etTestInput, keygrab_nowin_orexcl) +{ + Eina_Bool ret = EINA_FALSE; + ret = ecore_wl2_window_keygrab_set(NULL, "XF86Menu", 0, 0, 0, ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE); + ASSERT_TRUE(ret); + + etRunner::get().ev.key.name = eina_stringshare_add("XF86Menu"); + ret = etRunner::get().waitEvent(E_TC_EVENT_TYPE_INPUT_ECORE_KEY); + ASSERT_TRUE(ret); + + eina_stringshare_del(etRunner::get().ev.key.name); + etRunner::get().ev.key.name = NULL; + + ret = ecore_wl2_window_keygrab_unset(NULL, "XF86Menu", 0, 0); + ASSERT_TRUE(ret); +} + +TEST_F(etTestInput, keygrab_nowin_excl) +{ + Eina_Bool ret = EINA_FALSE; + ret = ecore_wl2_window_keygrab_set(NULL, "XF86Menu", 0, 0, 0, ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE); + ASSERT_TRUE(ret); + + etRunner::get().ev.key.name = eina_stringshare_add("XF86Menu"); + ret = etRunner::get().waitEvent(E_TC_EVENT_TYPE_INPUT_ECORE_KEY); + ASSERT_TRUE(ret); + + eina_stringshare_del(etRunner::get().ev.key.name); + etRunner::get().ev.key.name = NULL; + + ret = ecore_wl2_window_keygrab_unset(NULL, "XF86Menu", 0, 0); + ASSERT_TRUE(ret); +} + +TEST_F(etTestInput, keygrab_win_shared) +{ + Eina_Bool ret = EINA_FALSE; + + tw_shared = initNormalWin("TCWin_SharedGrab", EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(tw_shared != NULL) << "failed to initiation window"; + + ret = elm_win_keygrab_set(tw_shared->elm_win, "XF86Menu", 0, 0, 0, ELM_WIN_KEYGRAB_SHARED); + ASSERT_TRUE(ret); + ret = evas_object_key_grab(tw_shared->elm_win, "XF86Menu", 0, 0, EINA_FALSE); + ASSERT_TRUE(ret); + + etRunner::get().ev.key.win = tw_shared->elm_win; + etRunner::get().ev.key.name = eina_stringshare_add("XF86Menu"); + ret = etRunner::get().setWinStack(tw_shared, NULL, EINA_FALSE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + ASSERT_TRUE(ret); + + ret = etRunner::get().waitEvent(E_TC_EVENT_TYPE_INPUT_EVAS_KEY); + ASSERT_TRUE(ret); + + eina_stringshare_del(etRunner::get().ev.key.name); + etRunner::get().ev.key.name = NULL; + etRunner::get().ev.key.win = NULL; + + evas_object_key_ungrab(tw_shared->elm_win, "XF86Menu", 0, 0); + ret = elm_win_keygrab_unset(tw_shared->elm_win, "XF86Menu", 0, 0); + ASSERT_TRUE(ret); +} + +TEST_F(etTestInput, keygrab_win_orexcl) +{ + Eina_Bool ret = EINA_FALSE; + + tw_orexcl = initNormalWin("TCWin_OrexclGrab", EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(tw_orexcl != NULL) << "failed to initiation window"; + + ret = elm_win_keygrab_set(tw_orexcl->elm_win, "XF86Menu", 0, 0, 0, ELM_WIN_KEYGRAB_OVERRIDE_EXCLUSIVE); + ASSERT_TRUE(ret); + ret = evas_object_key_grab(tw_orexcl->elm_win, "XF86Menu", 0, 0, EINA_TRUE); + ASSERT_TRUE(ret); + + etRunner::get().ev.key.win = tw_orexcl->elm_win; + etRunner::get().ev.key.name = eina_stringshare_add("XF86Menu"); + ret = etRunner::get().setWinStack(tw_orexcl, NULL, EINA_FALSE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + ASSERT_TRUE(ret); + + ret = etRunner::get().waitEvent(E_TC_EVENT_TYPE_INPUT_EVAS_KEY); + ASSERT_TRUE(ret); + + eina_stringshare_del(etRunner::get().ev.key.name); + etRunner::get().ev.key.name = NULL; + etRunner::get().ev.key.win = NULL; + + evas_object_key_ungrab(tw_orexcl->elm_win, "XF86Menu", 0, 0); + ret = elm_win_keygrab_unset(tw_orexcl->elm_win, "XF86Menu", 0, 0); + ASSERT_TRUE(ret); +} + +TEST_F(etTestInput, keygrab_win_excl) +{ + Eina_Bool ret = EINA_FALSE; + + tw_excl = initNormalWin("TCWin_ExclGrab", EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(tw_excl != NULL) << "failed to initiation window"; + + ret = elm_win_keygrab_set(tw_excl->elm_win, "XF86Menu", 0, 0, 0, ELM_WIN_KEYGRAB_EXCLUSIVE); + ASSERT_TRUE(ret); + ret = evas_object_key_grab(tw_excl->elm_win, "XF86Menu", 0, 0, EINA_TRUE); + ASSERT_TRUE(ret); + + etRunner::get().ev.key.win = tw_excl->elm_win; + etRunner::get().ev.key.name = eina_stringshare_add("XF86Menu"); + ret = etRunner::get().setWinStack(tw_excl, NULL, EINA_FALSE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + ASSERT_TRUE(ret); + + ret = etRunner::get().waitEvent(E_TC_EVENT_TYPE_INPUT_EVAS_KEY); + ASSERT_TRUE(ret); + + eina_stringshare_del(etRunner::get().ev.key.name); + etRunner::get().ev.key.name = NULL; + etRunner::get().ev.key.win = NULL; + + evas_object_key_ungrab(tw_excl->elm_win, "XF86Menu", 0, 0); + ret = elm_win_keygrab_unset(tw_excl->elm_win, "XF86Menu", 0, 0); + ASSERT_TRUE(ret); +} + +TEST_F(etTestInput, keygrab_win_topposition) +{ + Eina_Bool ret = EINA_FALSE; + + tw_topposition = initNormalWin("TCWin_ToppositionGrab", EINA_TRUE, EINA_TRUE); + ASSERT_TRUE(tw_topposition != NULL) << "failed to initiation window"; + + ecore_evas_focus_skip_set(ecore_evas_ecore_evas_get(evas_object_evas_get(tw_topposition->elm_win)), EINA_TRUE); + + ret = elm_win_keygrab_set(tw_topposition->elm_win, "XF86Menu", 0, 0, 0, ELM_WIN_KEYGRAB_TOPMOST); + ASSERT_TRUE(ret); + ret = evas_object_key_grab(tw_topposition->elm_win, "XF86Menu", 0, 0, EINA_FALSE); + ASSERT_TRUE(ret); + + etRunner::get().ev.key.win = tw_topposition->elm_win; + etRunner::get().ev.key.name = eina_stringshare_add("XF86Menu"); + + ret = etRunner::get().waitEvent(E_TC_EVENT_TYPE_INPUT_EVAS_KEY); + ASSERT_TRUE(ret); + + eina_stringshare_del(etRunner::get().ev.key.name); + etRunner::get().ev.key.name = NULL; + etRunner::get().ev.key.win = NULL; + + evas_object_key_ungrab(tw_topposition->elm_win, "XF86Menu", 0, 0); + ret = elm_win_keygrab_unset(tw_topposition->elm_win, "XF86Menu", 0, 0); + ASSERT_TRUE(ret); +} + +TEST_F(etTestInput, keygrab_win) +{ + Eina_Bool ret = EINA_FALSE; + + tw_shared = initNormalWin("TCWin_SharedGrab", EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(tw_shared != NULL) << "failed to initiation window"; + + tw_orexcl = initNormalWin("TCWin_OrexclGrab", EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(tw_orexcl != NULL) << "failed to initiation window"; + + tw_excl = initNormalWin("TCWin_ExclGrab", EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(tw_excl != NULL) << "failed to initiation window"; + + tw_topposition = initNormalWin("TCWin_ToppositionGrab", EINA_TRUE, EINA_TRUE); + ASSERT_TRUE(tw_topposition != NULL) << "failed to initiation window"; + + ecore_evas_focus_skip_set(ecore_evas_ecore_evas_get(evas_object_evas_get(tw_topposition->elm_win)), EINA_TRUE); + + ret = elm_win_keygrab_set(tw_excl->elm_win, "XF86Menu", 0, 0, 0, ELM_WIN_KEYGRAB_EXCLUSIVE); + ASSERT_TRUE(ret); + ret = evas_object_key_grab(tw_excl->elm_win, "XF86Menu", 0, 0, EINA_TRUE); + ASSERT_TRUE(ret); + + ret = elm_win_keygrab_set(tw_orexcl->elm_win, "XF86Menu", 0, 0, 0, ELM_WIN_KEYGRAB_OVERRIDE_EXCLUSIVE); + ASSERT_TRUE(ret); + ret = evas_object_key_grab(tw_orexcl->elm_win, "XF86Menu", 0, 0, EINA_TRUE); + ASSERT_TRUE(ret); + + ret = elm_win_keygrab_set(tw_topposition->elm_win, "XF86Menu", 0, 0, 0, ELM_WIN_KEYGRAB_TOPMOST); + ASSERT_TRUE(ret); + ret = evas_object_key_grab(tw_topposition->elm_win, "XF86Menu", 0, 0, EINA_FALSE); + ASSERT_TRUE(ret); + + ret = elm_win_keygrab_set(tw_shared->elm_win, "XF86Menu", 0, 0, 0, ELM_WIN_KEYGRAB_SHARED); + ASSERT_TRUE(ret); + ret = evas_object_key_grab(tw_shared->elm_win, "XF86Menu", 0, 0, EINA_FALSE); + ASSERT_TRUE(ret); + + ret = etRunner::get().setWinStack(tw_excl, NULL, EINA_FALSE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + ASSERT_TRUE(ret); + + ret = etRunner::get().setWinStack(tw_orexcl, NULL, EINA_FALSE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + ASSERT_TRUE(ret); + + ret = etRunner::get().setWinStack(tw_shared, NULL, EINA_FALSE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + ASSERT_TRUE(ret); + + // test exclusive grab + etRunner::get().ev.key.win = tw_excl->elm_win; + etRunner::get().ev.key.name = eina_stringshare_add("XF86Menu"); + + ret = etRunner::get().waitEvent(E_TC_EVENT_TYPE_INPUT_EVAS_KEY); + ASSERT_TRUE(ret); + + eina_stringshare_del(etRunner::get().ev.key.name); + + evas_object_key_ungrab(tw_excl->elm_win, "XF86Menu", 0, 0); + ret = elm_win_keygrab_unset(tw_excl->elm_win, "XF86Menu", 0, 0); + ASSERT_TRUE(ret); + + // test override exclusive grab + etRunner::get().ev.key.win = tw_orexcl->elm_win; + etRunner::get().ev.key.name = eina_stringshare_add("XF86Menu"); + + ret = etRunner::get().waitEvent(E_TC_EVENT_TYPE_INPUT_EVAS_KEY); + ASSERT_TRUE(ret); + + eina_stringshare_del(etRunner::get().ev.key.name); + + evas_object_key_ungrab(tw_orexcl->elm_win, "XF86Menu", 0, 0); + ret = elm_win_keygrab_unset(tw_orexcl->elm_win, "XF86Menu", 0, 0); + ASSERT_TRUE(ret); + + // test top position grab + etRunner::get().ev.key.win = tw_topposition->elm_win; + etRunner::get().ev.key.name = eina_stringshare_add("XF86Menu"); + + ret = etRunner::get().waitEvent(E_TC_EVENT_TYPE_INPUT_EVAS_KEY); + ASSERT_TRUE(ret); + + eina_stringshare_del(etRunner::get().ev.key.name); + + evas_object_key_ungrab(tw_topposition->elm_win, "XF86Menu", 0, 0); + ret = elm_win_keygrab_unset(tw_topposition->elm_win, "XF86Menu", 0, 0); + ASSERT_TRUE(ret); + + // test shared grab + etRunner::get().ev.key.win = tw_shared->elm_win; + etRunner::get().ev.key.name = eina_stringshare_add("XF86Menu"); + + ret = etRunner::get().waitEvent(E_TC_EVENT_TYPE_INPUT_EVAS_KEY); + ASSERT_TRUE(ret); + + eina_stringshare_del(etRunner::get().ev.key.name); + + evas_object_key_ungrab(tw_shared->elm_win, "XF86Menu", 0, 0); + ret = elm_win_keygrab_unset(tw_shared->elm_win, "XF86Menu", 0, 0); + ASSERT_TRUE(ret); + + etRunner::get().ev.key.name = NULL; + etRunner::get().ev.key.win = NULL; +} -- 2.7.4 From 3d2efcb33a078d68dca9b6106ba6e1ec5d6771c9 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Fri, 27 Jul 2018 18:37:23 +0900 Subject: [PATCH 15/16] 0008_focus: Add test cases for lower unfocused window. Change-Id: Ia8736dc4f2850ef9997d7bdce32c1af6ce56bf0f --- src/testcase/0008_focus.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/src/testcase/0008_focus.cpp b/src/testcase/0008_focus.cpp index c0dee66..d0af0ec 100644 --- a/src/testcase/0008_focus.cpp +++ b/src/testcase/0008_focus.cpp @@ -84,6 +84,37 @@ TEST_F(etTestFocus, focus_lower) etRunner::get().freeWinInfoList(list); } +TEST_F(etTestFocus, focus_lower2) +{ + etWin *tw = NULL; + Eina_Bool res = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + + // init TC window, show=true, geom=true + initTC(EINA_TRUE, EINA_TRUE); + + // make tw_green lower + res = registerTCWin(tw_green); + EXPECT_TRUE(res); + res = etRunner::get().setWinStack(tw_green, NULL, EINA_FALSE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_STACK_LOWER); + ASSERT_TRUE(res); + + // Expected focus res: + // [Top] Blue[focused] -> Red -> ... -> Green [Bottom] + list = etRunner::get().getWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, etWin*) + { + if (tw->native_win == tw_blue->native_win) + ASSERT_TRUE(tw->Focus.obj); + else + ASSERT_FALSE(tw->Focus.obj); + } + etRunner::get().freeWinInfoList(list); +} + TEST_F(etTestFocus, focus_raise) { etWin *tw = NULL; @@ -662,6 +693,37 @@ TEST_F(etTestFocus, focus_fullsize_lower) etRunner::get().freeWinInfoList(list); } +TEST_F(etTestFocus, focus_fullsize_lower2) +{ + etWin *tw = NULL; + Eina_Bool res = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + + // init TC window, show=true, geom=false + initTC(EINA_TRUE, EINA_FALSE); + + // make tw_green lower + res = registerTCWin(tw_green); + EXPECT_TRUE(res); + res = etRunner::get().setWinStack(tw_green, NULL, EINA_FALSE); + etRunner::get().waitEvent(E_TC_EVENT_TYPE_STACK_LOWER); + ASSERT_TRUE(res); + + // Expected focus res: + // [Top] Blue[focused] -> Red -> ... -> Green [Bottom] + list = etRunner::get().getWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, etWin*) + { + if (tw->native_win == tw_blue->native_win) + ASSERT_TRUE(tw->Focus.obj); + else + ASSERT_FALSE(tw->Focus.obj); + } + etRunner::get().freeWinInfoList(list); +} + TEST_F(etTestFocus, focus_fullsize_raise) { etWin *tw = NULL; -- 2.7.4 From 7920bd81347150bc8a1443c3891e775a6b1a3f14 Mon Sep 17 00:00:00 2001 From: Gwanglim Lee Date: Tue, 31 Jul 2018 12:06:04 +0900 Subject: [PATCH 16/16] Specified e_test_runner file attributes to be packaged with the proper ownership and permissions. Change-Id: I95c0ee12269a3aa67528c992c5bd46e6e49c48a0 --- packaging/e-tizen-testcase.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/e-tizen-testcase.spec b/packaging/e-tizen-testcase.spec index 9839dfd..04230b1 100644 --- a/packaging/e-tizen-testcase.spec +++ b/packaging/e-tizen-testcase.spec @@ -39,5 +39,5 @@ make install DESTDIR=%{buildroot} %files %defattr(-,root,root,-) -%{_bindir}/e_test_runner +%attr(550,root,root) %{_bindir}/e_test_runner %license COPYING -- 2.7.4