From c45b1d4a40c51cff01e5bd2a79600dd690f9b1e2 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Wed, 18 Oct 2017 14:33:11 +0900 Subject: [PATCH 01/16] tc0401_scrsaver_manager: change time of expire_timer Change-Id: I011183f4b443079494f89e24e69c64703f3ab1d8 --- src/0400_tzsh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/0400_tzsh.c b/src/0400_tzsh.c index 5b718ed..96e125b 100644 --- a/src/0400_tzsh.c +++ b/src/0400_tzsh.c @@ -139,7 +139,7 @@ _cb_state_change(void *data, ecore_timer_del(tc_data->expire_timer); tc_data->expire_timer = NULL; } - tc_data->expire_timer = ecore_timer_add(1.0, _cb_timeout, tc_data); + tc_data->expire_timer = ecore_timer_add(1.1, _cb_timeout, tc_data); tc_data->chk_ev_state_idle_timeout = EINA_TRUE; @@ -229,7 +229,7 @@ tc_0401_scrsaver_mng_basic(E_TC *tc) data); EINA_SAFETY_ON_FALSE_GOTO(res == 0, cleanup); - data->expire_timer = ecore_timer_add(1.0, _cb_timeout, data); + data->expire_timer = ecore_timer_add(1.1, _cb_timeout, data); data->runner = tc->runner; e_test_runner_req_ev_freeze(tc->runner); -- 2.7.4 From 35904ce5870fdb272f97fc9c7cf674c0ba76bece Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Wed, 18 Oct 2017 15:43:52 +0900 Subject: [PATCH 02/16] e-tizen-testcase: Add fullsize window testcase corrspending to partial window testcase. Change-Id: Ie07c7b503594ec55aaa1eeaae3660cbd7c369a8f --- src/0150_base_operation_multi_wins.c | 1040 +++++++++++++++++++++++++++++++++- src/0300_notification.c | 134 ++++- src/e_test_runner.c | 21 + src/e_test_runner.h | 20 + 4 files changed, 1188 insertions(+), 27 deletions(-) diff --git a/src/0150_base_operation_multi_wins.c b/src/0150_base_operation_multi_wins.c index 73f5c7d..ee8a3e6 100644 --- a/src/0150_base_operation_multi_wins.c +++ b/src/0150_base_operation_multi_wins.c @@ -10,7 +10,7 @@ struct _E_TC_Data 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_multi_wins_pre_run(E_TC *tc, Eina_Bool alpha); +static Eina_Bool _tc_multi_wins_pre_run(E_TC *tc, Eina_Bool alpha, Eina_Bool use_geom); static void _tc_multi_wins_post_run(E_TC *tc); static void _tc_multi_wins_shutdown(E_TC *tc); @@ -51,14 +51,14 @@ _tc_win_unregister(E_TC *tc) static Eina_Bool -_tc_multi_wins_pre_run(E_TC *tc, Eina_Bool show_win) +_tc_multi_wins_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, 400, 400, EINA_TRUE, + 0, 0, 400, 400, use_geom, 200, E_TC_WIN_COLOR_RED); EINA_SAFETY_ON_NULL_GOTO(tc->data->tw_red, cleanup); @@ -70,7 +70,7 @@ _tc_multi_wins_pre_run(E_TC *tc, Eina_Bool show_win) tc->data->tw_green = e_tc_win_add(NULL, ELM_WIN_BASIC, EINA_FALSE, "green", - 150, 150, 400, 400, EINA_TRUE, + 150, 150, 400, 400, use_geom, 200, E_TC_WIN_COLOR_GREEN); EINA_SAFETY_ON_NULL_GOTO(tc->data->tw_green, cleanup); @@ -82,7 +82,7 @@ _tc_multi_wins_pre_run(E_TC *tc, Eina_Bool show_win) tc->data->tw_blue = e_tc_win_add(NULL, ELM_WIN_BASIC, EINA_FALSE, "blue", - 20, 350, 400, 400, EINA_TRUE, + 20, 350, 400, 400, use_geom, 200, E_TC_WIN_COLOR_BLUE); EINA_SAFETY_ON_NULL_GOTO(tc->data->tw_blue, cleanup); @@ -153,7 +153,7 @@ tc_0150_multi_all_wins_basic(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_TRUE); + res = _tc_multi_wins_pre_run(tc, EINA_TRUE, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); tw_red = tc->data->tw_red; @@ -213,7 +213,7 @@ tc_0151_multi_all_wins_show1(E_TC *tc) int pass_count; EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_FALSE); + res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); tw_red = tc->data->tw_red; @@ -286,7 +286,7 @@ tc_0152_multi_all_wins_show2(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_FALSE); + res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); tw_red = tc->data->tw_red; @@ -360,7 +360,7 @@ tc_0153_multi_all_wins_show3(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_FALSE); + res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); tw_red = tc->data->tw_red; @@ -433,7 +433,7 @@ tc_0154_multi_all_wins_raise1(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_TRUE); + res = _tc_multi_wins_pre_run(tc, EINA_TRUE, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); tw_red = tc->data->tw_red; @@ -501,7 +501,7 @@ tc_0155_multi_all_wins_raise2(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_TRUE); + res = _tc_multi_wins_pre_run(tc, EINA_TRUE, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); tw_red = tc->data->tw_red; @@ -569,7 +569,7 @@ tc_0156_multi_all_wins_stack_above1(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_TRUE); + res = _tc_multi_wins_pre_run(tc, EINA_TRUE, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); tw_red = tc->data->tw_red; @@ -638,7 +638,7 @@ tc_0157_multi_all_wins_stack_above2(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_TRUE); + res = _tc_multi_wins_pre_run(tc, EINA_TRUE, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); tw_red = tc->data->tw_red; @@ -706,7 +706,7 @@ tc_0158_multi_all_wins_stack_above3(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_TRUE); + res = _tc_multi_wins_pre_run(tc, EINA_TRUE, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); tw_red = tc->data->tw_red; @@ -774,7 +774,7 @@ tc_0159_multi_all_wins_lower1(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_TRUE); + res = _tc_multi_wins_pre_run(tc, EINA_TRUE, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); tw_red = tc->data->tw_red; @@ -861,7 +861,800 @@ tc_0160_multi_all_wins_lower2(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_TRUE); + res = _tc_multi_wins_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 stack result: + // [Top] Blue -> Green -> Red [Bottom] + + // Lower Green + e_test_runner_req_win_stack_set(tc->runner, tw_green, NULL, EINA_FALSE); + e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Blue -> Red -> ... -> Green [Bottom] + + list = e_test_runner_req_win_info_list_get(tc->runner); + EINA_SAFETY_ON_NULL_GOTO(list, cleanup); + + pass_count = 0; + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->layer > 200) continue; + if (pass_count == 0) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); + pass_count++; + tw_above = tw; + continue; + } + else if (pass_count == 1) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); + pass_count++; + tw_above = tw; + continue; + } + else + { + if (tw->layer < 200) + { + EINA_SAFETY_ON_FALSE_GOTO((tw_above->native_win == tw_green->native_win), cleanup); + pass_count++; + } + else + { + tw_above = tw; + continue; + } + } + + break; + } + // check the tw_above when there is no window under 200 layer. + if (tw == NULL) + { + EINA_SAFETY_ON_NULL_GOTO(tw_above, cleanup); + EINA_SAFETY_ON_FALSE_GOTO((tw_above->native_win == tw_green->native_win), cleanup); + pass_count++; + } + + EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); + + tc->passed = EINA_TRUE; + +cleanup: + _tc_multi_wins_post_run(tc); + _tc_multi_wins_shutdown(tc); + E_FREE_LIST(list, e_tc_win_del); + + return tc->passed; +} + +Eina_Bool +tc_0161_multi_all_full_wins_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; + int pass_count; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_multi_wins_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 stack result: + // [Top] Blue -> Green -> Red [Bottom] + + list = e_test_runner_req_win_info_list_get(tc->runner); + EINA_SAFETY_ON_NULL_GOTO(list, cleanup); + + pass_count = 0; + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->layer > 200) continue; + if (pass_count == 0) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); + pass_count++; + continue; + } + else if (pass_count == 1) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); + pass_count++; + continue; + } + else + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); + pass_count++; + } + + break; + } + + EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); + + tc->passed = EINA_TRUE; + +cleanup: + _tc_multi_wins_post_run(tc); + _tc_multi_wins_shutdown(tc); + E_FREE_LIST(list, e_tc_win_del); + + return tc->passed; +} + +Eina_Bool +tc_0162_multi_all_full_wins_show1(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; + int pass_count; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + res = _tc_multi_wins_pre_run(tc, EINA_FALSE, 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; + + // show red + res = _tc_win_show(tc, tc->data->tw_red); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + // show green + res = _tc_win_show(tc, tc->data->tw_green); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + // show blue + res = _tc_win_show(tc, tc->data->tw_blue); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + // Expected stack result: + // [Top] Blue -> Green -> Red [Bottom] + + list = e_test_runner_req_win_info_list_get(tc->runner); + EINA_SAFETY_ON_NULL_GOTO(list, cleanup); + + pass_count = 0; + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->layer > 200) continue; + if (pass_count == 0) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); + pass_count++; + continue; + } + else if (pass_count == 1) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); + pass_count++; + continue; + } + else + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); + pass_count++; + } + + break; + } + + EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); + + tc->passed = EINA_TRUE; + +cleanup: + _tc_multi_wins_post_run(tc); + _tc_multi_wins_shutdown(tc); + E_FREE_LIST(list, e_tc_win_del); + + return tc->passed; +} + +Eina_Bool +tc_0163_multi_all_full_wins_show2(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; + int pass_count; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_multi_wins_pre_run(tc, EINA_FALSE, 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; + + // show blue + res = _tc_win_show(tc, tc->data->tw_blue); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + // show red + res = _tc_win_show(tc, tc->data->tw_red); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + // show green + res = _tc_win_show(tc, tc->data->tw_green); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + // Expected stack result: + // [Top] Green -> Red -> Blue [Bottom] + + list = e_test_runner_req_win_info_list_get(tc->runner); + EINA_SAFETY_ON_NULL_GOTO(list, cleanup); + + pass_count = 0; + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->layer > 200) continue; + if (pass_count == 0) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); + pass_count++; + continue; + } + else if (pass_count == 1) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); + pass_count++; + continue; + } + else + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); + pass_count++; + } + + break; + } + + EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); + + tc->passed = EINA_TRUE; + +cleanup: + _tc_multi_wins_post_run(tc); + _tc_multi_wins_shutdown(tc); + E_FREE_LIST(list, e_tc_win_del); + + return tc->passed; +} + + +Eina_Bool +tc_0164_multi_all_full_wins_show3(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; + int pass_count; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_multi_wins_pre_run(tc, EINA_FALSE, 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; + + // show green + res = _tc_win_show(tc, tc->data->tw_green); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + // show blue + res = _tc_win_show(tc, tc->data->tw_blue); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + // show red + res = _tc_win_show(tc, tc->data->tw_red); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + // Expected stack result: + // [Top] Red -> Blue -> Green [Bottom] + + list = e_test_runner_req_win_info_list_get(tc->runner); + EINA_SAFETY_ON_NULL_GOTO(list, cleanup); + + pass_count = 0; + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->layer > 200) continue; + if (pass_count == 0) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); + pass_count++; + continue; + } + else if (pass_count == 1) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); + pass_count++; + continue; + } + else + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); + pass_count++; + } + + break; + } + + EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); + + tc->passed = EINA_TRUE; + +cleanup: + _tc_multi_wins_post_run(tc); + _tc_multi_wins_shutdown(tc); + E_FREE_LIST(list, e_tc_win_del); + + return tc->passed; +} + +Eina_Bool +tc_0165_multi_all_full_wins_raise1(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; + int pass_count; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_multi_wins_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 stack result: + // [Top] Blue -> Green -> Red [Bottom] + + // Raise Red + e_test_runner_req_win_stack_set(tc->runner, tw_red, NULL, EINA_TRUE); + e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Red -> Blue -> Green [Bottom] + + list = e_test_runner_req_win_info_list_get(tc->runner); + EINA_SAFETY_ON_NULL_GOTO(list, cleanup); + + pass_count = 0; + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->layer > 200) continue; + if (pass_count == 0) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); + pass_count++; + continue; + } + else if (pass_count == 1) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); + pass_count++; + continue; + } + else + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); + pass_count++; + } + + break; + } + + EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); + + tc->passed = EINA_TRUE; + +cleanup: + _tc_multi_wins_post_run(tc); + _tc_multi_wins_shutdown(tc); + E_FREE_LIST(list, e_tc_win_del); + + return tc->passed; +} + +Eina_Bool +tc_0166_multi_all_full_wins_raise2(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; + int pass_count; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_multi_wins_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 stack result: + // [Top] Blue -> Green -> Red [Bottom] + + // Raise Green + e_test_runner_req_win_stack_set(tc->runner, tw_green, NULL, EINA_TRUE); + e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Green -> Blue -> Red [Bottom] + + list = e_test_runner_req_win_info_list_get(tc->runner); + EINA_SAFETY_ON_NULL_GOTO(list, cleanup); + + pass_count = 0; + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->layer > 200) continue; + if (pass_count == 0) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); + pass_count++; + continue; + } + else if (pass_count == 1) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); + pass_count++; + continue; + } + else + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); + pass_count++; + } + + break; + } + + EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); + + tc->passed = EINA_TRUE; + +cleanup: + _tc_multi_wins_post_run(tc); + _tc_multi_wins_shutdown(tc); + E_FREE_LIST(list, e_tc_win_del); + + return tc->passed; +} + +Eina_Bool +tc_0167_multi_all_full_wins_stack_above1(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; + int pass_count; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_multi_wins_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 stack result: + // [Top] Blue -> Green -> Red [Bottom] + + // Raise Red on the Green + e_test_runner_req_win_stack_set(tc->runner, tw_red, tw_green, EINA_TRUE); + e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Blue -> Red -> Green [Bottom] + + list = e_test_runner_req_win_info_list_get(tc->runner); + EINA_SAFETY_ON_NULL_GOTO(list, cleanup); + + pass_count = 0; + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->layer > 200) continue; + if (pass_count == 0) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); + pass_count++; + continue; + } + else if (pass_count == 1) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); + pass_count++; + continue; + } + else + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); + pass_count++; + } + + break; + } + + EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); + + tc->passed = EINA_TRUE; + +cleanup: + _tc_multi_wins_post_run(tc); + _tc_multi_wins_shutdown(tc); + E_FREE_LIST(list, e_tc_win_del); + + return tc->passed; +} + + +Eina_Bool +tc_0168_multi_all_full_wins_stack_above2(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; + int pass_count; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_multi_wins_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 stack result: + // [Top] Blue -> Green -> Red [Bottom] + + // Raise Blue on the Red + e_test_runner_req_win_stack_set(tc->runner, tw_blue, tw_red, EINA_TRUE); + e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Green -> Blue -> Red [Bottom] + + list = e_test_runner_req_win_info_list_get(tc->runner); + EINA_SAFETY_ON_NULL_GOTO(list, cleanup); + + pass_count = 0; + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->layer > 200) continue; + if (pass_count == 0) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); + pass_count++; + continue; + } + else if (pass_count == 1) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); + pass_count++; + continue; + } + else + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); + pass_count++; + } + + break; + } + + EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); + + tc->passed = EINA_TRUE; + +cleanup: + _tc_multi_wins_post_run(tc); + _tc_multi_wins_shutdown(tc); + E_FREE_LIST(list, e_tc_win_del); + + return tc->passed; +} + +Eina_Bool +tc_0169_multi_all_full_wins_stack_above3(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; + int pass_count; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_multi_wins_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 stack result: + // [Top] Blue -> Green -> Red [Bottom] + + // Raise Red on the Blue + e_test_runner_req_win_stack_set(tc->runner, tw_red, tw_blue, EINA_TRUE); + e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Red -> Blue -> Green [Bottom] + + list = e_test_runner_req_win_info_list_get(tc->runner); + EINA_SAFETY_ON_NULL_GOTO(list, cleanup); + + pass_count = 0; + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->layer > 200) continue; + if (pass_count == 0) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); + pass_count++; + continue; + } + else if (pass_count == 1) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); + pass_count++; + continue; + } + else + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); + pass_count++; + } + + break; + } + + EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); + + tc->passed = EINA_TRUE; + +cleanup: + _tc_multi_wins_post_run(tc); + _tc_multi_wins_shutdown(tc); + E_FREE_LIST(list, e_tc_win_del); + + return tc->passed; +} + +Eina_Bool +tc_0170_multi_all_full_wins_lower1(E_TC *tc) +{ + E_TC_Win *tw, *tw_above = NULL; + E_TC_Win *tw_red, *tw_green, *tw_blue; + Eina_Bool res = EINA_FALSE; + Eina_List *list = NULL, *l; + int pass_count; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_multi_wins_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 stack result: + // [Top] Blue -> Green -> Red [Bottom] + + // Lower Blue + e_test_runner_req_win_stack_set(tc->runner, tw_blue, NULL, EINA_FALSE); + e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Green -> Red -> ... -> Blue [Bottom] + + list = e_test_runner_req_win_info_list_get(tc->runner); + EINA_SAFETY_ON_NULL_GOTO(list, cleanup); + + pass_count = 0; + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->layer > 200) continue; + if (pass_count == 0) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); + pass_count++; + tw_above = tw; + continue; + + } + else if (pass_count == 1) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); + pass_count++; + tw_above = tw; + continue; + } + else + { + if (tw->layer < 200) + { + EINA_SAFETY_ON_FALSE_GOTO((tw_above->native_win == tw_blue->native_win), cleanup); + pass_count++; + } + else + { + tw_above = tw; + continue; + } + } + + break; + } + // check the tw_above when there is no window under 200 layer. + if (tw == NULL) + { + EINA_SAFETY_ON_NULL_GOTO(tw_above, cleanup); + EINA_SAFETY_ON_FALSE_GOTO((tw_above->native_win == tw_blue->native_win), cleanup); + pass_count++; + } + + EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); + + tc->passed = EINA_TRUE; + +cleanup: + _tc_multi_wins_post_run(tc); + _tc_multi_wins_shutdown(tc); + E_FREE_LIST(list, e_tc_win_del); + + return tc->passed; +} + + +Eina_Bool +tc_0171_multi_all_full_wins_lower2(E_TC *tc) +{ + E_TC_Win *tw, *tw_above = NULL; + E_TC_Win *tw_red, *tw_green, *tw_blue; + Eina_Bool res = EINA_FALSE; + Eina_List *list = NULL, *l; + int pass_count; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_multi_wins_pre_run(tc, EINA_TRUE, EINA_FALSE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); tw_red = tc->data->tw_red; @@ -947,7 +1740,7 @@ tc_0180_multi_2wins_show1(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_FALSE); + res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); tw_red = tc->data->tw_red; @@ -1017,7 +1810,7 @@ tc_0181_multi_2wins_show2(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_FALSE); + res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); tw_green = tc->data->tw_green; @@ -1087,7 +1880,216 @@ tc_0182_multi_2wins_show3(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_FALSE); + res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_TRUE); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + tw_red = tc->data->tw_red; + tw_blue = tc->data->tw_blue; + + // show red + e_tc_win_geom_update(tc->data->tw_red); + e_tc_win_show(tc->data->tw_red); + + // register blue + res = _tc_win_register(tc, tc->data->tw_blue); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + // show blue + e_tc_win_geom_update(tc->data->tw_blue); + e_tc_win_show(tc->data->tw_blue); + + // wait for showing register_win + e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); + + // Expected stack result: + // [Top] Blue -> Red [Bottom] + + list = e_test_runner_req_win_info_list_get(tc->runner); + EINA_SAFETY_ON_NULL_GOTO(list, cleanup); + + pass_count = 0; + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->layer > 200) continue; + if (pass_count == 0) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); + pass_count++; + continue; + } + else + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); + pass_count++; + } + + break; + } + + EINA_SAFETY_ON_FALSE_GOTO((pass_count == 2), cleanup); + + tc->passed = EINA_TRUE; + +cleanup: + _tc_multi_wins_post_run(tc); + _tc_multi_wins_shutdown(tc); + E_FREE_LIST(list, e_tc_win_del); + + return tc->passed; +} + +Eina_Bool +tc_0183_multi_full_2wins_show1(E_TC *tc) +{ + E_TC_Win *tw; + E_TC_Win *tw_red, *tw_green; + Eina_Bool res = EINA_FALSE; + Eina_List *list = NULL, *l; + int pass_count; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_FALSE); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + tw_red = tc->data->tw_red; + tw_green = tc->data->tw_green; + + // show green + e_tc_win_geom_update(tc->data->tw_green); + e_tc_win_show(tc->data->tw_green); + + // register red + res = _tc_win_register(tc, tc->data->tw_red); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + // show red + e_tc_win_geom_update(tc->data->tw_red); + e_tc_win_show(tc->data->tw_red); + + // wait for showing register_win + e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); + + // Expected stack result: + // [Top] Red -> Green [Bottom] + + list = e_test_runner_req_win_info_list_get(tc->runner); + EINA_SAFETY_ON_NULL_GOTO(list, cleanup); + + pass_count = 0; + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->layer > 200) continue; + if (pass_count == 0) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); + pass_count++; + continue; + } + else + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); + pass_count++; + } + + break; + } + + EINA_SAFETY_ON_FALSE_GOTO((pass_count == 2), cleanup); + + tc->passed = EINA_TRUE; + +cleanup: + _tc_multi_wins_post_run(tc); + _tc_multi_wins_shutdown(tc); + E_FREE_LIST(list, e_tc_win_del); + + return tc->passed; +} + + +Eina_Bool +tc_0184_multi_full_2wins_show2(E_TC *tc) +{ + E_TC_Win *tw; + E_TC_Win *tw_green, *tw_blue; + Eina_Bool res = EINA_FALSE; + Eina_List *list = NULL, *l; + int pass_count; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_FALSE); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + tw_green = tc->data->tw_green; + tw_blue = tc->data->tw_blue; + + // show blue + e_tc_win_geom_update(tc->data->tw_blue); + e_tc_win_show(tc->data->tw_blue); + + // register green + res = _tc_win_register(tc, tc->data->tw_green); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + // show green + e_tc_win_geom_update(tc->data->tw_green); + e_tc_win_show(tc->data->tw_green); + + // wait for showing register_win + e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); + + // Expected stack result: + // [Top] Green -> Blue [Bottom] + + list = e_test_runner_req_win_info_list_get(tc->runner); + EINA_SAFETY_ON_NULL_GOTO(list, cleanup); + + pass_count = 0; + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->layer > 200) continue; + if (pass_count == 0) + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); + pass_count++; + continue; + } + else + { + EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); + pass_count++; + } + + break; + } + + EINA_SAFETY_ON_FALSE_GOTO((pass_count == 2), cleanup); + + tc->passed = EINA_TRUE; + +cleanup: + _tc_multi_wins_post_run(tc); + _tc_multi_wins_shutdown(tc); + E_FREE_LIST(list, e_tc_win_del); + + return tc->passed; +} + + +Eina_Bool +tc_0185_multi_full_2wins_show3(E_TC *tc) +{ + E_TC_Win *tw; + E_TC_Win *tw_red, *tw_blue; + Eina_Bool res = EINA_FALSE; + Eina_List *list = NULL, *l; + int pass_count; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_FALSE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); tw_red = tc->data->tw_red; diff --git a/src/0300_notification.c b/src/0300_notification.c index a201d27..64bda5f 100644 --- a/src/0300_notification.c +++ b/src/0300_notification.c @@ -38,7 +38,7 @@ _tc_post_run(E_TC *tc) } static Eina_Bool -_tc_pre_run(E_TC *tc) +_tc_pre_run(E_TC *tc, Eina_Bool usegeom) { Eina_Bool res; E_TC_Data *data = NULL; @@ -49,19 +49,19 @@ _tc_pre_run(E_TC *tc) data->tw_normal = e_tc_win_add(NULL, ELM_WIN_BASIC, EINA_FALSE, "tw_normal", - 0, 0, TW_W, TW_H, EINA_TRUE, + 0, 0, TW_W, TW_H, usegeom, 200, E_TC_WIN_COLOR_RED); EINA_SAFETY_ON_NULL_GOTO(data->tw_normal, cleanup); data->tw_noti1 = e_tc_win_add(NULL, ELM_WIN_NOTIFICATION, EINA_FALSE, "tw_noti1", - 0, 0, TW_W, TW_H, EINA_TRUE, + 0, 0, TW_W, TW_H, usegeom, 200, E_TC_WIN_COLOR_GREEN); EINA_SAFETY_ON_NULL_GOTO(data->tw_noti1, cleanup); data->tw_noti2 = e_tc_win_add(NULL, ELM_WIN_NOTIFICATION, EINA_FALSE, "tw_noti2", - 0, 0, TW_W, TW_H, EINA_TRUE, + 0, 0, TW_W, TW_H, usegeom, 200, E_TC_WIN_COLOR_BLUE); EINA_SAFETY_ON_NULL_GOTO(data->tw_noti2, cleanup); @@ -161,7 +161,7 @@ tc_0300_notification_level_default(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_pre_run(tc); + res = _tc_pre_run(tc, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); data = tc->data; @@ -189,7 +189,7 @@ tc_0301_notification_level_medium(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_pre_run(tc); + res = _tc_pre_run(tc, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); data = tc->data; @@ -217,7 +217,7 @@ tc_0302_notification_level_top(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_pre_run(tc); + res = _tc_pre_run(tc, EINA_TRUE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); data = tc->data; @@ -245,7 +245,125 @@ tc_0303_notification_level_change(E_TC *tc) EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_pre_run(tc); + res = _tc_pre_run(tc, EINA_TRUE); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + data = tc->data; + + res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_TOP); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti1, data->tw_noti2); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + +cleanup: + _tc_post_run(tc); + _tc_shutdown(tc); + + return res; +} + +Eina_Bool +tc_0304_notification_fullsize_level_default(E_TC *tc) +{ + Eina_Bool res = EINA_FALSE; + E_TC_Data *data; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_pre_run(tc, EINA_FALSE); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + data = tc->data; + + res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_noti_level_check(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + +cleanup: + _tc_post_run(tc); + _tc_shutdown(tc); + + return res; +} + +Eina_Bool +tc_0305_notification_fullsize_level_medium(E_TC *tc) +{ + Eina_Bool res = EINA_FALSE; + E_TC_Data *data; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_pre_run(tc, EINA_FALSE); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + data = tc->data; + + res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_noti_level_check(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + +cleanup: + _tc_post_run(tc); + _tc_shutdown(tc); + + return res; +} + +Eina_Bool +tc_0306_notification_fullsize_level_top(E_TC *tc) +{ + Eina_Bool res = EINA_FALSE; + E_TC_Data *data; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_pre_run(tc, EINA_FALSE); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + data = tc->data; + + res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_TOP); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_noti_level_check(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_TOP); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + +cleanup: + _tc_post_run(tc); + _tc_shutdown(tc); + + return res; +} + +Eina_Bool +tc_0307_notification_fullsize_level_change(E_TC *tc) +{ + Eina_Bool res = EINA_FALSE; + E_TC_Data *data; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_pre_run(tc, EINA_FALSE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); data = tc->data; diff --git a/src/e_test_runner.c b/src/e_test_runner.c index 2b57478..899ea50 100644 --- a/src/e_test_runner.c +++ b/src/e_test_runner.c @@ -1009,10 +1009,26 @@ _e_test_runner_init(E_Test_Runner *runner, TC_ADD( 159, "Multi window: 3 Lower1", T_FUNC( 159, multi_all_wins_lower1 ), 1); TC_ADD( 160, "Multi window: 3 Lower2", T_FUNC( 160, multi_all_wins_lower2 ), 1); + TC_ADD( 161, "Multi full window: Basic", T_FUNC( 161, multi_all_full_wins_basic ), 1); + TC_ADD( 162, "Multi full window: 3 Show1", T_FUNC( 162, multi_all_full_wins_show1 ), 1); + TC_ADD( 163, "Multi full window: 3 Show2", T_FUNC( 163, multi_all_full_wins_show2 ), 1); + TC_ADD( 164, "Multi full window: 3 Show3", T_FUNC( 164, multi_all_full_wins_show3 ), 1); + TC_ADD( 165, "Multi full window: 3 Raise1", T_FUNC( 165, multi_all_full_wins_raise1 ), 1); + TC_ADD( 166, "Multi full window: 3 Raise2", T_FUNC( 166, multi_all_full_wins_raise2 ), 1); + TC_ADD( 167, "Multi full window: 3 Stack Above1", T_FUNC( 167, multi_all_full_wins_stack_above1 ), 1); + TC_ADD( 168, "Multi full window: 3 Stack Above2", T_FUNC( 168, multi_all_full_wins_stack_above2 ), 1); + TC_ADD( 169, "Multi full window: 3 Stack Above3", T_FUNC( 169, multi_all_full_wins_stack_above3 ), 1); + TC_ADD( 170, "Multi full window: 3 Lower1", T_FUNC( 170, multi_all_full_wins_lower1 ), 1); + TC_ADD( 171, "Multi full window: 3 Lower2", T_FUNC( 171, multi_all_full_wins_lower2 ), 1); + TC_ADD( 180, "Multi window: 2 Show1", T_FUNC( 180, multi_2wins_show1 ), 1); TC_ADD( 181, "Multi window: 2 Show2", T_FUNC( 181, multi_2wins_show2 ), 1); TC_ADD( 182, "Multi window: 2 Show3", T_FUNC( 182, multi_2wins_show3 ), 1); + TC_ADD( 183, "Multi full window: 2 Show1", T_FUNC( 183, multi_full_2wins_show1 ), 1); + TC_ADD( 184, "Multi full window: 2 Show2", T_FUNC( 184, multi_full_2wins_show2 ), 1); + TC_ADD( 185, "Multi full window: 2 Show3", T_FUNC( 185, multi_full_2wins_show3 ), 1); + /* [0200 - 0299] transient for */ TC_ADD( 200, "Transient for: Basic", T_FUNC( 200, transient_for_basic ), 1); TC_ADD( 201, "Transient for: Raise", T_FUNC( 201, transient_for_raise ), 1); @@ -1026,6 +1042,11 @@ _e_test_runner_init(E_Test_Runner *runner, TC_ADD( 302, "Noti Level top", T_FUNC( 302, notification_level_top ), 1); TC_ADD( 303, "Noti Level Change", T_FUNC( 303, notification_level_change ), 1); + TC_ADD( 304, "Fullsize Noti Level default", T_FUNC( 304, notification_fullsize_level_default), 1); + TC_ADD( 305, "Fullsize Noti Level medium", T_FUNC( 305, notification_fullsize_level_medium ), 1); + TC_ADD( 306, "Fullsize Noti Level top", T_FUNC( 306, notification_fullsize_level_top ), 1); + TC_ADD( 307, "Fullsize Noti Level Change", T_FUNC( 307, notification_fullsize_level_change ), 1); + /* [0400 - 0499] tizen-ws-shell */ TC_ADD( 400, "Screensaver: Basic", T_FUNC( 400, scrsaver_basic ), 1); TC_ADD( 401, "Screensaver Manager: Basic", T_FUNC( 401, scrsaver_mng_basic ), 1); diff --git a/src/e_test_runner.h b/src/e_test_runner.h index 796b79d..f021071 100644 --- a/src/e_test_runner.h +++ b/src/e_test_runner.h @@ -251,10 +251,26 @@ Eina_Bool tc_0157_multi_all_wins_stack_above2(E_TC *tc); Eina_Bool tc_0158_multi_all_wins_stack_above3(E_TC *tc); Eina_Bool tc_0159_multi_all_wins_lower1(E_TC *tc); Eina_Bool tc_0160_multi_all_wins_lower2(E_TC *tc); +Eina_Bool tc_0161_multi_all_full_wins_basic(E_TC *tc); +Eina_Bool tc_0162_multi_all_full_wins_show1(E_TC *tc); +Eina_Bool tc_0163_multi_all_full_wins_show2(E_TC *tc); +Eina_Bool tc_0164_multi_all_full_wins_show3(E_TC *tc); +Eina_Bool tc_0165_multi_all_full_wins_raise1(E_TC *tc); +Eina_Bool tc_0166_multi_all_full_wins_raise2(E_TC *tc); +Eina_Bool tc_0167_multi_all_full_wins_stack_above1(E_TC *tc); +Eina_Bool tc_0168_multi_all_full_wins_stack_above2(E_TC *tc); +Eina_Bool tc_0169_multi_all_full_wins_stack_above3(E_TC *tc); +Eina_Bool tc_0170_multi_all_full_wins_lower1(E_TC *tc); +Eina_Bool tc_0171_multi_all_full_wins_lower2(E_TC *tc); + Eina_Bool tc_0180_multi_2wins_show1(E_TC *tc); Eina_Bool tc_0181_multi_2wins_show2(E_TC *tc); Eina_Bool tc_0182_multi_2wins_show3(E_TC *tc); +Eina_Bool tc_0183_multi_full_2wins_show1(E_TC *tc); +Eina_Bool tc_0184_multi_full_2wins_show2(E_TC *tc); +Eina_Bool tc_0185_multi_full_2wins_show3(E_TC *tc); + Eina_Bool tc_0200_transient_for_basic(E_TC *tc); Eina_Bool tc_0201_transient_for_raise(E_TC *tc); @@ -266,6 +282,10 @@ Eina_Bool tc_0300_notification_level_default(E_TC *tc); Eina_Bool tc_0301_notification_level_medium(E_TC *tc); Eina_Bool tc_0302_notification_level_top(E_TC *tc); Eina_Bool tc_0303_notification_level_change(E_TC *tc); +Eina_Bool tc_0304_notification_fullsize_level_default(E_TC *tc); +Eina_Bool tc_0305_notification_fullsize_level_medium(E_TC *tc); +Eina_Bool tc_0306_notification_fullsize_level_top(E_TC *tc); +Eina_Bool tc_0307_notification_fullsize_level_change(E_TC *tc); Eina_Bool tc_0400_scrsaver_basic(E_TC *tc); Eina_Bool tc_0401_scrsaver_mng_basic(E_TC *tc); -- 2.7.4 From 89bee93c5659e800ea4c054c81139f53a68bdd95 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Thu, 19 Oct 2017 15:18:15 +0900 Subject: [PATCH 03/16] tc0300_notification: fix comparing null values change elm_win to native_win elm_win to native_win because tw->elm_win has null value. Change-Id: I0a31c3aeb204557e32005a2a60b7ae1f411dd194 --- src/0300_notification.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/0300_notification.c b/src/0300_notification.c index 64bda5f..aefa7f8 100644 --- a/src/0300_notification.c +++ b/src/0300_notification.c @@ -125,21 +125,21 @@ _tc_check_stack(E_TC *tc, E_TC_Win *bottom, E_TC_Win *middle, E_TC_Win *top) EINA_LIST_FOREACH(list, l, tw) { - if (top->elm_win == tw->elm_win) - { - t_layer = tw->layer; - continue; - } - else if (middle->elm_win == tw->elm_win) - { - m_layer = tw->layer; - continue; - } - else if (bottom->elm_win == tw->elm_win) - { - b_layer = tw->layer; - continue; - } + if (top->native_win == tw->native_win) + { + t_layer = tw->layer; + continue; + } + else if (middle->native_win == tw->native_win) + { + m_layer = tw->layer; + continue; + } + else if (bottom->native_win == tw->native_win) + { + b_layer = tw->layer; + continue; + } } EINA_SAFETY_ON_FALSE_GOTO(b_layer <= m_layer, failed); -- 2.7.4 From 3491eaf2dec61199d6cbe00a7c26ffe1184a5bbf Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Thu, 19 Oct 2017 15:20:37 +0900 Subject: [PATCH 04/16] tc0300_notification : add testcase for none, high notification level Change-Id: I847a0297dda21e06a16b9e9e03cc38d7d4a73c29 --- src/.e_test_runner.h.swp | Bin 0 -> 16384 bytes src/0300_notification.c | 191 ++++++++++++++++++++++++++++++++++++++++++++--- src/e_test_runner.c | 18 +++-- src/e_test_runner.h | 16 ++-- 4 files changed, 202 insertions(+), 23 deletions(-) create mode 100644 src/.e_test_runner.h.swp diff --git a/src/.e_test_runner.h.swp b/src/.e_test_runner.h.swp new file mode 100644 index 0000000000000000000000000000000000000000..5bdd7135c9071b2b6984496bcd44ebc0a32f20fb GIT binary patch literal 16384 zcmeI2U2G#)702(k-LkaZ?k01jk82ZZ7|6>+uuwFA|BTqYqvwC-jnaUMeo3;PS)7I;>DH~>8GUQpKTc4E~|Ce=pnkIK=TH&Fi z-bjH+fw2l4C+So&!ObSle4L*CKy9o?WDqG3DG(_TDG(_TDG(_TDG(_TDe(WJfZ4g5 zJcH@nc8XkFFEaR5A{3$MlX>9kphtdkphtdkphtdkphtd zkphtdkphtdkplk%1*8Tcr!cO-KLEh@|L*?(uO|rkBlrXO1$YU34SXIv0n#7^J_;TN zr@&Eg=Rrb#1%3%$0Y3mYK^v$*0yR(q9|WhtG4SqjLf!#C0k49Wz;oamU>iuF3Rb{* za1xvVN5DTGAmlILN8pFxTi{FJ3*ZT`1U>}bzMqiSzzg6ScpNN(Dex(99NZ6X-$%$B z;AQZ2a1}fXmcT>c-|r{nx8N0U6Fd*T2(AMKl)+g*!7*_A7$Lt0KLy_h-vbJG2)y<_ zXbSd00SI6gOoP+l_PvC>2wLDA_!zizl#sW;&%v|61U0Y-J_6po2l<2N!4*&j)8Iky z=er5{HFyzx1+;+x9tNktN$?J8;h*45@MG|0pa5PY%V6Z7lnQL4uwKX&iiPSHD^~@FtsRo-&B9X9c+Q`N58VD;ZLcR)w z5JhnlCX2xlN@BIJQpjhk1+m1cBF}s=IGE4UNo(N{K}%v~En7s~g+s)(bDa+kTdovD z#F-C{vs}rpqBj%lYflX)G)O1+oXrLM3d^ek<5$Fbz9I;`Q0Ic<_-xV#2SbE(aD;45 z+z`;63U=;mnF@B#3ATXAV0T{rwh&49qxg-MtnSLb>U3NyYkD+=hIYFxh-i^uJaTP$Rfv2C6)tzfnL!ynQre;!|XMi z-YU|p_AN&A9Y=8 z!p}75o?^DB{ZlykNmJGgMc1Ycxw|WOr#oHU)a$y6(5kZ2LNAsKleT23A$Ms@YRtIt zw&l9iGi2)f0Ugz3xnWRKr@U);jJm2I*kBB^C7EuxT+f`Mdory{+9yrRTkk46iYBSl znjlp)YPMuI6E40%b-uWI@|+^GleCn3gjQQJAD=5jrLIifSn58`eN)k(ofFUJKVvV< z)jZo&G?v#@-Cdt~Q=!E2Vo|KHa;;J>3eE-S>&b6rOF`{hLJTRf zx4NL_%?pKUV4z$vYuzUT3(Gsx{@jIKoF!I;c+SlUR>B5f>Z@C2f#0O;;`KK}o@H^9 zRm7^j2IntiORJuYJQ3EbNQqh3_+Tm{{nio^(hos}N=SbtTUZYsAI}iXPR}EyXMEl- zuB-&cw)#9L#^Y8ktO;VR8t7IMOME#z=p+mz$MYQBYoWSnED`5A)2H~KgOA5Zzwcm6 zj}fe!U0IGXv)y6wrM@$z9;2(CX8+s1kx(dQS+THQWh*Gvn5r1KfbF1zNV~eypp#as zcO)yM9qHha`bG`ipTfw0kC6%Ivc}@av$67WQsR@1!v#jN)=-+T?P>h6%wtL>l;&{L zaLiaIPLat~TfGjH>)?cza5r7TDH@!zz)}1I;CGROd`rS+%$TBDoW=|~8Lvw!9^zuS ztr+;}vfhjt@%U)wa2kZ<|BwlLU8DI*AvQBJ6Q}n15m(u=xW>?0jWJcxVW%%cX=OR(+|vKiuBf?is$eGyF+H*_mmb@kqjO zGg!;w4tar3&AGk?ZG8W~hkfBQ*f;Y1zx)0D8`#Ug4!#L4gGIpi_pf8G{w%12IQSd( z-+a%01Bl?m;4SR6UjQ1&fPZ06{W5qGoCo)Uqu?HJ3;XHs0u!7E_klODXTAk~2fht- za1I;=zu|jk@Kx|A_yqVn_Q|h;Yv8lsJ?xQx2CjiTxCvdZc$N!yV_ zhD#?Cp#d~(w!_>LXG7hw(+~At4E1hd>m2I75bEBR8%nPo8el#&0GQbT?iNA8A>lpOM~J_if+NDO(5UeUukBo{NRjjB_u zYni3?6wP2pOW#X}43u1)3wBC{I;Df1lA%s1$LX+{B}eSTlS+)(`|`mz8~!CWx!{g~ zJ)bR_rI~d)Lx);$hYE1?jX6Bx{8=YQzoT8SR^f%7tog-p?xAVVFN|{!Pkuho-KypA zaoxi7&)RYfAJHvNzvI}Vo_FhW)Gs_yw?s$%!t)F+q>*cOq#V3;bjaGvcuQ#D6PjPf zTQ~N)U@ej3D=yL~8TJg%)>|%?=lBxKcq?V#6F!c&O6&~Bt(F;Yf%IL% ib@0|k-z7Y;k+K-6q>;4@&vTO6X-N!2*f&7$TKpfrunner); + EINA_SAFETY_ON_NULL_GOTO(list, failed); + + EINA_LIST_FOREACH(list, l, tw) + { + if (tw->native_win == win->native_win) + { + layer = tw->layer; + break; + } + } + + EINA_SAFETY_ON_FALSE_GOTO(layer == expected, failed); + + result = EINA_TRUE; + +failed: + E_FREE_LIST(list, e_tc_win_del); + return result; +} + Eina_Bool tc_0300_notification_level_default(E_TC *tc) { @@ -210,7 +239,35 @@ cleanup: } Eina_Bool -tc_0302_notification_level_top(E_TC *tc) +tc_0302_notification_level_high(E_TC *tc) +{ + Eina_Bool res = EINA_FALSE; + E_TC_Data *data; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_pre_run(tc, EINA_TRUE); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + data = tc->data; + + res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_noti_level_check(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + +cleanup: + _tc_post_run(tc); + _tc_shutdown(tc); + + return res; +} + +Eina_Bool +tc_0303_notification_level_top(E_TC *tc) { Eina_Bool res = EINA_FALSE; E_TC_Data *data; @@ -238,7 +295,7 @@ cleanup: } Eina_Bool -tc_0303_notification_level_change(E_TC *tc) +tc_0304_notification_level_none(E_TC *tc) { Eina_Bool res = EINA_FALSE; E_TC_Data *data; @@ -249,18 +306,61 @@ tc_0303_notification_level_change(E_TC *tc) EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); data = tc->data; - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_TOP); + res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); + res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_TOP); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti1, data->tw_noti2); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_NONE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + res = _tc_check_layer(tc, data->tw_noti2, E_LAYER_CLIENT_NORMAL); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + +cleanup: + _tc_post_run(tc); + _tc_shutdown(tc); + + return res; +} + +Eina_Bool +tc_0305_notification_level_change(E_TC *tc) +{ + Eina_Bool res = EINA_FALSE; + E_TC_Data *data; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_pre_run(tc, EINA_TRUE); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + data = tc->data; + res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti1, data->tw_noti2); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_TOP); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti1, data->tw_noti2); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); @@ -272,7 +372,7 @@ cleanup: } Eina_Bool -tc_0304_notification_fullsize_level_default(E_TC *tc) +tc_0306_notification_fullsize_level_default(E_TC *tc) { Eina_Bool res = EINA_FALSE; E_TC_Data *data; @@ -300,7 +400,7 @@ cleanup: } Eina_Bool -tc_0305_notification_fullsize_level_medium(E_TC *tc) +tc_0307_notification_fullsize_level_medium(E_TC *tc) { Eina_Bool res = EINA_FALSE; E_TC_Data *data; @@ -328,7 +428,35 @@ cleanup: } Eina_Bool -tc_0306_notification_fullsize_level_top(E_TC *tc) +tc_0308_notification_fullsize_level_high(E_TC *tc) +{ + Eina_Bool res = EINA_FALSE; + E_TC_Data *data; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_pre_run(tc, EINA_FALSE); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + data = tc->data; + + res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_noti_level_check(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + +cleanup: + _tc_post_run(tc); + _tc_shutdown(tc); + + return res; +} + +Eina_Bool +tc_0309_notification_fullsize_level_top(E_TC *tc) { Eina_Bool res = EINA_FALSE; E_TC_Data *data; @@ -356,7 +484,7 @@ cleanup: } Eina_Bool -tc_0307_notification_fullsize_level_change(E_TC *tc) +tc_0310_notification_fullsize_level_none(E_TC *tc) { Eina_Bool res = EINA_FALSE; E_TC_Data *data; @@ -367,18 +495,61 @@ tc_0307_notification_fullsize_level_change(E_TC *tc) EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); data = tc->data; - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_TOP); + res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); + res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_TOP); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti1, data->tw_noti2); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_NONE); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + res = _tc_check_layer(tc, data->tw_noti2, E_LAYER_CLIENT_NORMAL); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + +cleanup: + _tc_post_run(tc); + _tc_shutdown(tc); + + return res; +} + +Eina_Bool +tc_0311_notification_fullsize_level_change(E_TC *tc) +{ + Eina_Bool res = EINA_FALSE; + E_TC_Data *data; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + + res = _tc_pre_run(tc, EINA_FALSE); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + data = tc->data; + res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti1, data->tw_noti2); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + + res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_TOP); + EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); + res = _tc_check_stack(tc, data->tw_normal, data->tw_noti1, data->tw_noti2); EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); diff --git a/src/e_test_runner.c b/src/e_test_runner.c index 899ea50..2b34025 100644 --- a/src/e_test_runner.c +++ b/src/e_test_runner.c @@ -1039,13 +1039,17 @@ _e_test_runner_init(E_Test_Runner *runner, /* [0300 - 0399] notification */ TC_ADD( 300, "Noti Level default", T_FUNC( 300, notification_level_default), 1); TC_ADD( 301, "Noti Level medium", T_FUNC( 301, notification_level_medium ), 1); - TC_ADD( 302, "Noti Level top", T_FUNC( 302, notification_level_top ), 1); - TC_ADD( 303, "Noti Level Change", T_FUNC( 303, notification_level_change ), 1); - - TC_ADD( 304, "Fullsize Noti Level default", T_FUNC( 304, notification_fullsize_level_default), 1); - TC_ADD( 305, "Fullsize Noti Level medium", T_FUNC( 305, notification_fullsize_level_medium ), 1); - TC_ADD( 306, "Fullsize Noti Level top", T_FUNC( 306, notification_fullsize_level_top ), 1); - TC_ADD( 307, "Fullsize Noti Level Change", T_FUNC( 307, notification_fullsize_level_change ), 1); + TC_ADD( 302, "Noti Level high", T_FUNC( 302, notification_level_high ), 1); + TC_ADD( 303, "Noti Level top", T_FUNC( 303, notification_level_top ), 1); + TC_ADD( 304, "Noti Level none", T_FUNC( 304, notification_level_none ), 1); + TC_ADD( 305, "Noti Level Change", T_FUNC( 305, notification_level_change ), 1); + + TC_ADD( 306, "Fullsize Noti Level default", T_FUNC( 306, notification_fullsize_level_default), 1); + TC_ADD( 307, "Fullsize Noti Level medium", T_FUNC( 307, notification_fullsize_level_medium ), 1); + TC_ADD( 308, "Fullsize Noti Level high", T_FUNC( 308, notification_fullsize_level_high ), 1); + TC_ADD( 309, "Fullsize Noti Level top", T_FUNC( 309, notification_fullsize_level_top ), 1); + TC_ADD( 310, "Fullsize Noti Level none", T_FUNC( 310, notification_fullsize_level_none ), 1); + TC_ADD( 311, "Fullsize Noti Level Change", T_FUNC( 311, notification_fullsize_level_change ), 1); /* [0400 - 0499] tizen-ws-shell */ TC_ADD( 400, "Screensaver: Basic", T_FUNC( 400, scrsaver_basic ), 1); diff --git a/src/e_test_runner.h b/src/e_test_runner.h index f021071..9d0d735 100644 --- a/src/e_test_runner.h +++ b/src/e_test_runner.h @@ -280,12 +280,16 @@ Eina_Bool tc_0204_transient_for_stack_below(E_TC *tc); Eina_Bool tc_0300_notification_level_default(E_TC *tc); Eina_Bool tc_0301_notification_level_medium(E_TC *tc); -Eina_Bool tc_0302_notification_level_top(E_TC *tc); -Eina_Bool tc_0303_notification_level_change(E_TC *tc); -Eina_Bool tc_0304_notification_fullsize_level_default(E_TC *tc); -Eina_Bool tc_0305_notification_fullsize_level_medium(E_TC *tc); -Eina_Bool tc_0306_notification_fullsize_level_top(E_TC *tc); -Eina_Bool tc_0307_notification_fullsize_level_change(E_TC *tc); +Eina_Bool tc_0302_notification_level_high(E_TC *tc); +Eina_Bool tc_0303_notification_level_top(E_TC *tc); +Eina_Bool tc_0304_notification_level_none(E_TC *tc); +Eina_Bool tc_0305_notification_level_change(E_TC *tc); +Eina_Bool tc_0306_notification_fullsize_level_default(E_TC *tc); +Eina_Bool tc_0307_notification_fullsize_level_medium(E_TC *tc); +Eina_Bool tc_0308_notification_fullsize_level_high(E_TC *tc); +Eina_Bool tc_0309_notification_fullsize_level_top(E_TC *tc); +Eina_Bool tc_0310_notification_fullsize_level_none(E_TC *tc); +Eina_Bool tc_0311_notification_fullsize_level_change(E_TC *tc); Eina_Bool tc_0400_scrsaver_basic(E_TC *tc); Eina_Bool tc_0401_scrsaver_mng_basic(E_TC *tc); -- 2.7.4 From a6a50d59deb3b7e9bbd0e1ff3e6cee7621dcee37 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Thu, 26 Oct 2017 11:00:03 +0900 Subject: [PATCH 05/16] e-tizen-testcase: remove useless file Change-Id: I32f6c62fcc27c3845d42e0f72de40d09f3c8c38d --- src/.e_test_runner.h.swp | Bin 16384 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/.e_test_runner.h.swp diff --git a/src/.e_test_runner.h.swp b/src/.e_test_runner.h.swp deleted file mode 100644 index 5bdd7135c9071b2b6984496bcd44ebc0a32f20fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeI2U2G#)702(k-LkaZ?k01jk82ZZ7|6>+uuwFA|BTqYqvwC-jnaUMeo3;PS)7I;>DH~>8GUQpKTc4E~|Ce=pnkIK=TH&Fi z-bjH+fw2l4C+So&!ObSle4L*CKy9o?WDqG3DG(_TDG(_TDG(_TDG(_TDe(WJfZ4g5 zJcH@nc8XkFFEaR5A{3$MlX>9kphtdkphtdkphtdkphtd zkphtdkphtdkplk%1*8Tcr!cO-KLEh@|L*?(uO|rkBlrXO1$YU34SXIv0n#7^J_;TN zr@&Eg=Rrb#1%3%$0Y3mYK^v$*0yR(q9|WhtG4SqjLf!#C0k49Wz;oamU>iuF3Rb{* za1xvVN5DTGAmlILN8pFxTi{FJ3*ZT`1U>}bzMqiSzzg6ScpNN(Dex(99NZ6X-$%$B z;AQZ2a1}fXmcT>c-|r{nx8N0U6Fd*T2(AMKl)+g*!7*_A7$Lt0KLy_h-vbJG2)y<_ zXbSd00SI6gOoP+l_PvC>2wLDA_!zizl#sW;&%v|61U0Y-J_6po2l<2N!4*&j)8Iky z=er5{HFyzx1+;+x9tNktN$?J8;h*45@MG|0pa5PY%V6Z7lnQL4uwKX&iiPSHD^~@FtsRo-&B9X9c+Q`N58VD;ZLcR)w z5JhnlCX2xlN@BIJQpjhk1+m1cBF}s=IGE4UNo(N{K}%v~En7s~g+s)(bDa+kTdovD z#F-C{vs}rpqBj%lYflX)G)O1+oXrLM3d^ek<5$Fbz9I;`Q0Ic<_-xV#2SbE(aD;45 z+z`;63U=;mnF@B#3ATXAV0T{rwh&49qxg-MtnSLb>U3NyYkD+=hIYFxh-i^uJaTP$Rfv2C6)tzfnL!ynQre;!|XMi z-YU|p_AN&A9Y=8 z!p}75o?^DB{ZlykNmJGgMc1Ycxw|WOr#oHU)a$y6(5kZ2LNAsKleT23A$Ms@YRtIt zw&l9iGi2)f0Ugz3xnWRKr@U);jJm2I*kBB^C7EuxT+f`Mdory{+9yrRTkk46iYBSl znjlp)YPMuI6E40%b-uWI@|+^GleCn3gjQQJAD=5jrLIifSn58`eN)k(ofFUJKVvV< z)jZo&G?v#@-Cdt~Q=!E2Vo|KHa;;J>3eE-S>&b6rOF`{hLJTRf zx4NL_%?pKUV4z$vYuzUT3(Gsx{@jIKoF!I;c+SlUR>B5f>Z@C2f#0O;;`KK}o@H^9 zRm7^j2IntiORJuYJQ3EbNQqh3_+Tm{{nio^(hos}N=SbtTUZYsAI}iXPR}EyXMEl- zuB-&cw)#9L#^Y8ktO;VR8t7IMOME#z=p+mz$MYQBYoWSnED`5A)2H~KgOA5Zzwcm6 zj}fe!U0IGXv)y6wrM@$z9;2(CX8+s1kx(dQS+THQWh*Gvn5r1KfbF1zNV~eypp#as zcO)yM9qHha`bG`ipTfw0kC6%Ivc}@av$67WQsR@1!v#jN)=-+T?P>h6%wtL>l;&{L zaLiaIPLat~TfGjH>)?cza5r7TDH@!zz)}1I;CGROd`rS+%$TBDoW=|~8Lvw!9^zuS ztr+;}vfhjt@%U)wa2kZ<|BwlLU8DI*AvQBJ6Q}n15m(u=xW>?0jWJcxVW%%cX=OR(+|vKiuBf?is$eGyF+H*_mmb@kqjO zGg!;w4tar3&AGk?ZG8W~hkfBQ*f;Y1zx)0D8`#Ug4!#L4gGIpi_pf8G{w%12IQSd( z-+a%01Bl?m;4SR6UjQ1&fPZ06{W5qGoCo)Uqu?HJ3;XHs0u!7E_klODXTAk~2fht- za1I;=zu|jk@Kx|A_yqVn_Q|h;Yv8lsJ?xQx2CjiTxCvdZc$N!yV_ zhD#?Cp#d~(w!_>LXG7hw(+~At4E1hd>m2I75bEBR8%nPo8el#&0GQbT?iNA8A>lpOM~J_if+NDO(5UeUukBo{NRjjB_u zYni3?6wP2pOW#X}43u1)3wBC{I;Df1lA%s1$LX+{B}eSTlS+)(`|`mz8~!CWx!{g~ zJ)bR_rI~d)Lx);$hYE1?jX6Bx{8=YQzoT8SR^f%7tog-p?xAVVFN|{!Pkuho-KypA zaoxi7&)RYfAJHvNzvI}Vo_FhW)Gs_yw?s$%!t)F+q>*cOq#V3;bjaGvcuQ#D6PjPf zTQ~N)U@ej3D=yL~8TJg%)>|%?=lBxKcq?V#6F!c&O6&~Bt(F;Yf%IL% ib@0|k-z7Y;k+K-6q>;4@&vTO6X-N!2*f&7$TKpf Date: Thu, 26 Oct 2017 11:28:40 +0900 Subject: [PATCH 06/16] TC0600_focus: add focus testcase Change-Id: I65a3d9a7f47e00462b92f247d6111fde88f2fb22 --- src/0600_focus.c | 332 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 3 +- src/e_test_runner.c | 6 + src/e_test_runner.h | 5 + 4 files changed, 345 insertions(+), 1 deletion(-) create mode 100755 src/0600_focus.c diff --git a/src/0600_focus.c b/src/0600_focus.c new file mode 100755 index 0000000..9b5743a --- /dev/null +++ b/src/0600_focus.c @@ -0,0 +1,332 @@ +#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, 400, 400, use_geom, + 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", + 150, 150, 400, 400, use_geom, + 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", + 20, 350, 400, 400, 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); + e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_LOWER); + + // 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); + e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_ABOVE); + + // 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; +} diff --git a/src/Makefile.am b/src/Makefile.am index 496e7a6..60a4e49 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -16,7 +16,8 @@ e_test_runner.h \ 0200_transient_for.c \ 0300_notification.c \ 0400_tzsh.c \ -0500_rotation.c +0500_rotation.c \ +0600_focus.c MAINTAINERCLEANFILES = \ Makefile.in diff --git a/src/e_test_runner.c b/src/e_test_runner.c index 2b34025..6692bae 100644 --- a/src/e_test_runner.c +++ b/src/e_test_runner.c @@ -1056,6 +1056,12 @@ _e_test_runner_init(E_Test_Runner *runner, TC_ADD( 401, "Screensaver Manager: Basic", T_FUNC( 401, scrsaver_mng_basic ), 1); TC_ADD( 500, "Rotation: Available Rotation", T_FUNC( 500, rotation_available_rots ), 1); + + /* [0600 - 0699] focus */ + TC_ADD( 600, "Focus: Basic", T_FUNC( 600, focus_basic ), 1); + TC_ADD( 601, "Focus: lower", T_FUNC( 601, focus_lower ), 1); + TC_ADD( 602, "Focus: raise", T_FUNC( 602, focus_raise ), 1); + TC_ADD( 603, "Focus: destroy", T_FUNC( 603, focus_destroy ), 1); #undef T_FUNC } diff --git a/src/e_test_runner.h b/src/e_test_runner.h index 9d0d735..76eb101 100644 --- a/src/e_test_runner.h +++ b/src/e_test_runner.h @@ -294,6 +294,11 @@ Eina_Bool tc_0311_notification_fullsize_level_change(E_TC *tc); Eina_Bool tc_0400_scrsaver_basic(E_TC *tc); Eina_Bool tc_0401_scrsaver_mng_basic(E_TC *tc); +Eina_Bool tc_0600_focus_basic(E_TC *tc); +Eina_Bool tc_0601_focus_lower(E_TC *tc); +Eina_Bool tc_0602_focus_raise(E_TC *tc); +Eina_Bool tc_0603_focus_destroy(E_TC *tc); + #include "0500_rotation.h" #endif -- 2.7.4 From 1e9824adf7d1eb540fcf3513ad177d313d7db734 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Mon, 6 Nov 2017 19:25:11 +0900 Subject: [PATCH 07/16] e_test_runner: add signal handler for FocusChanged Change-Id: I728792de4724baa70391b07bae29c0b1001b54c0 --- src/0000_easy.c | 1 + src/e_test_runner.c | 32 ++++++++++++++++++++++++++++++++ src/e_test_runner.h | 1 + 3 files changed, 34 insertions(+) diff --git a/src/0000_easy.c b/src/0000_easy.c index d24a8f9..8a7600f 100644 --- a/src/0000_easy.c +++ b/src/0000_easy.c @@ -30,6 +30,7 @@ _cb_introspect(void *data, (!strstr(arg, "signal name=\"VisibilityChanged\"" )) || (!strstr(arg, "signal name=\"StackChanged\"" )) || (!strstr(arg, "signal name=\"WinRotationChanged\"" )) || + (!strstr(arg, "signal name=\"FocusChanged\"" )) || (!strstr(arg, "property name=\"Registrant\"" ))) { ERR("missing mehod, signal or property:%s\n", arg); diff --git a/src/e_test_runner.c b/src/e_test_runner.c index 6692bae..e7efb13 100644 --- a/src/e_test_runner.c +++ b/src/e_test_runner.c @@ -374,6 +374,30 @@ finish: } } +static void +_cb_signal_focus_changed(void *data, + const Eldbus_Message *msg) +{ + E_Test_Runner *runner = data; + const char *name = NULL, *text = NULL; + Eina_Bool res = EINA_FALSE; + + res = eldbus_message_error_get(msg, &name, &text); + EINA_SAFETY_ON_TRUE_GOTO(res, finish); + + if (E_TC_EVENT_TYPE_FOCUS_CHANGED == runner->ev.expect) + { + runner->ev.response = runner->ev.expect; + elm_exit(); + } + +finish: + if ((name) || (text)) + { + ERR("errname:%s errmsg:%s\n", name, text); + } +} + static Eina_Bool _cb_work_time_out(void *data EINA_UNUSED) { @@ -714,6 +738,14 @@ e_test_runner_ev_wait(E_Test_Runner *runner, EINA_SAFETY_ON_NULL_GOTO(sh, finish); break; + case E_TC_EVENT_TYPE_FOCUS_CHANGED: + sh = eldbus_proxy_signal_handler_add(runner->dbus.proxy, + "FocusChanged", + _cb_signal_focus_changed, + runner); + EINA_SAFETY_ON_NULL_GOTO(sh, finish); + break; + default: goto finish; break; diff --git a/src/e_test_runner.h b/src/e_test_runner.h index 76eb101..d363b11 100644 --- a/src/e_test_runner.h +++ b/src/e_test_runner.h @@ -71,6 +71,7 @@ typedef enum _E_TC_Event_Type E_TC_EVENT_TYPE_STACK_ABOVE, E_TC_EVENT_TYPE_STACK_BELOW, E_TC_EVENT_TYPE_WINDOW_ROTATION_CHANGE, + E_TC_EVENT_TYPE_FOCUS_CHANGED, E_TC_EVENT_TYPE_MAX } E_TC_Event_Type; -- 2.7.4 From 6519a9c21247806f709188b50780a36e0e1c7dc6 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Wed, 8 Nov 2017 11:51:08 +0900 Subject: [PATCH 08/16] TC0600_focus: fix tc fail issue Changed waiting event from STACK_CHANGED to FOCUS_CHANGED for wait focus changes Change-Id: I5fbb6305c1e34b840f4e3129763de38b2adefcf9 --- src/0600_focus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) mode change 100755 => 100644 src/0600_focus.c diff --git a/src/0600_focus.c b/src/0600_focus.c old mode 100755 new mode 100644 index 9b5743a..804be6f --- a/src/0600_focus.c +++ b/src/0600_focus.c @@ -195,7 +195,8 @@ tc_0601_focus_lower(E_TC *tc) // make tw_blue stack lower e_test_runner_req_win_stack_set(tc->runner, tw_blue, NULL, EINA_FALSE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_LOWER); + 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] @@ -247,7 +248,8 @@ tc_0602_focus_raise(E_TC *tc) // make tw_red stack raise e_test_runner_req_win_stack_set(tc->runner, tw_red, NULL, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_ABOVE); + 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] -- 2.7.4 From 0359ba50650dcdceac28db373d5fff2038f0c4b8 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Thu, 23 Nov 2017 18:44:17 +0900 Subject: [PATCH 09/16] focus_tc: add partial window focus testcase Change-Id: Ibe777f95e332098144cef6c9ee301eaaeb4aed39 --- src/0600_focus.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++--- src/e_test_runner.c | 1 + src/e_test_runner.h | 1 + 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/src/0600_focus.c b/src/0600_focus.c index 804be6f..69e6180 100644 --- a/src/0600_focus.c +++ b/src/0600_focus.c @@ -59,7 +59,7 @@ _tc_focus_pre_run(E_TC *tc, Eina_Bool show_win, Eina_Bool use_geom) tc->data->tw_red = e_tc_win_add(NULL, ELM_WIN_BASIC, EINA_FALSE, "red", - 0, 0, 400, 400, use_geom, + 0, 0, 720, 640, EINA_FALSE, 200, E_TC_WIN_COLOR_RED); EINA_SAFETY_ON_NULL_GOTO(tc->data->tw_red, cleanup); @@ -71,7 +71,7 @@ _tc_focus_pre_run(E_TC *tc, Eina_Bool show_win, Eina_Bool use_geom) tc->data->tw_green = e_tc_win_add(NULL, ELM_WIN_BASIC, EINA_FALSE, "green", - 150, 150, 400, 400, use_geom, + 0, 0, 720, 640, EINA_FALSE, 200, E_TC_WIN_COLOR_GREEN); EINA_SAFETY_ON_NULL_GOTO(tc->data->tw_green, cleanup); @@ -83,7 +83,7 @@ _tc_focus_pre_run(E_TC *tc, Eina_Bool show_win, Eina_Bool use_geom) tc->data->tw_blue = e_tc_win_add(NULL, ELM_WIN_BASIC, EINA_FALSE, "blue", - 20, 350, 400, 400, use_geom, + 0, 0, 720, 640, use_geom, 200, E_TC_WIN_COLOR_BLUE); EINA_SAFETY_ON_NULL_GOTO(tc->data->tw_blue, cleanup); @@ -332,3 +332,50 @@ cleanup: 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; +} diff --git a/src/e_test_runner.c b/src/e_test_runner.c index e7efb13..8085b23 100644 --- a/src/e_test_runner.c +++ b/src/e_test_runner.c @@ -1094,6 +1094,7 @@ _e_test_runner_init(E_Test_Runner *runner, TC_ADD( 601, "Focus: lower", T_FUNC( 601, focus_lower ), 1); TC_ADD( 602, "Focus: raise", T_FUNC( 602, focus_raise ), 1); TC_ADD( 603, "Focus: destroy", T_FUNC( 603, focus_destroy ), 1); + TC_ADD( 604, "Focus: partial window basic", T_FUNC( 604, focus_partial_basic ), 1); #undef T_FUNC } diff --git a/src/e_test_runner.h b/src/e_test_runner.h index d363b11..78e79de 100644 --- a/src/e_test_runner.h +++ b/src/e_test_runner.h @@ -299,6 +299,7 @@ Eina_Bool tc_0600_focus_basic(E_TC *tc); Eina_Bool tc_0601_focus_lower(E_TC *tc); Eina_Bool tc_0602_focus_raise(E_TC *tc); Eina_Bool tc_0603_focus_destroy(E_TC *tc); +Eina_Bool tc_0604_focus_partial_basic(E_TC *tc); #include "0500_rotation.h" -- 2.7.4 From 7335598cfdbd5ee28258c7678a5f9534569c0a10 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Fri, 23 Feb 2018 18:36:19 +0900 Subject: [PATCH 10/16] e-tizen-testcase: change test framework to gtest Change-Id: Idc6b6afe4328b0ff42b21f3601c73fbd09831454 --- configure.ac | 2 + packaging/e-tizen-testcase.spec | 3 +- src/0100_base_operation.c | 180 --- src/0150_base_operation_multi_wins.c | 2149 -------------------------- src/0200_transient_for.c | 508 ------ src/0300_notification.c | 561 ------- src/Makefile.am | 30 +- src/e_test_event.cpp | 1046 +++++++++++++ src/e_test_event.h | 93 ++ src/e_test_main.cpp | 48 + src/e_test_runner.c | 1282 --------------- src/e_test_runner.h | 306 ---- src/e_test_util.h | 153 ++ src/e_test_win.cpp | 101 ++ src/e_test_win.h | 80 + src/eina_list_ext.h | 56 + src/{0000_easy.c => testcase/1_easy.cpp} | 118 +- src/testcase/2_base_operation.cpp | 133 ++ src/testcase/3_base_operation_multi_wins.cpp | 1606 +++++++++++++++++++ src/testcase/4_transient_for.cpp | 351 +++++ src/testcase/5_notification.cpp | 1181 ++++++++++++++ 21 files changed, 4927 insertions(+), 5060 deletions(-) delete mode 100644 src/0100_base_operation.c delete mode 100644 src/0150_base_operation_multi_wins.c delete mode 100644 src/0200_transient_for.c delete mode 100644 src/0300_notification.c create mode 100644 src/e_test_event.cpp create mode 100644 src/e_test_event.h create mode 100644 src/e_test_main.cpp delete mode 100644 src/e_test_runner.c delete mode 100644 src/e_test_runner.h create mode 100644 src/e_test_util.h create mode 100644 src/e_test_win.cpp create mode 100644 src/e_test_win.h create mode 100644 src/eina_list_ext.h rename src/{0000_easy.c => testcase/1_easy.cpp} (62%) create mode 100644 src/testcase/2_base_operation.cpp create mode 100644 src/testcase/3_base_operation_multi_wins.cpp create mode 100644 src/testcase/4_transient_for.cpp create mode 100644 src/testcase/5_notification.cpp diff --git a/configure.ac b/configure.ac index 238d4af..32345e2 100644 --- a/configure.ac +++ b/configure.ac @@ -15,10 +15,12 @@ AM_INIT_AUTOMAKE([1.11]) GETTEXT_PACKAGE="e_test_runner" AC_SUBST([GETTEXT_PACKAGE]) AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "$GETTEXT_PACKAGE", [Gettext package]) +AC_SUBST(GCC_CXXFLAGS) AC_USE_SYSTEM_EXTENSIONS AM_PROG_CC_STDC AM_PROG_CC_C_O +AC_PROG_CXX requirements="\ elementary \ diff --git a/packaging/e-tizen-testcase.spec b/packaging/e-tizen-testcase.spec index ee50c9b..e309be5 100644 --- a/packaging/e-tizen-testcase.spec +++ b/packaging/e-tizen-testcase.spec @@ -13,6 +13,7 @@ BuildRequires: gettext BuildRequires: pkgconfig(tizen-extension-client) BuildRequires: pkgconfig(tzsh-screensaver-manager-service) BuildRequires: pkgconfig(tzsh-screensaver-service) +BuildRequires: gtest-devel %description This package is a test case runner for enlightenment. @@ -22,7 +23,7 @@ This package is a test case runner for enlightenment. %build export GC_SECTIONS_FLAGS="-fdata-sections -ffunction-sections -Wl,--gc-sections" -export CFLAGS+=" -Wall -g -fPIC -Werror -rdynamic ${GC_SECTIONS_FLAGS}" +export CXXFLAGS+=" -Wall -g -fPIC -rdynamic ${GC_SECTIONS_FLAGS}" export LDFLAGS+=" -Wl,--hash-style=both -Wl,--as-needed -Wl,--rpath=/usr/lib" %autogen diff --git a/src/0100_base_operation.c b/src/0100_base_operation.c deleted file mode 100644 index f80349b..0000000 --- a/src/0100_base_operation.c +++ /dev/null @@ -1,180 +0,0 @@ -#include "e_test_runner.h" - -struct _E_TC_Data -{ - E_TC_Win *tw; -}; - -static Eina_Bool _tc_pre_run(E_TC *tc, Eina_Bool alpha); -static void _tc_post_run(E_TC *tc); -static void _tc_shutdown(E_TC *tc); - -static Eina_Bool -_tc_pre_run(E_TC *tc, Eina_Bool alpha) -{ - Eina_Bool res; - - tc->data = E_NEW(E_TC_Data, 1); - EINA_SAFETY_ON_NULL_RETURN_VAL(tc->data, EINA_FALSE); - - tc->data->tw = e_tc_win_add(NULL, ELM_WIN_BASIC, - alpha, "tc", - 0, 0, 320, 320, EINA_FALSE, - 200, E_TC_WIN_COLOR_GREEN); - EINA_SAFETY_ON_NULL_GOTO(tc->data->tw, cleanup); - - res = e_test_runner_req_win_register(tc->runner, tc->data->tw); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - e_tc_win_geom_update(tc->data->tw); - e_tc_win_show(tc->data->tw); - - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); - - e_test_runner_work(); - - return EINA_TRUE; - -cleanup: - _tc_shutdown(tc); - return EINA_FALSE; -} - -static void -_tc_post_run(E_TC *tc) -{ - EINA_SAFETY_ON_NULL_RETURN(tc); - EINA_SAFETY_ON_NULL_RETURN(tc->data); - - e_tc_win_hide(tc->data->tw); -} - -static void -_tc_shutdown(E_TC *tc) -{ - EINA_SAFETY_ON_NULL_RETURN(tc); - EINA_SAFETY_ON_NULL_RETURN(tc->data); - - e_test_runner_req_win_deregister(tc->runner, tc->data->tw); - e_tc_win_del(tc->data->tw); - - E_FREE(tc->data); -} - -Eina_Bool -tc_0100_win_show(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return tc->passed; -} - -Eina_Bool -tc_0101_win_stack(E_TC *tc) -{ - E_TC_Win *tw, *tw2; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw = tc->data->tw; - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - EINA_LIST_FOREACH(list, l, tw2) - { - if (tw2->layer > tw->layer) continue; - if (tw2->layer < tw->layer) break; - - if (!strncmp(tw2->name, tw->name, strlen(tw2->name))) - res = EINA_TRUE; - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0110_alpha_win_show(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_TRUE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return tc->passed; -} - -Eina_Bool -tc_0111_alpha_win_stack(E_TC *tc) -{ - E_TC_Win *tw, *tw2; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_TRUE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw = tc->data->tw; - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - EINA_LIST_FOREACH(list, l, tw2) - { - if (tw2->layer > tw->layer) continue; - if (tw2->layer < tw->layer) break; - - if (!strncmp(tw2->name, tw->name, strlen(tw2->name))) - res = EINA_TRUE; - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} diff --git a/src/0150_base_operation_multi_wins.c b/src/0150_base_operation_multi_wins.c deleted file mode 100644 index ee8a3e6..0000000 --- a/src/0150_base_operation_multi_wins.c +++ /dev/null @@ -1,2149 +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_multi_wins_pre_run(E_TC *tc, Eina_Bool alpha, Eina_Bool use_geom); -static void _tc_multi_wins_post_run(E_TC *tc); -static void _tc_multi_wins_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_multi_wins_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, 400, 400, use_geom, - 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", - 150, 150, 400, 400, use_geom, - 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", - 20, 350, 400, 400, 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_multi_wins_shutdown(tc); - return EINA_FALSE; -} - -static void -_tc_multi_wins_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_multi_wins_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); -} - -static Eina_Bool -_tc_win_show(E_TC *tc, E_TC_Win *tw) -{ - Eina_Bool res = EINA_FALSE; - - res = _tc_win_register(tc, tw); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - - e_tc_win_geom_update(tw); - e_tc_win_show(tw); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); - - return EINA_TRUE; -} - -Eina_Bool -tc_0150_multi_all_wins_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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0151_multi_all_wins_show1(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_FALSE, 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; - - // show red - res = _tc_win_show(tc, tc->data->tw_red); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show green - res = _tc_win_show(tc, tc->data->tw_green); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show blue - res = _tc_win_show(tc, tc->data->tw_blue); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // Expected stack result: - // [Top] Blue -> Green -> Red [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0152_multi_all_wins_show2(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_pre_run(tc, EINA_FALSE, 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; - - // show blue - res = _tc_win_show(tc, tc->data->tw_blue); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show red - res = _tc_win_show(tc, tc->data->tw_red); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show green - res = _tc_win_show(tc, tc->data->tw_green); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // Expected stack result: - // [Top] Green -> Red -> Blue [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - - -Eina_Bool -tc_0153_multi_all_wins_show3(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_pre_run(tc, EINA_FALSE, 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; - - // show green - res = _tc_win_show(tc, tc->data->tw_green); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show blue - res = _tc_win_show(tc, tc->data->tw_blue); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show red - res = _tc_win_show(tc, tc->data->tw_red); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // Expected stack result: - // [Top] Red -> Blue -> Green [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0154_multi_all_wins_raise1(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - // Raise Red - e_test_runner_req_win_stack_set(tc->runner, tw_red, NULL, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] Red -> Blue -> Green [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0155_multi_all_wins_raise2(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - // Raise Green - e_test_runner_req_win_stack_set(tc->runner, tw_green, NULL, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] Green -> Blue -> Red [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0156_multi_all_wins_stack_above1(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - // Raise Red on the Green - e_test_runner_req_win_stack_set(tc->runner, tw_red, tw_green, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] Blue -> Red -> Green [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - - -Eina_Bool -tc_0157_multi_all_wins_stack_above2(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - // Raise Blue on the Red - e_test_runner_req_win_stack_set(tc->runner, tw_blue, tw_red, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] Green -> Blue -> Red [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0158_multi_all_wins_stack_above3(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - // Raise Red on the Blue - e_test_runner_req_win_stack_set(tc->runner, tw_red, tw_blue, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] Red -> Blue -> Green [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0159_multi_all_wins_lower1(E_TC *tc) -{ - E_TC_Win *tw, *tw_above = NULL; - E_TC_Win *tw_red, *tw_green, *tw_blue; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - // Lower Blue - e_test_runner_req_win_stack_set(tc->runner, tw_blue, NULL, EINA_FALSE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] Green -> Red -> ... -> Blue [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - tw_above = tw; - continue; - - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - tw_above = tw; - continue; - } - else - { - if (tw->layer < 200) - { - EINA_SAFETY_ON_FALSE_GOTO((tw_above->native_win == tw_blue->native_win), cleanup); - pass_count++; - } - else - { - tw_above = tw; - continue; - } - } - - break; - } - // check the tw_above when there is no window under 200 layer. - if (tw == NULL) - { - EINA_SAFETY_ON_NULL_GOTO(tw_above, cleanup); - EINA_SAFETY_ON_FALSE_GOTO((tw_above->native_win == tw_blue->native_win), cleanup); - pass_count++; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - - -Eina_Bool -tc_0160_multi_all_wins_lower2(E_TC *tc) -{ - E_TC_Win *tw, *tw_above = NULL; - E_TC_Win *tw_red, *tw_green, *tw_blue; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - // Lower Green - e_test_runner_req_win_stack_set(tc->runner, tw_green, NULL, EINA_FALSE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] Blue -> Red -> ... -> Green [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - tw_above = tw; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - tw_above = tw; - continue; - } - else - { - if (tw->layer < 200) - { - EINA_SAFETY_ON_FALSE_GOTO((tw_above->native_win == tw_green->native_win), cleanup); - pass_count++; - } - else - { - tw_above = tw; - continue; - } - } - - break; - } - // check the tw_above when there is no window under 200 layer. - if (tw == NULL) - { - EINA_SAFETY_ON_NULL_GOTO(tw_above, cleanup); - EINA_SAFETY_ON_FALSE_GOTO((tw_above->native_win == tw_green->native_win), cleanup); - pass_count++; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0161_multi_all_full_wins_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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0162_multi_all_full_wins_show1(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - res = _tc_multi_wins_pre_run(tc, EINA_FALSE, 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; - - // show red - res = _tc_win_show(tc, tc->data->tw_red); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show green - res = _tc_win_show(tc, tc->data->tw_green); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show blue - res = _tc_win_show(tc, tc->data->tw_blue); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // Expected stack result: - // [Top] Blue -> Green -> Red [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0163_multi_all_full_wins_show2(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_pre_run(tc, EINA_FALSE, 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; - - // show blue - res = _tc_win_show(tc, tc->data->tw_blue); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show red - res = _tc_win_show(tc, tc->data->tw_red); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show green - res = _tc_win_show(tc, tc->data->tw_green); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // Expected stack result: - // [Top] Green -> Red -> Blue [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - - -Eina_Bool -tc_0164_multi_all_full_wins_show3(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_pre_run(tc, EINA_FALSE, 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; - - // show green - res = _tc_win_show(tc, tc->data->tw_green); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show blue - res = _tc_win_show(tc, tc->data->tw_blue); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show red - res = _tc_win_show(tc, tc->data->tw_red); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // Expected stack result: - // [Top] Red -> Blue -> Green [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0165_multi_all_full_wins_raise1(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - // Raise Red - e_test_runner_req_win_stack_set(tc->runner, tw_red, NULL, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] Red -> Blue -> Green [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0166_multi_all_full_wins_raise2(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - // Raise Green - e_test_runner_req_win_stack_set(tc->runner, tw_green, NULL, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] Green -> Blue -> Red [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0167_multi_all_full_wins_stack_above1(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - // Raise Red on the Green - e_test_runner_req_win_stack_set(tc->runner, tw_red, tw_green, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] Blue -> Red -> Green [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - - -Eina_Bool -tc_0168_multi_all_full_wins_stack_above2(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - // Raise Blue on the Red - e_test_runner_req_win_stack_set(tc->runner, tw_blue, tw_red, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] Green -> Blue -> Red [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0169_multi_all_full_wins_stack_above3(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; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - // Raise Red on the Blue - e_test_runner_req_win_stack_set(tc->runner, tw_red, tw_blue, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] Red -> Blue -> Green [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0170_multi_all_full_wins_lower1(E_TC *tc) -{ - E_TC_Win *tw, *tw_above = NULL; - E_TC_Win *tw_red, *tw_green, *tw_blue; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - // Lower Blue - e_test_runner_req_win_stack_set(tc->runner, tw_blue, NULL, EINA_FALSE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] Green -> Red -> ... -> Blue [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - tw_above = tw; - continue; - - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - tw_above = tw; - continue; - } - else - { - if (tw->layer < 200) - { - EINA_SAFETY_ON_FALSE_GOTO((tw_above->native_win == tw_blue->native_win), cleanup); - pass_count++; - } - else - { - tw_above = tw; - continue; - } - } - - break; - } - // check the tw_above when there is no window under 200 layer. - if (tw == NULL) - { - EINA_SAFETY_ON_NULL_GOTO(tw_above, cleanup); - EINA_SAFETY_ON_FALSE_GOTO((tw_above->native_win == tw_blue->native_win), cleanup); - pass_count++; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - - -Eina_Bool -tc_0171_multi_all_full_wins_lower2(E_TC *tc) -{ - E_TC_Win *tw, *tw_above = NULL; - E_TC_Win *tw_red, *tw_green, *tw_blue; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_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 stack result: - // [Top] Blue -> Green -> Red [Bottom] - - // Lower Green - e_test_runner_req_win_stack_set(tc->runner, tw_green, NULL, EINA_FALSE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] Blue -> Red -> ... -> Green [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - tw_above = tw; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - tw_above = tw; - continue; - } - else - { - if (tw->layer < 200) - { - EINA_SAFETY_ON_FALSE_GOTO((tw_above->native_win == tw_green->native_win), cleanup); - pass_count++; - } - else - { - tw_above = tw; - continue; - } - } - - break; - } - // check the tw_above when there is no window under 200 layer. - if (tw == NULL) - { - EINA_SAFETY_ON_NULL_GOTO(tw_above, cleanup); - EINA_SAFETY_ON_FALSE_GOTO((tw_above->native_win == tw_green->native_win), cleanup); - pass_count++; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - - -Eina_Bool -tc_0180_multi_2wins_show1(E_TC *tc) -{ - E_TC_Win *tw; - E_TC_Win *tw_red, *tw_green; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_TRUE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_red = tc->data->tw_red; - tw_green = tc->data->tw_green; - - // show green - e_tc_win_geom_update(tc->data->tw_green); - e_tc_win_show(tc->data->tw_green); - - // register red - res = _tc_win_register(tc, tc->data->tw_red); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show red - e_tc_win_geom_update(tc->data->tw_red); - e_tc_win_show(tc->data->tw_red); - - // wait for showing register_win - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); - - // Expected stack result: - // [Top] Red -> Green [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 2), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - - -Eina_Bool -tc_0181_multi_2wins_show2(E_TC *tc) -{ - E_TC_Win *tw; - E_TC_Win *tw_green, *tw_blue; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_TRUE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_green = tc->data->tw_green; - tw_blue = tc->data->tw_blue; - - // show blue - e_tc_win_geom_update(tc->data->tw_blue); - e_tc_win_show(tc->data->tw_blue); - - // register green - res = _tc_win_register(tc, tc->data->tw_green); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show green - e_tc_win_geom_update(tc->data->tw_green); - e_tc_win_show(tc->data->tw_green); - - // wait for showing register_win - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); - - // Expected stack result: - // [Top] Green -> Blue [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 2), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - - -Eina_Bool -tc_0182_multi_2wins_show3(E_TC *tc) -{ - E_TC_Win *tw; - E_TC_Win *tw_red, *tw_blue; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_TRUE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_red = tc->data->tw_red; - tw_blue = tc->data->tw_blue; - - // show red - e_tc_win_geom_update(tc->data->tw_red); - e_tc_win_show(tc->data->tw_red); - - // register blue - res = _tc_win_register(tc, tc->data->tw_blue); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show blue - e_tc_win_geom_update(tc->data->tw_blue); - e_tc_win_show(tc->data->tw_blue); - - // wait for showing register_win - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); - - // Expected stack result: - // [Top] Blue -> Red [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 2), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0183_multi_full_2wins_show1(E_TC *tc) -{ - E_TC_Win *tw; - E_TC_Win *tw_red, *tw_green; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_red = tc->data->tw_red; - tw_green = tc->data->tw_green; - - // show green - e_tc_win_geom_update(tc->data->tw_green); - e_tc_win_show(tc->data->tw_green); - - // register red - res = _tc_win_register(tc, tc->data->tw_red); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show red - e_tc_win_geom_update(tc->data->tw_red); - e_tc_win_show(tc->data->tw_red); - - // wait for showing register_win - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); - - // Expected stack result: - // [Top] Red -> Green [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 2), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - - -Eina_Bool -tc_0184_multi_full_2wins_show2(E_TC *tc) -{ - E_TC_Win *tw; - E_TC_Win *tw_green, *tw_blue; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_green = tc->data->tw_green; - tw_blue = tc->data->tw_blue; - - // show blue - e_tc_win_geom_update(tc->data->tw_blue); - e_tc_win_show(tc->data->tw_blue); - - // register green - res = _tc_win_register(tc, tc->data->tw_green); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show green - e_tc_win_geom_update(tc->data->tw_green); - e_tc_win_show(tc->data->tw_green); - - // wait for showing register_win - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); - - // Expected stack result: - // [Top] Green -> Blue [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_green->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 2), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - - -Eina_Bool -tc_0185_multi_full_2wins_show3(E_TC *tc) -{ - E_TC_Win *tw; - E_TC_Win *tw_red, *tw_blue; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_multi_wins_pre_run(tc, EINA_FALSE, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_red = tc->data->tw_red; - tw_blue = tc->data->tw_blue; - - // show red - e_tc_win_geom_update(tc->data->tw_red); - e_tc_win_show(tc->data->tw_red); - - // register blue - res = _tc_win_register(tc, tc->data->tw_blue); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show blue - e_tc_win_geom_update(tc->data->tw_blue); - e_tc_win_show(tc->data->tw_blue); - - // wait for showing register_win - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); - - // Expected stack result: - // [Top] Blue -> Red [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - pass_count = 0; - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_blue->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_red->native_win), cleanup); - pass_count++; - } - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 2), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_multi_wins_post_run(tc); - _tc_multi_wins_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - diff --git a/src/0200_transient_for.c b/src/0200_transient_for.c deleted file mode 100644 index 5fdd926..0000000 --- a/src/0200_transient_for.c +++ /dev/null @@ -1,508 +0,0 @@ -#include "e_test_runner.h" - -struct _E_TC_Data -{ - E_TC_Win *tw; - E_TC_Win *tw_parent; - E_TC_Win *tw_child; - E_TC_Win *tw_register; -}; - -static Eina_Bool _tc_transient_for_win_register(E_TC *tc, E_TC_Win *win); -static void _tc_transient_for_win_unregister(E_TC *tc); -static Eina_Bool _tc_transient_for_pre_run(E_TC *tc); -static void _tc_transient_for_post_run(E_TC *tc); -static void _tc_transient_for_shutdown(E_TC *tc); - -static Eina_Bool -_tc_transient_for_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_transient_for_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_win_show(E_TC *tc, E_TC_Win *tw) -{ - Eina_Bool res = EINA_FALSE; - - res = _tc_transient_for_win_register(tc, tw); - EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE); - - e_tc_win_geom_update(tw); - e_tc_win_show(tw); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); - - return EINA_TRUE; -} - -static Eina_Bool -_tc_transient_for_pre_run(E_TC *tc) -{ - Eina_Bool res; - - tc->data = E_NEW(E_TC_Data, 1); - EINA_SAFETY_ON_NULL_RETURN_VAL(tc->data, EINA_FALSE); - - tc->data->tw_parent = e_tc_win_add(NULL, ELM_WIN_BASIC, - EINA_FALSE, "parent", - 0, 0, 400, 400, EINA_FALSE, - 200, E_TC_WIN_COLOR_BLUE); - EINA_SAFETY_ON_NULL_GOTO(tc->data->tw_parent, cleanup); - - tc->data->tw_child = e_tc_win_add(NULL, ELM_WIN_BASIC, - EINA_FALSE, "child", - 0, 0, 320, 320, EINA_FALSE, - 200, E_TC_WIN_COLOR_RED); - EINA_SAFETY_ON_NULL_GOTO(tc->data->tw_child, cleanup); - - tc->data->tw = e_tc_win_add(NULL, ELM_WIN_BASIC, - EINA_FALSE, "tc", - 200, 200, 500, 500, EINA_FALSE, - 200, E_TC_WIN_COLOR_GREEN); - EINA_SAFETY_ON_NULL_GOTO(tc->data->tw, cleanup); - - // show tw_parent - res = _tc_win_show(tc, tc->data->tw_parent); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // show tw - res = _tc_win_show(tc, tc->data->tw); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - - // show tw_child - res = _tc_win_show(tc, tc->data->tw_child); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - - // set transient_for - res = e_tc_win_transient_for_set(tc->data->tw_child, - tc->data->tw_parent, - EINA_TRUE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - e_test_runner_work(); - - return EINA_TRUE; - -cleanup: - _tc_transient_for_shutdown(tc); - return EINA_FALSE; -} - -static void -_tc_transient_for_post_run(E_TC *tc) -{ - EINA_SAFETY_ON_NULL_RETURN(tc->data); - - e_tc_win_hide(tc->data->tw_child); - e_tc_win_hide(tc->data->tw); - e_tc_win_hide(tc->data->tw_parent); -} - -static void -_tc_transient_for_shutdown(E_TC *tc) -{ - EINA_SAFETY_ON_NULL_RETURN(tc->data); - - _tc_transient_for_win_unregister(tc); - e_tc_win_del(tc->data->tw_child); - e_tc_win_del(tc->data->tw_parent); - e_tc_win_del(tc->data->tw); - - E_FREE(tc->data); -} - -Eina_Bool -tc_0200_transient_for_basic(E_TC *tc) -{ - E_TC_Win *tw, *tw_main, *tw_parent, *tw_child; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count = 0; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_transient_for_pre_run(tc); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_main = tc->data->tw; - tw_parent = tc->data->tw_parent; - tw_child = tc->data->tw_child; - - // Expected stack result: - // [Top] tw_main -> tw_child -> tw_parent [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->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_main->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_child->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_parent->native_win), cleanup); - pass_count++; - } - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_transient_for_post_run(tc); - _tc_transient_for_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0201_transient_for_raise(E_TC *tc) -{ - E_TC_Win *tw, *tw_main, *tw_parent, *tw_child; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count = 0; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_transient_for_pre_run(tc); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_main = tc->data->tw; - tw_parent = tc->data->tw_parent; - tw_child = tc->data->tw_child; - - // Expected stack result: - // [Top] tw_main -> tw_child -> tw_parent [Bottom] - - res = _tc_transient_for_win_register(tc, tw_parent); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - e_test_runner_req_win_stack_set(tc->runner, tw_parent, NULL, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] tw_child -> tw_parent -> tw_main [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->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_child->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_parent->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_main->native_win), cleanup); - pass_count++; - } - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_transient_for_post_run(tc); - _tc_transient_for_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0202_transient_for_lower(E_TC *tc) -{ - E_TC_Win *tw, *tw_main, *tw_parent, *tw_child; - E_TC_Win *tw_below = NULL; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count = 0; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_transient_for_pre_run(tc); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_main = tc->data->tw; - tw_parent = tc->data->tw_parent; - tw_child = tc->data->tw_child; - - // Expected stack result: - // [Top] tw_main -> tw_child -> tw_parent [Bottom] - - res = _tc_transient_for_win_register(tc, tw_parent); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // Raise Transient_for Parent window - e_test_runner_req_win_stack_set(tc->runner, tw_parent, NULL, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] tw_child -> tw_parent -> tw_main [Bottom] - - - // lower tw_parent - e_test_runner_req_win_stack_set(tc->runner, tw_parent, NULL, EINA_FALSE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_LOWER); - - // Expected stack result: - // [Top] tw_main -> ... -> tw_child -> tw_parent [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - // bottom to top search - EINA_LIST_REVERSE_FOREACH(list, l, tw) - { - if (tw->layer < 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_parent->native_win), cleanup); - tw_below = tw; - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_child->native_win), cleanup); - tw_below = tw; - pass_count++; - continue; - } - else - { - if (tw->layer > 200) - { - EINA_SAFETY_ON_FALSE_GOTO((tw_below->native_win == tw_main->native_win), cleanup); - pass_count++; - } - else - { - tw_below = tw; - continue; - } - } - break; - } - // check the tw_below if there is no window over 200 layer. - if (tw == NULL) - { - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 2), cleanup); - EINA_SAFETY_ON_NULL_GOTO(tw_below, cleanup); - EINA_SAFETY_ON_FALSE_GOTO((tw_below->native_win == tw_main->native_win), cleanup); - pass_count++; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_transient_for_post_run(tc); - _tc_transient_for_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0203_transient_for_stack_above(E_TC *tc) -{ - E_TC_Win *tw, *tw_main, *tw_parent, *tw_child; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count = 0; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_transient_for_pre_run(tc); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_main = tc->data->tw; - tw_parent = tc->data->tw_parent; - tw_child = tc->data->tw_child; - - // Expected stack result: - // [Top] tw_main -> tw_child -> tw_parent [Bottom] - - res = _tc_transient_for_win_register(tc, tw_parent); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - e_test_runner_req_win_stack_set(tc->runner, tw_parent, tw_main, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_ABOVE); - - // Expected stack result: - // [Top] tw_child -> tw_parent -> tw_main [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->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_child->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_parent->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_main->native_win), cleanup); - pass_count++; - } - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_transient_for_post_run(tc); - _tc_transient_for_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} - -Eina_Bool -tc_0204_transient_for_stack_below(E_TC *tc) -{ - E_TC_Win *tw, *tw_main, *tw_parent, *tw_child; - Eina_Bool res = EINA_FALSE; - Eina_List *list = NULL, *l; - int pass_count = 0; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_transient_for_pre_run(tc); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - tw_main = tc->data->tw; - tw_parent = tc->data->tw_parent; - tw_child = tc->data->tw_child; - - // Expected stack result: - // [Top] tw_main -> tw_child -> tw_parent [Bottom] - - res = _tc_transient_for_win_register(tc, tw_parent); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - // raise tw_parent - e_test_runner_req_win_stack_set(tc->runner, tw_parent, NULL, EINA_TRUE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_RAISE); - - // Expected stack result: - // [Top] tw_child -> tw_parent -> tw_main [Bottom] - - e_test_runner_req_win_stack_set(tc->runner, tw_parent, tw_main, EINA_FALSE); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_STACK_BELOW); - - // Expected stack result: - // [Top] tw_main -> tw_child -> tw_parent [Bottom] - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, cleanup); - - // bottom to top search - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->layer > 200) continue; - if (pass_count == 0) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_main->native_win), cleanup); - pass_count++; - continue; - } - else if (pass_count == 1) - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_child->native_win), cleanup); - pass_count++; - continue; - } - else - { - EINA_SAFETY_ON_FALSE_GOTO((tw->native_win == tw_parent->native_win), cleanup); - pass_count++; - } - break; - } - - EINA_SAFETY_ON_FALSE_GOTO((pass_count == 3), cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - _tc_transient_for_post_run(tc); - _tc_transient_for_shutdown(tc); - E_FREE_LIST(list, e_tc_win_del); - - return tc->passed; -} diff --git a/src/0300_notification.c b/src/0300_notification.c deleted file mode 100644 index ffac16a..0000000 --- a/src/0300_notification.c +++ /dev/null @@ -1,561 +0,0 @@ -#include -#include "e_test_runner.h" - -#define TW_W 400 -#define TW_H 400 - -struct _E_TC_Data -{ - E_TC_Win *tw_normal; - E_TC_Win *tw_noti1; - E_TC_Win *tw_noti2; -}; - -static void -_tc_shutdown(E_TC *tc) -{ - E_TC_Data *data = tc->data; - EINA_SAFETY_ON_NULL_RETURN(data); - - e_test_runner_req_win_deregister(tc->runner, data->tw_normal); - e_tc_win_del(data->tw_normal); - e_tc_win_del(data->tw_noti1); - e_tc_win_del(data->tw_noti2); - - E_FREE(data); - tc->data = NULL; -} - -static void -_tc_post_run(E_TC *tc) -{ - E_TC_Data *data = tc->data; - EINA_SAFETY_ON_NULL_RETURN(data); - - e_tc_win_hide(data->tw_normal); - e_tc_win_hide(data->tw_noti1); - e_tc_win_hide(data->tw_noti2); -} - -static Eina_Bool -_tc_pre_run(E_TC *tc, Eina_Bool usegeom) -{ - Eina_Bool res; - E_TC_Data *data = NULL; - - data = E_NEW(E_TC_Data, 1); - EINA_SAFETY_ON_NULL_RETURN_VAL(data, EINA_FALSE); - tc->data = data; - - data->tw_normal = e_tc_win_add(NULL, ELM_WIN_BASIC, - EINA_FALSE, "tw_normal", - 0, 0, TW_W, TW_H, usegeom, - 200, E_TC_WIN_COLOR_RED); - EINA_SAFETY_ON_NULL_GOTO(data->tw_normal, cleanup); - - data->tw_noti1 = e_tc_win_add(NULL, ELM_WIN_NOTIFICATION, - EINA_FALSE, "tw_noti1", - 0, 0, TW_W, TW_H, usegeom, - 200, E_TC_WIN_COLOR_GREEN); - EINA_SAFETY_ON_NULL_GOTO(data->tw_noti1, cleanup); - - data->tw_noti2 = e_tc_win_add(NULL, ELM_WIN_NOTIFICATION, - EINA_FALSE, "tw_noti2", - 0, 0, TW_W, TW_H, usegeom, - 200, E_TC_WIN_COLOR_BLUE); - EINA_SAFETY_ON_NULL_GOTO(data->tw_noti2, cleanup); - - res = e_test_runner_req_win_register(tc->runner, data->tw_normal); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - e_tc_win_geom_update(data->tw_normal); - e_tc_win_geom_update(data->tw_noti1); - e_tc_win_geom_update(data->tw_noti2); - - e_tc_win_show(data->tw_normal); - e_tc_win_show(data->tw_noti1); - e_tc_win_show(data->tw_noti2); - - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_CHANGED); - - e_test_runner_work(); - - return EINA_TRUE; - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return EINA_FALSE; -} - -static Eina_Bool -_tc_noti_level_set(E_TC_Win *tw, efl_util_notification_level_e level) -{ - int ret; - - ret = efl_util_set_notification_window_level(tw->elm_win, level); - EINA_SAFETY_ON_FALSE_RETURN_VAL(ret == EFL_UTIL_ERROR_NONE, EINA_FALSE); - - return EINA_TRUE; -} - -static Eina_Bool -_tc_noti_level_check(E_TC_Win *tw, efl_util_notification_level_e level) -{ - efl_util_notification_level_e value = -1; - int ret; - - ret = efl_util_get_notification_window_level(tw->elm_win, &value); - EINA_SAFETY_ON_FALSE_RETURN_VAL(ret == EFL_UTIL_ERROR_NONE, EINA_FALSE); - EINA_SAFETY_ON_FALSE_RETURN_VAL(value == level, EINA_FALSE); - - return EINA_TRUE; -} - -static Eina_Bool -_tc_check_stack(E_TC *tc, E_TC_Win *bottom, E_TC_Win *middle, E_TC_Win *top) -{ - Eina_List *list = NULL, *l; - int b_layer = 0, m_layer = 0, t_layer = 0; - E_TC_Win *tw; - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, failed); - - EINA_LIST_FOREACH(list, l, tw) - { - if (top->native_win == tw->native_win) - { - t_layer = tw->layer; - continue; - } - else if (middle->native_win == tw->native_win) - { - m_layer = tw->layer; - continue; - } - else if (bottom->native_win == tw->native_win) - { - b_layer = tw->layer; - continue; - } - } - - EINA_SAFETY_ON_FALSE_GOTO(b_layer <= m_layer, failed); - EINA_SAFETY_ON_FALSE_GOTO(m_layer <= t_layer, failed); - - E_FREE_LIST(list, e_tc_win_del); - return EINA_TRUE; - -failed: - E_FREE_LIST(list, e_tc_win_del); - return EINA_FALSE; -} - -static Eina_Bool -_tc_check_layer(E_TC *tc, E_TC_Win *win, E_Layer expected) -{ - Eina_List *list = NULL, *l = NULL; - int layer = 0; - E_TC_Win *tw = NULL; - Eina_Bool result = EINA_FALSE; - - list = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(list, failed); - - EINA_LIST_FOREACH(list, l, tw) - { - if (tw->native_win == win->native_win) - { - layer = tw->layer; - break; - } - } - - EINA_SAFETY_ON_FALSE_GOTO(layer == expected, failed); - - result = EINA_TRUE; - -failed: - E_FREE_LIST(list, e_tc_win_del); - return result; -} - -Eina_Bool -tc_0300_notification_level_default(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - E_TC_Data *data; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_TRUE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - data = tc->data; - - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_check(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return res; -} - -Eina_Bool -tc_0301_notification_level_medium(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - E_TC_Data *data; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_TRUE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - data = tc->data; - - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_check(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return res; -} - -Eina_Bool -tc_0302_notification_level_high(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - E_TC_Data *data; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_TRUE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - data = tc->data; - - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_check(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return res; -} - -Eina_Bool -tc_0303_notification_level_top(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - E_TC_Data *data; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_TRUE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - data = tc->data; - - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_TOP); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_check(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_TOP); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return res; -} - -Eina_Bool -tc_0304_notification_level_none(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - E_TC_Data *data; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_TRUE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - data = tc->data; - - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_TOP); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti1, data->tw_noti2); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_NONE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_layer(tc, data->tw_noti2, E_LAYER_CLIENT_NORMAL); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return res; -} - -Eina_Bool -tc_0305_notification_level_change(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - E_TC_Data *data; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_TRUE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - data = tc->data; - - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti1, data->tw_noti2); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_TOP); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti1, data->tw_noti2); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return res; -} - -Eina_Bool -tc_0306_notification_fullsize_level_default(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - E_TC_Data *data; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - data = tc->data; - - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_check(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return res; -} - -Eina_Bool -tc_0307_notification_fullsize_level_medium(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - E_TC_Data *data; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - data = tc->data; - - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_check(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return res; -} - -Eina_Bool -tc_0308_notification_fullsize_level_high(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - E_TC_Data *data; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - data = tc->data; - - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_check(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return res; -} - -Eina_Bool -tc_0309_notification_fullsize_level_top(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - E_TC_Data *data; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - data = tc->data; - - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_TOP); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_check(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_TOP); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return res; -} - -Eina_Bool -tc_0310_notification_fullsize_level_none(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - E_TC_Data *data; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - data = tc->data; - - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_TOP); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti1, data->tw_noti2); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_NONE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_layer(tc, data->tw_noti2, E_LAYER_CLIENT_NORMAL); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return res; -} - -Eina_Bool -tc_0311_notification_fullsize_level_change(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - E_TC_Data *data; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - res = _tc_pre_run(tc, EINA_FALSE); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - data = tc->data; - - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti1, data->tw_noti2); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_set(data->tw_noti1, EFL_UTIL_NOTIFICATION_LEVEL_HIGH); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti2, data->tw_noti1); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_noti_level_set(data->tw_noti2, EFL_UTIL_NOTIFICATION_LEVEL_TOP); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - res = _tc_check_stack(tc, data->tw_normal, data->tw_noti1, data->tw_noti2); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - -cleanup: - _tc_post_run(tc); - _tc_shutdown(tc); - - return res; -} diff --git a/src/Makefile.am b/src/Makefile.am index 60a4e49..5cf7dbd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,22 +2,32 @@ bin_PROGRAMS = e_test_runner e_test_runner_CPPFLAGS = \ -I. \ +-I$(includedir)/gtest \ @E_TEST_RUNNER_CFLAGS@ e_test_runner_LDADD = \ +-lgtest \ @E_TEST_RUNNER_LIBS@ +e_test_runner_TESTCASES = \ +testcase/1_easy.cpp \ +testcase/2_base_operation.cpp \ +testcase/3_base_operation_multi_wins.cpp \ +testcase/4_transient_for.cpp \ +testcase/5_notification.cpp + e_test_runner_SOURCES = \ -e_test_runner.c \ -e_test_runner.h \ -0000_easy.c \ -0100_base_operation.c \ -0150_base_operation_multi_wins.c \ -0200_transient_for.c \ -0300_notification.c \ -0400_tzsh.c \ -0500_rotation.c \ -0600_focus.c +e_test_main.cpp \ +e_test_event.h \ +e_test_event.cpp \ +e_test_win.h \ +e_test_win.cpp \ +e_test_util.h \ +testcase/1_easy.cpp \ +testcase/2_base_operation.cpp \ +testcase/3_base_operation_multi_wins.cpp \ +testcase/4_transient_for.cpp \ +testcase/5_notification.cpp MAINTAINERCLEANFILES = \ Makefile.in diff --git a/src/e_test_event.cpp b/src/e_test_event.cpp new file mode 100644 index 0000000..17e739c --- /dev/null +++ b/src/e_test_event.cpp @@ -0,0 +1,1046 @@ +#include "e_test_event.h" + +#define E_TEST_WORK_TIME 3.0 +#define E_TC_SIGN_WIN_INFO "usiiiiibbbiibbbbbi" + +/********************** + callbacks + **********************/ +/* callbacks - event */ +static void _cb_resource_id(void *data, + struct tizen_resource *tizen_resource, + uint32_t id) +{ + Ecore_Window *res_id = (Ecore_Window *)data; + + *res_id = id; + + elm_exit(); +} + +/* callbacks - method */ +static void _cb_method_win_info_get(void *data, const Eldbus_Message *msg, Eldbus_Pending *p); +static void _cb_method_win_info_list_get(void *data, const Eldbus_Message *msg, Eldbus_Pending *p); +static void _cb_method_window_register(void *data, const Eldbus_Message *msg, Eldbus_Pending *p); +static void _cb_method_zone_rotation_change(void *data, const Eldbus_Message *msg, Eldbus_Pending *p); + +/* callbacks - signal */ +static void _cb_signal_vis_changed(void *data, const Eldbus_Message *msg); +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 - timer */ +static Eina_Bool _cb_work_timeout(void *data); +static Eina_Bool _ev_wait_timeout(void *data); + +/********************** + listeners + **********************/ +static const struct tizen_resource_listener _e_test_tizen_resource_listener = +{ + _cb_resource_id, +}; + +/********************** + class EtEventLoop + **********************/ + +/* public methods */ +EtEventLoop::EtEventLoop() +{ + this->log_dom_ = -1; + + this->tizen_policy_ = NULL; + this->tizen_surface_ = NULL; + + this->Ev.expire_timer = NULL; + this->Ev.expect = E_TC_EVENT_TYPE_NONE; + this->Ev.response = E_TC_EVENT_TYPE_NONE; + + this->Dbus.conn = NULL; + this->Dbus.obj = NULL; + this->Dbus.proxy = NULL; +} + +EtEventLoop::~EtEventLoop() +{ + // TODO:: release resources + this->FreeLastWinInfoList(); + + if (this->tizen_policy_) + { + tizen_policy_destroy(this->tizen_policy_); + this->tizen_policy_ = NULL; + } + if (this->tizen_surface_) + { + tizen_surface_destroy(this->tizen_surface_); + this->tizen_surface_ = NULL; + } + + // deinit eldbus + if (this->Dbus.proxy) + { + eldbus_proxy_unref(this->Dbus.proxy); + this->Dbus.proxy = NULL; + } + if (this->Dbus.obj) + { + eldbus_object_unref(this->Dbus.obj); + this->Dbus.obj = NULL; + } + if (this->Dbus.conn) + { + eldbus_connection_unref(this->Dbus.conn); + this->Dbus.conn = NULL; + } +} + +Eina_Bool EtEventLoop::Init() +{ + Eina_Bool result = EINA_FALSE; + + this->log_dom_ = eina_log_domain_register("e-tc", EINA_COLOR_BLUE); + + // init tizen_extension protocol + result = GetTizenPolicy(); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + result = GetTizenSurface(); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + // init eldbus + eldbus_init(); + this->Dbus.conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM); + EINA_SAFETY_ON_NULL_RETURN_VAL(this->Dbus.conn, EINA_FALSE); + + this->Dbus.obj = eldbus_object_get(this->Dbus.conn, + "org.enlightenment.wm", + "/org/enlightenment/wm"); + EINA_SAFETY_ON_NULL_RETURN_VAL(this->Dbus.obj, EINA_FALSE); + + this->Dbus.proxy = eldbus_proxy_get(this->Dbus.obj, + "org.enlightenment.wm.Test"); + EINA_SAFETY_ON_NULL_RETURN_VAL(this->Dbus.proxy, EINA_FALSE); + + return EINA_TRUE; +} + +void EtEventLoop::Shutdown() +{ + eina_log_domain_unregister(this->log_dom_); + + this->FreeLastWinInfoList(); + + // deinit tizen_extension protocol + if (this->tizen_policy_) + { + tizen_policy_destroy(this->tizen_policy_); + this->tizen_policy_ = NULL; + } + if (this->tizen_surface_) + { + tizen_surface_destroy(this->tizen_surface_); + this->tizen_surface_ = NULL; + } + + // deinit eldbus + if (this->Dbus.proxy) + { + eldbus_proxy_unref(this->Dbus.proxy); + this->Dbus.proxy = NULL; + } + if (this->Dbus.obj) + { + eldbus_object_unref(this->Dbus.obj); + this->Dbus.obj = NULL; + } + if (this->Dbus.conn) + { + eldbus_connection_unref(this->Dbus.conn); + this->Dbus.conn = NULL; + } + eldbus_shutdown(); +} + +Eina_Bool EtEventLoop::RegisterWin(EtWin *tw) +{ + Eldbus_Pending *p = NULL; + Eina_Bool accepted = EINA_FALSE; + + p = eldbus_proxy_call(this->Dbus.proxy, + "RegisterWindow", + _cb_method_window_register, + &accepted, + -1, + "u", + tw->native_win); + EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + + elm_run(); + + return accepted; +} + +Eina_Bool EtEventLoop::DeregisterWin(EtWin *tw) +{ + Eldbus_Pending *p = NULL; + Eina_Bool accepted = EINA_FALSE; + + p = eldbus_proxy_call(this->Dbus.proxy, + "DeregisterWindow", + _cb_method_window_register, + &accepted, + -1, + "u", + tw->native_win); + EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + + elm_run(); + + return accepted; +} + +Eina_Bool EtEventLoop::SetWinStack(EtWin *tw, + EtWin *sibiling, + Eina_Bool above) +{ + Eldbus_Pending *p = NULL; + p = eldbus_proxy_call(this->Dbus.proxy, + "SetWindowStack", + NULL, + NULL, + -1, + "uui", + tw->native_win, + sibiling? sibiling->native_win : 0, + above); + EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE); + + return EINA_TRUE; +} + +Eina_Bool EtEventLoop::SetWinTransientFor(EtWin *tw_child, + EtWin *tw_parent, + Eina_Bool set) +{ + // TODO:: change to send dbus message + EINA_SAFETY_ON_NULL_RETURN_VAL(tw_child, EINA_FALSE); + + if (!this->tizen_policy_) + this->GetTizenPolicy(); + + if (set) + { + tizen_policy_set_transient_for(this->tizen_policy_, + tw_child->native_win, + tw_parent->native_win); + } + else + { + tizen_policy_unset_transient_for(this->tizen_policy_, + tw_child->native_win); + } + + return EINA_TRUE; +} + +Eina_Bool EtEventLoop::SetWinNotiLevel(EtWin *tw, + efl_util_notification_level_e level) +{ + // TODO:: change to send dbus message + Eina_Bool result = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); + + result = efl_util_set_notification_window_level(tw->elm_win, level); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result == EFL_UTIL_ERROR_NONE, EINA_FALSE); + + return EINA_TRUE; +} + +efl_util_notification_level_e EtEventLoop::GetWinNotiLevel(EtWin *tw) +{ + // TODO:: change to send dbus message + Eina_Bool result = EINA_FALSE; + efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EFL_UTIL_NOTIFICATION_LEVEL_NONE); + + result = efl_util_get_notification_window_level(tw->elm_win, &level); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result == EFL_UTIL_ERROR_NONE, EFL_UTIL_NOTIFICATION_LEVEL_NONE); + + return level; +} + +Eina_Bool EtEventLoop::SetZoneRotation(int angle) +{ + Eldbus_Pending *p = NULL; + Eina_Bool allowed = EINA_FALSE; + + p = eldbus_proxy_call(this->Dbus.proxy, + "ChangeZoneRotation", + _cb_method_zone_rotation_change, + &allowed, + -1, + "i", + angle); + EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + + elm_run(); + + return allowed; +} + +Eina_Bool EtEventLoop::GetWinInfo(EtWin *tw) +{ + Eldbus_Pending *p = NULL; + Ecore_Window win; + int retry = 10; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); + + win = tw->native_win; + retry = (int) win; + + while (retry) + { + p = eldbus_proxy_call(this->Dbus.proxy, + "GetWinInfo", + _cb_method_win_info_get, + tw, + -1, + "u", + win); + EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + + elm_run(); + + if ((tw->native_win == win) && (!tw->effect)) + return EINA_TRUE; + else + retry--; + } + + if (tw->native_win != win) + { + ERR("Something Wrong. Difference with quering window" + "and received window from server"); + tw->native_win = win; + } + + return EINA_FALSE; +} + +Eina_List *EtEventLoop::GetWinInfoList() +{ + Eldbus_Pending *p = NULL; + Window_Info_List *info_list = NULL; + EtWin *tw = NULL; + Eina_List *result = NULL; + + info_list = E_NEW(Window_Info_List, 1); + EINA_SAFETY_ON_NULL_RETURN_VAL(info_list, NULL); + + while (info_list) + { + p = eldbus_proxy_call(this->Dbus.proxy, + "GetWinsInfo", + _cb_method_win_info_list_get, + info_list, + -1, + ""); + EINA_SAFETY_ON_NULL_RETURN_VAL(p, NULL); + + elm_run(); + + if (info_list->retry) + { + info_list->retry = EINA_FALSE; + EINA_LIST_CAST_FREE(info_list->list, tw, EtWin*) + { + if (tw) + delete tw; + } + + continue; + } + + break; + } + + result = eina_list_clone(info_list->list); + E_FREE(info_list); + + this->FreeLastWinInfoList(); + this->last_win_info_list_ = result; + + return result; +} + +void EtEventLoop::FreeWinInfoList(Eina_List *list) +{ + EtWin *tw = NULL; + + EINA_SAFETY_ON_NULL_RETURN(list); + + if (this->last_win_info_list_ == list) + this->last_win_info_list_ = NULL; + + EINA_LIST_CAST_FREE(list, tw, EtWin*) + { + if (tw != NULL) + delete tw; + } + + list = NULL; +} + +Eina_Bool EtEventLoop::SetDpms(Eina_Bool on) +{ + Eldbus_Pending *p = NULL; + p = eldbus_proxy_call(this->Dbus.proxy, + "DPMS", + NULL, + NULL, + -1, + "u", + on); + EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + return EINA_TRUE; +} + +Eina_Bool EtEventLoop::FreezeEvent() +{ + Eldbus_Pending *p = NULL; + p = eldbus_proxy_call(this->Dbus.proxy, + "EventFreeze", + NULL, + NULL, + -1, + "u", + 1); + EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + return EINA_TRUE; +} + +Eina_Bool EtEventLoop::ThawEvent() +{ + Eldbus_Pending *p = NULL; + p = eldbus_proxy_call(this->Dbus.proxy, + "EventFreeze", + NULL, + NULL, + -1, + "u", + 0); + EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + return EINA_TRUE; +} + +Eina_Bool EtEventLoop::FeedMouseDown(int x, int y) +{ + Eldbus_Pending *p = NULL; + p = eldbus_proxy_call(this->Dbus.proxy, + "EventMouse", + NULL, + NULL, + -1, + "uii", + 0, + x, y); + EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + return EINA_TRUE; +} + +Eina_Bool EtEventLoop::FeedMouseMove(int x, int y) +{ + Eldbus_Pending *p = NULL; + p = eldbus_proxy_call(this->Dbus.proxy, + "EventMouse", + NULL, + NULL, + -1, + "uii", + 1, + x, y); + EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + return EINA_TRUE; +} + +Eina_Bool EtEventLoop::FeedMouseUp(int x, int y) +{ + Eldbus_Pending *p = NULL; + p = eldbus_proxy_call(this->Dbus.proxy, + "EventMouse", + NULL, + NULL, + -1, + "u", + 2, + x, y); + EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + return EINA_TRUE; +} + +Eina_Bool EtEventLoop::FeedKeyDown(const char *key) +{ + Eldbus_Pending *p = NULL; + p = eldbus_proxy_call(this->Dbus.proxy, + "EventKey", + NULL, + NULL, + -1, + "us", + 0, + key); + EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + return EINA_TRUE; +} + +Eina_Bool EtEventLoop::FeedKeyUp(const char *key) +{ + Eldbus_Pending *p = NULL; + p = eldbus_proxy_call(this->Dbus.proxy, + "EventKey", + NULL, + NULL, + -1, + "us", + 1, + key); + EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + return EINA_TRUE; +} + +void EtEventLoop::SetLastWinInfoList(Eina_List *list) +{ + EINA_SAFETY_ON_NULL_RETURN(list); + + this->FreeLastWinInfoList(); + + this->last_win_info_list_ = list; +} + +void EtEventLoop::FreeLastWinInfoList() +{ + if (this->last_win_info_list_) + this->FreeWinInfoList(this->last_win_info_list_); + + this->last_win_info_list_ = NULL; +} + +Eina_Bool EtEventLoop::WaitEvent(E_TC_Event_Type ev) +{ + Eldbus_Signal_Handler *sh; + Eina_Bool res = EINA_FALSE; + + EINA_SAFETY_ON_FALSE_RETURN_VAL((E_TC_EVENT_TYPE_NONE < ev), res); + EINA_SAFETY_ON_FALSE_RETURN_VAL((E_TC_EVENT_TYPE_MAX > ev), res); + + switch (ev) + { + case E_TC_EVENT_TYPE_VIS_ON: + case E_TC_EVENT_TYPE_VIS_OFF: + case E_TC_EVENT_TYPE_VIS_CHANGED: + sh = eldbus_proxy_signal_handler_add(this->Dbus.proxy, + "VisibilityChanged", + _cb_signal_vis_changed, + this); + EINA_SAFETY_ON_NULL_GOTO(sh, finish); + break; + + case E_TC_EVENT_TYPE_STACK_RAISE: + case E_TC_EVENT_TYPE_STACK_LOWER: + case E_TC_EVENT_TYPE_STACK_ABOVE: + case E_TC_EVENT_TYPE_STACK_BELOW: + sh = eldbus_proxy_signal_handler_add(this->Dbus.proxy, + "StackChanged", + _cb_signal_stack_changed, + this); + EINA_SAFETY_ON_NULL_GOTO(sh, finish); + break; + + case E_TC_EVENT_TYPE_WINDOW_ROTATION_CHANGE: + sh = eldbus_proxy_signal_handler_add(this->Dbus.proxy, + "WinRotationChanged", + _cb_signal_win_rot_changed, + this); + EINA_SAFETY_ON_NULL_GOTO(sh, finish); + break; + + case E_TC_EVENT_TYPE_FOCUS_CHANGED: + sh = eldbus_proxy_signal_handler_add(this->Dbus.proxy, + "FocusChanged", + _cb_signal_focus_changed, + this); + EINA_SAFETY_ON_NULL_GOTO(sh, finish); + break; + + default: + goto finish; + break; + } + + if (this->Ev.expire_timer) + ecore_timer_del(this->Ev.expire_timer); + + this->Ev.expect = ev; + this->Ev.response = E_TC_EVENT_TYPE_NONE; + this->Ev.expire_timer = ecore_timer_add(5.0, _ev_wait_timeout, this); + + elm_run(); + + if (this->Ev.expire_timer) + { + ecore_timer_del(this->Ev.expire_timer); + this->Ev.expire_timer = NULL; + } + + eldbus_signal_handler_del(sh); + + res = (this->Ev.response == this->Ev.expect); + EINA_SAFETY_ON_FALSE_GOTO(res, finish); + +finish: + this->Ev.expect = E_TC_EVENT_TYPE_NONE; + this->Ev.response = E_TC_EVENT_TYPE_NONE; + + return res; +} + +void EtEventLoop::Work() +{ + /* give a turn to deal with deferred job for E_TEST_WORK_TIME */ + ecore_timer_add(E_TEST_WORK_TIME, _cb_work_timeout, NULL); + elm_run(); +} + +void EtEventLoop::PrintWinInfoList() +{ + EtWin *tw = NULL; + Eina_List *l = NULL, *ll = NULL; + + printf("--------------------------------------------------------------------------------------------------------------------------\n"); + l = this->GetWinInfoList(); + EINA_LIST_CAST_FOREACH(l, ll, tw, EtWin*) + { + printf("%04d WinID:%5u alpha:%d %5d,%5d (%5dx%5d) vis(Win:%d Obj:%d Opaque:%2d Type:%2d Skip:%d) Icon:%d Focus(Win:%d Obj:%d) :: %20s\n", + tw->layer, + (unsigned int)tw->native_win, + tw->alpha, + tw->x, tw->y, tw->w, tw->h, + tw->vis.win, + tw->vis.obj, + tw->vis.opaque, + tw->vis.type, + tw->vis.skip, + tw->iconic, + tw->focus.win, + tw->focus.obj, + tw->name); + } + this->FreeWinInfoList(l); + printf("--------------------------------------------------------------------------------------------------------------------------\n"); +} + +Ecore_Window EtEventLoop::GetWinId(Evas_Object *elm_win) +{ + Ecore_Wl_Window *wlwin = NULL; + struct wl_surface *surf = NULL; + Ecore_Window id = 0; + struct tizen_resource *tzres = NULL; + + wlwin = elm_win_wl_window_get(elm_win); + EINA_SAFETY_ON_NULL_RETURN_VAL(wlwin, 0); + + surf = ecore_wl_window_surface_get(wlwin); + EINA_SAFETY_ON_NULL_RETURN_VAL(surf, 0); + + if (!this->tizen_surface_) + this->GetTizenSurface(); + + tzres = tizen_surface_get_tizen_resource(this->tizen_surface_, surf); + EINA_SAFETY_ON_NULL_RETURN_VAL(tzres, 0); + + tizen_resource_add_listener(tzres, + &_e_test_tizen_resource_listener, &id); + + elm_run(); + + if (tzres) tizen_resource_destroy(tzres); + + return id; +} + +Eina_Bool EtEventLoop::GetTizenPolicy() +{ + Eina_Inlist *globals = NULL; + Ecore_Wl_Global *global = NULL; + struct wl_registry *registry = NULL; + + if (!this->tizen_policy_) + { + registry = ecore_wl_registry_get(); + globals = ecore_wl_globals_get(); + + EINA_SAFETY_ON_NULL_RETURN_VAL(registry, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(globals, EINA_FALSE); + + EINA_INLIST_FOREACH(globals, global) + { + if (!strcmp(global->interface, "tizen_policy")) + { + this->tizen_policy_ = (struct tizen_policy *) + wl_registry_bind(registry, + global->id, + &tizen_policy_interface, + 7); + } + } + + EINA_SAFETY_ON_NULL_RETURN_VAL(this->tizen_policy_, EINA_FALSE); + } + + return EINA_TRUE; +} + +Eina_Bool EtEventLoop::GetTizenSurface() +{ + Eina_Inlist *globals = NULL; + Ecore_Wl_Global *global = NULL; + struct wl_registry *registry = NULL; + + if (!this->tizen_surface_) + { + registry = ecore_wl_registry_get(); + globals = ecore_wl_globals_get(); + + EINA_SAFETY_ON_NULL_RETURN_VAL(registry, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(globals, EINA_FALSE); + + EINA_INLIST_FOREACH(globals, global) + { + if (!strcmp(global->interface, "tizen_surface")) + { + this->tizen_surface_ = (struct tizen_surface *) + wl_registry_bind(registry, + global->id, + &tizen_surface_interface, + 1); + } + } + + EINA_SAFETY_ON_NULL_RETURN_VAL(this->tizen_surface_, EINA_FALSE); + } + + return EINA_TRUE; +} + +/* callbacks - method */ +static void _cb_method_win_info_get(void *data, + const Eldbus_Message *msg, + Eldbus_Pending *p) +{ + const char *name = NULL, *text = NULL, *wname = NULL; + EtWin *tw = NULL; + Eina_Bool res = EINA_FALSE; + + tw = (EtWin *)data; + + res = eldbus_message_error_get(msg, &name, &text); + EINA_SAFETY_ON_TRUE_GOTO(res, finish); + + res = eldbus_message_arguments_get + (msg, + E_TC_SIGN_WIN_INFO, + &tw->native_win, + &wname, + &tw->x, &tw->y, &tw->w, &tw->h, + &tw->layer, + &tw->effect, + &tw->vis.win, + &tw->vis.obj, + &tw->vis.opaque, + &tw->vis.type, + &tw->vis.skip, + &tw->iconic, + &tw->alpha, + &tw->focus.win, + &tw->focus.obj, + &tw->rot); + + if (wname) + { + // change window name from char * to Eina_Stringshare + if (tw->name) + eina_stringshare_del(tw->name); + tw->name = eina_stringshare_add(wname); + } + +finish: + if ((name) || (text)) + { + ERR("errname:%s errmsg:%s\n", name, text); + } + + elm_exit(); +} + +static void _cb_method_win_info_list_get(void *data, + const Eldbus_Message *msg, + Eldbus_Pending *p) +{ + const char *name = NULL, *text = NULL, *wname = NULL; + Eldbus_Message_Iter *array = NULL, *ec = NULL; + Ecore_Window target_win = 0; + Window_Info_List *info_list = (Window_Info_List *)data; + Eina_Bool res = EINA_FALSE, animating = EINA_FALSE; + + if (info_list == NULL) + goto finish; + + res = eldbus_message_error_get(msg, &name, &text); + EINA_SAFETY_ON_TRUE_GOTO(res, finish); + + res = eldbus_message_arguments_get(msg, "ua(" E_TC_SIGN_WIN_INFO ")", &target_win, &array); + EINA_SAFETY_ON_FALSE_GOTO(res, finish); + + while (eldbus_message_iter_get_and_next(array, 'r', &ec)) + { + EtWin *tw = new EtWin(); + if (!tw) continue; + + res = eldbus_message_iter_arguments_get( + ec, + E_TC_SIGN_WIN_INFO, + &tw->native_win, + &wname, + &tw->x, &tw->y, &tw->w, &tw->h, + &tw->layer, + &tw->effect, + &tw->vis.win, + &tw->vis.obj, + &tw->vis.opaque, + &tw->vis.type, + &tw->vis.skip, + &tw->iconic, + &tw->alpha, + &tw->focus.win, + &tw->focus.obj, + &tw->rot); + + if (wname) + { + // change name to eina_stringshare + if (tw->name) + { + WRN("Failed to get win info\n"); + delete tw; + continue; + } + tw->name = eina_stringshare_add(wname); + } + + if (tw->effect) + animating = EINA_TRUE; + + if (!res) + { + WRN("Failed to get win info\n"); + delete tw; + continue; + } + + info_list->list = eina_list_append(info_list->list, tw); + } + + if (animating) + info_list->retry = EINA_TRUE; + +finish: + if ((name) || (text)) + { + ERR("errname:%s errmsg:%s\n", name, text); + } + + elm_exit(); +} + +static void +_cb_method_window_register(void *data, + const Eldbus_Message *msg, + Eldbus_Pending *p) +{ + const char *name = NULL, *text = NULL; + Eina_Bool res = EINA_FALSE; + Eina_Bool *accepted = (Eina_Bool *)data; + + *accepted = EINA_FALSE; + + res = eldbus_message_error_get(msg, &name, &text); + EINA_SAFETY_ON_TRUE_GOTO(res, finish); + + res = eldbus_message_arguments_get(msg, "b", accepted); + +finish: + if ((name) || (text)) + { + ERR("errname: %s errmsg: %s\n", name, text); + } + + elm_exit(); +} + +static void _cb_method_zone_rotation_change(void *data, + const Eldbus_Message *msg, + Eldbus_Pending *p) +{ + const char *name = NULL, *text = NULL; + Eina_Bool res = EINA_FALSE; + Eina_Bool *allowed = (Eina_Bool *)data; + + *allowed = EINA_FALSE; + + res = eldbus_message_error_get(msg, &name, &text); + EINA_SAFETY_ON_TRUE_GOTO(res, finish); + + res = eldbus_message_arguments_get(msg, "b", allowed); + EINA_SAFETY_ON_FALSE_GOTO(res, finish); + EINA_SAFETY_ON_FALSE_GOTO(*allowed, finish); + +finish: + if ((name) || (text)) + { + ERR("errname: %s errmsg: %s\n", name, text); + } + + elm_exit(); +} + +static void _cb_signal_vis_changed(void *data, + const Eldbus_Message *msg) +{ + EtEventLoop *runner = (EtEventLoop *)data; + const char *name = NULL, *text = NULL; + Eina_Bool res = EINA_FALSE; + int vis = 0; + Ecore_Window id; + + res = eldbus_message_error_get(msg, &name, &text); + EINA_SAFETY_ON_TRUE_GOTO(res, finish); + + res = eldbus_message_arguments_get(msg, "ub", &id, &vis); + EINA_SAFETY_ON_FALSE_GOTO(res, finish); + + /* TODO */ + if (((E_TC_EVENT_TYPE_VIS_ON == runner->Ev.expect) && (vis)) || + ((E_TC_EVENT_TYPE_VIS_OFF == runner->Ev.expect) && (!vis)) || + (E_TC_EVENT_TYPE_VIS_CHANGED == runner->Ev.expect)) + { + runner->Ev.response = runner->Ev.expect; + elm_exit(); + } + +finish: + if ((name) || (text)) + { + ERR("errname:%s errmsg:%s\n", name, text); + } +} + +static void _cb_signal_stack_changed(void *data, + const Eldbus_Message *msg) +{ + EtEventLoop *runner = (EtEventLoop *)data; + const char *name = NULL, *text = NULL; + Eina_Bool res = EINA_FALSE; + + res = eldbus_message_error_get(msg, &name, &text); + EINA_SAFETY_ON_TRUE_GOTO(res, finish); + + /* TODO */ + if ((E_TC_EVENT_TYPE_STACK_RAISE <= runner->Ev.expect) && + (E_TC_EVENT_TYPE_STACK_BELOW >= runner->Ev.expect)) + { + runner->Ev.response = runner->Ev.expect; + elm_exit(); + } + +finish: + if ((name) || (text)) + { + ERR("errname:%s errmsg:%s\n", name, text); + } +} + +static void _cb_signal_win_rot_changed(void *data, + const Eldbus_Message *msg) +{ + EtEventLoop *runner = (EtEventLoop *)data; + const char *name = NULL, *text = NULL; + Eina_Bool res = EINA_FALSE; + int angle = 0; + Ecore_Window id; + + res = eldbus_message_error_get(msg, &name, &text); + EINA_SAFETY_ON_TRUE_GOTO(res, finish); + + /* TODO unused 'window id' and 'angle' */ + res = eldbus_message_arguments_get(msg, "ui", &id, &angle); + EINA_SAFETY_ON_FALSE_GOTO(res, finish); + + runner->Ev.response = runner->Ev.expect; + elm_exit(); + +finish: + if ((name) || (text)) + { + ERR("errname:%s errmsg:%s\n", name, text); + } +} + +static void _cb_signal_focus_changed(void *data, + const Eldbus_Message *msg) +{ + EtEventLoop *runner = (EtEventLoop *)data; + const char *name = NULL, *text = NULL; + Eina_Bool res = EINA_FALSE; + + res = eldbus_message_error_get(msg, &name, &text); + EINA_SAFETY_ON_TRUE_GOTO(res, finish); + + if (E_TC_EVENT_TYPE_FOCUS_CHANGED == runner->Ev.expect) + { + runner->Ev.response = runner->Ev.expect; + elm_exit(); + } + +finish: + if ((name) || (text)) + { + ERR("errname:%s errmsg:%s\n", name, text); + } +} + +static Eina_Bool _cb_work_timeout(void *data) +{ + elm_exit(); + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool _ev_wait_timeout(void *data) +{ + EtEventLoop *runner = (EtEventLoop *)data; + + runner->Ev.expire_timer = NULL; + runner->Ev.response = E_TC_EVENT_TYPE_TIMEOUT; + + ERR("ev:%d\n", runner->Ev.expect); + + elm_exit(); + + return ECORE_CALLBACK_DONE; +} + diff --git a/src/e_test_event.h b/src/e_test_event.h new file mode 100644 index 0000000..dea5e48 --- /dev/null +++ b/src/e_test_event.h @@ -0,0 +1,93 @@ +#ifndef __ET_EVENT_LOOP_H__ +#define __ET_EVENT_LOOP_H__ + +#include +#include + +#include "e_test_util.h" +#include "e_test_win.h" + +class EtEventLoop +{ + public: // TODO:: Change to private and add getter & setter + Eina_List *last_win_info_list_ = NULL; + + struct tizen_policy *tizen_policy_ = NULL; + struct tizen_surface *tizen_surface_ = NULL; + + int log_dom_ = -1; + + struct + { + Ecore_Timer *expire_timer; + E_TC_Event_Type expect; + E_TC_Event_Type response; + } Ev; + + struct + { + Eldbus_Connection *conn; + Eldbus_Proxy *proxy; + Eldbus_Object *obj; + } Dbus; + + public: + /* initializer */ + EtEventLoop(); + + /* deinitializer */ + ~EtEventLoop(); + + /* requests */ + Eina_Bool Init(); + void Shutdown(); + Eina_Bool RegisterWin(EtWin *tw); + Eina_Bool DeregisterWin(EtWin *tw); + Eina_Bool SetWinStack(EtWin *tw, + EtWin *sibiling, + Eina_Bool above); + Eina_Bool SetWinTransientFor(EtWin *tw_child, + EtWin *tw_parent, + Eina_Bool set); + Eina_Bool SetWinNotiLevel(EtWin *tw, + efl_util_notification_level_e level); + efl_util_notification_level_e GetWinNotiLevel(EtWin *tw); + Eina_Bool SetZoneRotation(int angle); + Eina_Bool GetWinInfo(EtWin *tw); + Eina_List *GetWinInfoList(); + void FreeWinInfoList(Eina_List *list); + Ecore_Window GetWinId(Evas_Object *elm_win); + Eina_Bool SetDpms(Eina_Bool on); + Eina_Bool FreezeEvent(); + Eina_Bool ThawEvent(); + Eina_Bool FeedMouseDown(int x, int y); + Eina_Bool FeedMouseMove(int x, int y); + Eina_Bool FeedMouseUp(int x, int y); + Eina_Bool FeedKeyDown(const char *key); + Eina_Bool FeedKeyUp(const char *key); + Eina_Bool HasLastWinInfoList() { return !!this->last_win_info_list_; }; + void SetLastWinInfoList(Eina_List *list); + void FreeLastWinInfoList(); + + /* events */ + Eina_Bool WaitEvent(E_TC_Event_Type ev); + + /* methods */ + void Work(); + void PrintWinInfoList(); + + /* getter & setter */ + Eldbus_Connection *GetEldbusConnection() { return this->Dbus.conn; }; + Eldbus_Proxy *GetEldbusProxy() { return this->Dbus.proxy; }; + Eldbus_Object *GetEldbusObject() { return this->Dbus.obj; }; + void SetEldbusConnection(Eldbus_Connection *conn) { this->Dbus.conn = conn; }; + void SetEldbusProxy(Eldbus_Proxy *proxy) { this->Dbus.proxy = proxy; }; + void SetEldbusObject(Eldbus_Object *obj) { this->Dbus.obj = obj; }; + int GetLogDomain() { return this->log_dom_; }; + + protected: + Eina_Bool GetTizenPolicy(); + Eina_Bool GetTizenSurface(); +}; + +#endif // end of __ET_EVENT_LOOP_H__ diff --git a/src/e_test_main.cpp b/src/e_test_main.cpp new file mode 100644 index 0000000..41b20fd --- /dev/null +++ b/src/e_test_main.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file e_test_main.cpp + * @author Window System + * @version 1.0 + * @brief Enlightenment Unit_test with gtest framework + */ + +#include "e_test_event.h" +#include + +using ::testing::Test; + +EtEventLoop *gLoop = NULL; + +int _GetLogDomain() { return gLoop->GetLogDomain(); } // wrapper func for EINA_LOG + +int +elm_main(int argc, char **argv) { + int ret = 0; + + gLoop = new EtEventLoop(); + gLoop->Init(); + + ::testing::InitGoogleTest(&argc, argv); + ret = RUN_ALL_TESTS(); + + gLoop->Shutdown(); + + delete gLoop; + + return ret; +} +ELM_MAIN(); diff --git a/src/e_test_runner.c b/src/e_test_runner.c deleted file mode 100644 index 8085b23..0000000 --- a/src/e_test_runner.c +++ /dev/null @@ -1,1282 +0,0 @@ -#include "e_test_runner.h" - -#define E_TEST_RUNNER_WORK_TIME 3.0 -#define E_TC_SIGN_WIN_INFO "usiiiiibbbiibbbbbi" - -int _log_dom = -1; - -struct tizen_policy *tizen_policy = NULL; -struct tizen_surface *tizen_surface = NULL; - -typedef struct { - Eina_List *list; - Eina_Bool retry; -} Window_Info_List; - -static void -_e_test_runner_cb_resource_id(void *data, - struct tizen_resource *tizen_resource EINA_UNUSED, - uint32_t id) -{ - Ecore_Window *res_id = data; - - *res_id = id; - - elm_exit(); -} - -static const struct tizen_resource_listener _tizen_resource_listener = -{ - _e_test_runner_cb_resource_id, -}; - -static Ecore_Window -_e_test_runner_window_id_get(Evas_Object *elm_win) -{ - Ecore_Wl_Window *wlwin; - struct wl_surface *surf; - Ecore_Window id = 0; - - Eina_Inlist *globals; - Ecore_Wl_Global *global; - struct wl_registry *registry; - - struct tizen_resource *tizen_resource = NULL; - - wlwin = elm_win_wl_window_get(elm_win); - if (!wlwin) return 0; - - surf = ecore_wl_window_surface_get(wlwin); - if (!surf) return 0; - - if (!tizen_surface) - { - registry = ecore_wl_registry_get(); - globals = ecore_wl_globals_get(); - - if (!registry || !globals) return 0; - - EINA_INLIST_FOREACH(globals, global) - { - if (!strcmp(global->interface, "tizen_surface")) - { - tizen_surface = - wl_registry_bind(registry, global->id, - &tizen_surface_interface, 1); - break; - } - } - - if (!tizen_surface) return 0; - } - - tizen_resource = tizen_surface_get_tizen_resource(tizen_surface, surf); - if (!tizen_resource) return 0; - tizen_resource_add_listener(tizen_resource, - &_tizen_resource_listener, &id); - - elm_run(); - - if (tizen_resource) tizen_resource_destroy(tizen_resource); - - return id; -} - -static void -_cb_method_win_info_get(void *data, - const Eldbus_Message *msg, - Eldbus_Pending *p EINA_UNUSED) -{ - const char *name = NULL, *text = NULL, *wname = NULL; - E_TC_Win *tw; - Eina_Bool res; - - tw = data; - - res = eldbus_message_error_get(msg, &name, &text); - EINA_SAFETY_ON_TRUE_GOTO(res, finish); - - res = eldbus_message_arguments_get - (msg, - E_TC_SIGN_WIN_INFO, - &tw->native_win, - &wname, - &tw->x, &tw->y, &tw->w, &tw->h, - &tw->layer, - &tw->effect, - &tw->vis.win, - &tw->vis.obj, - &tw->vis.opaque, - &tw->vis.type, - &tw->vis.skip, - &tw->iconic, - &tw->alpha, - &tw->focus.win, - &tw->focus.obj, - &tw->rot); - - if (wname) - { - if (tw->name) - eina_stringshare_del(tw->name); - tw->name = eina_stringshare_add(wname); - } - -finish: - if ((name) || (text)) - { - ERR("errname:%s errmsg:%s\n", name, text); - } - - elm_exit(); -} - -static void -_cb_method_win_info_list_get(void *data, - const Eldbus_Message *msg, - Eldbus_Pending *p EINA_UNUSED) -{ - const char *name = NULL, *text = NULL, *wname = NULL; - Eldbus_Message_Iter *array, *ec; - Ecore_Window target_win = 0; - Window_Info_List *info_list = data; - Eina_Bool res, animating = EINA_FALSE; - - if (!!!info_list) - goto finish; - - res = eldbus_message_error_get(msg, &name, &text); - EINA_SAFETY_ON_TRUE_GOTO(res, finish); - - res = eldbus_message_arguments_get(msg, "ua("E_TC_SIGN_WIN_INFO")", &target_win, &array); - EINA_SAFETY_ON_FALSE_GOTO(res, finish); - - while (eldbus_message_iter_get_and_next(array, 'r', &ec)) - { - E_TC_Win *tw = e_tc_win_info_add(); - if (!tw) continue; - - res = eldbus_message_iter_arguments_get - (ec, - E_TC_SIGN_WIN_INFO, - &tw->native_win, - &wname, - &tw->x, &tw->y, &tw->w, &tw->h, - &tw->layer, - &tw->effect, - &tw->vis.win, - &tw->vis.obj, - &tw->vis.opaque, - &tw->vis.type, - &tw->vis.skip, - &tw->iconic, - &tw->alpha, - &tw->focus.win, - &tw->focus.obj, - &tw->rot); - - if (wname) - { - if (tw->name) - eina_stringshare_del(tw->name); - tw->name = eina_stringshare_add(wname); - } - - if (tw->effect) - animating = EINA_TRUE; - - if (!res) - { - WRN("Failed to get win info\n"); - e_tc_win_del(tw); - continue; - } - - info_list->list = eina_list_append(info_list->list, tw); - } - - if (animating) - info_list->retry = EINA_TRUE; - - -finish: - if ((name) || (text)) - { - ERR("errname:%s errmsg:%s\n", name, text); - } - - elm_exit(); -} - -static void -_cb_method_window_register(void *data, - const Eldbus_Message *msg, - Eldbus_Pending *p EINA_UNUSED) -{ - const char *name = NULL, *text = NULL; - Eina_Bool res; - Eina_Bool *accepted = data; - - *accepted = EINA_FALSE; - - res = eldbus_message_error_get(msg, &name, &text); - EINA_SAFETY_ON_TRUE_GOTO(res, finish); - - res = eldbus_message_arguments_get(msg, "b", accepted); - EINA_SAFETY_ON_FALSE_GOTO(res, finish); - EINA_SAFETY_ON_FALSE_GOTO(*accepted, finish); - -finish: - if ((name) || (text)) - { - ERR("errname:%s errmsg:%s\n", name, text); - } - - elm_exit(); -} - -static void -_cb_method_window_deregister(void *data, - const Eldbus_Message *msg, - Eldbus_Pending *p EINA_UNUSED) -{ - const char *name = NULL, *text = NULL; - Eina_Bool res; - Eina_Bool *allowed = data; - - *allowed = EINA_FALSE; - - res = eldbus_message_error_get(msg, &name, &text); - EINA_SAFETY_ON_TRUE_GOTO(res, finish); - - res = eldbus_message_arguments_get(msg, "b", allowed); - EINA_SAFETY_ON_FALSE_GOTO(res, finish); - EINA_SAFETY_ON_FALSE_GOTO(*allowed, finish); - -finish: - if ((name) || (text)) - { - ERR("errname:%s errmsg:%s\n", name, text); - } - - elm_exit(); -} - -static void -_cb_method_zone_rotation_change(void *data, - const Eldbus_Message *msg, - Eldbus_Pending *p EINA_UNUSED) -{ - const char *name = NULL, *text = NULL; - Eina_Bool res; - Eina_Bool *allowed = data; - - *allowed = EINA_FALSE; - - res = eldbus_message_error_get(msg, &name, &text); - EINA_SAFETY_ON_TRUE_GOTO(res, finish); - - res = eldbus_message_arguments_get(msg, "b", allowed); - EINA_SAFETY_ON_FALSE_GOTO(res, finish); - EINA_SAFETY_ON_FALSE_GOTO(*allowed, finish); - -finish: - if ((name) || (text)) - { - ERR("errname:%s errmsg:%s\n", name, text); - } - - elm_exit(); -} - -static void -_cb_signal_vis_changed(void *data, - const Eldbus_Message *msg) -{ - E_Test_Runner *runner = data; - const char *name = NULL, *text = NULL; - Eina_Bool res; - int vis = 0; - Ecore_Window id; - - res = eldbus_message_error_get(msg, &name, &text); - EINA_SAFETY_ON_TRUE_GOTO(res, finish); - - res = eldbus_message_arguments_get(msg, "ub", &id, &vis); - EINA_SAFETY_ON_FALSE_GOTO(res, finish); - - /* TODO */ - if (((E_TC_EVENT_TYPE_VIS_ON == runner->ev.expect) && (vis)) || - ((E_TC_EVENT_TYPE_VIS_OFF == runner->ev.expect) && (!vis)) || - (E_TC_EVENT_TYPE_VIS_CHANGED == runner->ev.expect)) - { - runner->ev.response = runner->ev.expect; - elm_exit(); - } - -finish: - if ((name) || (text)) - { - ERR("errname:%s errmsg:%s\n", name, text); - } -} - -static void -_cb_signal_stack_changed(void *data, - const Eldbus_Message *msg) -{ - E_Test_Runner *runner = data; - const char *name = NULL, *text = NULL; - Eina_Bool res; - - res = eldbus_message_error_get(msg, &name, &text); - EINA_SAFETY_ON_TRUE_GOTO(res, finish); - - /* TODO */ - if ((E_TC_EVENT_TYPE_STACK_RAISE <= runner->ev.expect) && - (E_TC_EVENT_TYPE_STACK_BELOW >= runner->ev.expect)) - { - runner->ev.response = runner->ev.expect; - elm_exit(); - } - -finish: - if ((name) || (text)) - { - ERR("errname:%s errmsg:%s\n", name, text); - } -} - -static void -_cb_signal_win_rot_changed(void *data, - const Eldbus_Message *msg) -{ - E_Test_Runner *runner = data; - const char *name = NULL, *text = NULL; - Eina_Bool res; - int angle = 0; - Ecore_Window id; - - res = eldbus_message_error_get(msg, &name, &text); - EINA_SAFETY_ON_TRUE_GOTO(res, finish); - - /* TODO unused 'window id' and 'angle' */ - res = eldbus_message_arguments_get(msg, "ui", &id, &angle); - EINA_SAFETY_ON_FALSE_GOTO(res, finish); - - runner->ev.response = runner->ev.expect; - elm_exit(); - -finish: - if ((name) || (text)) - { - ERR("errname:%s errmsg:%s\n", name, text); - } -} - -static void -_cb_signal_focus_changed(void *data, - const Eldbus_Message *msg) -{ - E_Test_Runner *runner = data; - const char *name = NULL, *text = NULL; - Eina_Bool res = EINA_FALSE; - - res = eldbus_message_error_get(msg, &name, &text); - EINA_SAFETY_ON_TRUE_GOTO(res, finish); - - if (E_TC_EVENT_TYPE_FOCUS_CHANGED == runner->ev.expect) - { - runner->ev.response = runner->ev.expect; - elm_exit(); - } - -finish: - if ((name) || (text)) - { - ERR("errname:%s errmsg:%s\n", name, text); - } -} - -static Eina_Bool -_cb_work_time_out(void *data EINA_UNUSED) -{ - elm_exit(); - return ECORE_CALLBACK_CANCEL; -} - -static Eina_Bool -_ev_wait_timeout(void *data) -{ - E_Test_Runner *runner = data; - - runner->ev.expire_timer = NULL; - runner->ev.response = E_TC_EVENT_TYPE_TIMEOUT; - - ERR("ev:%d\n", runner->ev.expect); - - elm_exit(); - - return ECORE_CALLBACK_DONE; -} - -Eina_Bool -e_test_runner_req_win_register(E_Test_Runner *runner, - E_TC_Win *tw) -{ - Eldbus_Pending *p; - Eina_Bool accepted = EINA_FALSE; - - p = eldbus_proxy_call(runner->dbus.proxy, - "RegisterWindow", - _cb_method_window_register, - &accepted, - -1, - "u", - tw->native_win); - EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); - - elm_run(); - - return accepted; -} - -Eina_Bool -e_test_runner_req_win_deregister(E_Test_Runner *runner, - E_TC_Win *tw) -{ - Eldbus_Pending *p; - Eina_Bool allowed = EINA_FALSE; - - p = eldbus_proxy_call(runner->dbus.proxy, - "DeregisterWindow", - _cb_method_window_deregister, - &allowed, - -1, - "u", - tw->native_win); - EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); - - elm_run(); - - return allowed; -} - -Eina_Bool -e_test_runner_req_win_stack_set(E_Test_Runner *runner, - E_TC_Win *tw, - E_TC_Win *sibling, - Eina_Bool above) -{ - Eldbus_Pending *p; - p = eldbus_proxy_call(runner->dbus.proxy, - "SetWindowStack", - NULL, - NULL, - -1, - "uui", - tw->native_win, - sibling? sibling->native_win : 0, - above); - EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE); - - return EINA_TRUE; -} - -Eina_Bool -e_test_runner_req_zone_rotation_change(E_Test_Runner *runner, int angle) -{ - Eldbus_Pending *p; - Eina_Bool allowed = EINA_FALSE; - - p = eldbus_proxy_call(runner->dbus.proxy, - "ChangeZoneRotation", - _cb_method_zone_rotation_change, - &allowed, - -1, - "i", - angle); - EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); - - elm_run(); - - return allowed; -} - -Eina_Bool -e_test_runner_req_win_info_get(E_Test_Runner *runner, E_TC_Win *tw) -{ - Eldbus_Pending *p; - Ecore_Window win; - int retry = 10; - - EINA_SAFETY_ON_NULL_RETURN_VAL(runner, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); - - win = tw->native_win; - while (retry) - { - p = eldbus_proxy_call(runner->dbus.proxy, - "GetWinInfo", - _cb_method_win_info_get, - tw, - -1, - "u", - win); - EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); - - elm_run(); - - if ((tw->native_win == win) && (!tw->effect)) - return EINA_TRUE; - else - retry--; - } - - if (tw->native_win != win) - { - ERR("Something Wrong. Difference with querying window and received window from server"); - tw->native_win = win; - } - - return EINA_FALSE; -} - - -Eina_List * -e_test_runner_req_win_info_list_get(E_Test_Runner *runner) -{ - Eldbus_Pending *p; - Window_Info_List *info_list = NULL; - Eina_List *list = NULL; - - info_list = E_NEW(Window_Info_List, 1); - EINA_SAFETY_ON_NULL_RETURN_VAL(info_list, NULL); - - while (info_list) - { - p = eldbus_proxy_call(runner->dbus.proxy, - "GetWinsInfo", - _cb_method_win_info_list_get, - info_list, - -1, - ""); - EINA_SAFETY_ON_NULL_RETURN_VAL(p, NULL); - - elm_run(); - - if (info_list->retry) - { - E_TC_Win *tw; - info_list->retry = EINA_FALSE; - EINA_LIST_FREE(info_list->list, tw) - { - if (tw) - e_tc_win_del(tw); - } - - continue; - } - - break; - } - - list = eina_list_clone(info_list->list); - E_FREE(info_list); - - return list; -} - -void -e_test_runner_req_win_info_list_free(Eina_List *l) -{ - E_TC_Win *tw; - - EINA_SAFETY_ON_NULL_RETURN(l); - - EINA_LIST_FREE(l, tw) - e_tc_win_del(tw); -} - -Eina_Bool -e_test_runner_req_dpms_on(E_Test_Runner *runner) -{ - Eldbus_Pending *p; - p = eldbus_proxy_call(runner->dbus.proxy, "DPMS", - NULL, NULL, -1, - "u", 1); - EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE); - return EINA_TRUE; -} - -Eina_Bool -e_test_runner_req_dpms_off(E_Test_Runner *runner) -{ - Eldbus_Pending *p; - p = eldbus_proxy_call(runner->dbus.proxy, "DPMS", - NULL, NULL, -1, - "u", 0); - EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE); - return EINA_TRUE; -} - -Eina_Bool -e_test_runner_req_ev_freeze(E_Test_Runner *runner) -{ - Eldbus_Pending *p; - p = eldbus_proxy_call(runner->dbus.proxy, "EventFreeze", - NULL, NULL, -1, - "u", 1); - EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE); - return EINA_TRUE; -} - -Eina_Bool -e_test_runner_req_ev_thaw(E_Test_Runner *runner) -{ - Eldbus_Pending *p; - p = eldbus_proxy_call(runner->dbus.proxy, "EventFreeze", - NULL, NULL, -1, - "u", 0); - EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE); - return EINA_TRUE; -} - -Eina_Bool -e_test_runner_req_ev_feed_mouse_down(E_Test_Runner *runner, int x, int y) -{ - Eldbus_Pending *p; - p = eldbus_proxy_call(runner->dbus.proxy, "EventMouse", - NULL, NULL, -1, - "uii", 0, x, y); - EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE); - return EINA_TRUE; -} - -Eina_Bool -e_test_runner_req_ev_feed_mouse_move(E_Test_Runner *runner, int x, int y) -{ - Eldbus_Pending *p; - p = eldbus_proxy_call(runner->dbus.proxy, "EventMouse", - NULL, NULL, -1, - "uii", 1, x, y); - EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE); - return EINA_TRUE; -} - -Eina_Bool -e_test_runner_req_ev_feed_mouse_up(E_Test_Runner *runner, int x, int y) -{ - Eldbus_Pending *p; - p = eldbus_proxy_call(runner->dbus.proxy, "EventMouse", - NULL, NULL, -1, - "uii", 2, x, y); - EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE); - return EINA_TRUE; -} - -Eina_Bool -e_test_runner_req_ev_feed_key_down(E_Test_Runner *runner, const char *key) -{ - Eldbus_Pending *p; - p = eldbus_proxy_call(runner->dbus.proxy, "EventKey", - NULL, NULL, -1, - "us", 0, key); - EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE); - return EINA_TRUE; -} - -Eina_Bool -e_test_runner_req_ev_feed_key_up(E_Test_Runner *runner, const char *key) -{ - Eldbus_Pending *p; - p = eldbus_proxy_call(runner->dbus.proxy, "EventKey", - NULL, NULL, -1, - "us", 1, key); - EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE); - return EINA_TRUE; -} - -Eina_Bool -e_test_runner_ev_wait(E_Test_Runner *runner, - E_TC_Event_Type ev) -{ - Eldbus_Signal_Handler *sh; - Eina_Bool res = EINA_FALSE; - - EINA_SAFETY_ON_FALSE_RETURN_VAL((E_TC_EVENT_TYPE_NONE < ev), res); - EINA_SAFETY_ON_FALSE_RETURN_VAL((E_TC_EVENT_TYPE_MAX > ev), res); - - switch (ev) - { - case E_TC_EVENT_TYPE_VIS_ON: - case E_TC_EVENT_TYPE_VIS_OFF: - case E_TC_EVENT_TYPE_VIS_CHANGED: - sh = eldbus_proxy_signal_handler_add(runner->dbus.proxy, - "VisibilityChanged", - _cb_signal_vis_changed, - runner); - EINA_SAFETY_ON_NULL_GOTO(sh, finish); - break; - - case E_TC_EVENT_TYPE_STACK_RAISE: - case E_TC_EVENT_TYPE_STACK_LOWER: - case E_TC_EVENT_TYPE_STACK_ABOVE: - case E_TC_EVENT_TYPE_STACK_BELOW: - sh = eldbus_proxy_signal_handler_add(runner->dbus.proxy, - "StackChanged", - _cb_signal_stack_changed, - runner); - EINA_SAFETY_ON_NULL_GOTO(sh, finish); - break; - - case E_TC_EVENT_TYPE_WINDOW_ROTATION_CHANGE: - sh = eldbus_proxy_signal_handler_add(runner->dbus.proxy, - "WinRotationChanged", - _cb_signal_win_rot_changed, - runner); - EINA_SAFETY_ON_NULL_GOTO(sh, finish); - break; - - case E_TC_EVENT_TYPE_FOCUS_CHANGED: - sh = eldbus_proxy_signal_handler_add(runner->dbus.proxy, - "FocusChanged", - _cb_signal_focus_changed, - runner); - EINA_SAFETY_ON_NULL_GOTO(sh, finish); - break; - - default: - goto finish; - break; - } - - if (runner->ev.expire_timer) - ecore_timer_del(runner->ev.expire_timer); - - runner->ev.expect = ev; - runner->ev.response = E_TC_EVENT_TYPE_NONE; - runner->ev.expire_timer = ecore_timer_add(5.0, _ev_wait_timeout, runner); - - elm_run(); - - if (runner->ev.expire_timer) - { - ecore_timer_del(runner->ev.expire_timer); - runner->ev.expire_timer = NULL; - } - - eldbus_signal_handler_del(sh); - - res = (runner->ev.response == runner->ev.expect); - EINA_SAFETY_ON_FALSE_GOTO(res, finish); - -finish: - runner->ev.expect = E_TC_EVENT_TYPE_NONE; - runner->ev.response = E_TC_EVENT_TYPE_NONE; - - return res; -} - -void -e_test_runner_work(void) -{ - /* give a turn to deal with deferred job for E_TEST_RUNNER_WORK_TIME */ - ecore_timer_add(E_TEST_RUNNER_WORK_TIME, _cb_work_time_out, NULL); - elm_run(); -} - -void -e_test_runner_util_win_info_print(E_Test_Runner *runner) -{ - E_TC_Win *tw; - Eina_List *l, *ll; - - printf("--------------------------------------------------------------------------------------------------------------------------\n"); - l = e_test_runner_req_win_info_list_get(runner); - EINA_LIST_FOREACH(l, ll, tw) - { - printf("%04d WinID:%5u alpha:%d %5d,%5d (%5dx%5d) vis(Win:%d Obj:%d Opaque:%2d Type:%2d Skip:%d) Icon:%d Focus(Win:%d Obj:%d)\n", - tw->layer, - (unsigned int)tw->native_win, - tw->alpha, - tw->x, tw->y, tw->w, tw->h, - tw->vis.win, - tw->vis.obj, - tw->vis.opaque, - tw->vis.type, - tw->vis.skip, - tw->iconic, - tw->focus.win, - tw->focus.obj); - } - e_test_runner_req_win_info_list_free(l); - printf("--------------------------------------------------------------------------------------------------------------------------\n"); -} - -E_TC_Win * -e_tc_win_add(E_TC_Win *parent, - Elm_Win_Type type, - Eina_Bool alpha, - const char *name, - int x, int y, - int w, int h, - Eina_Bool usr_geom, - int layer, - E_TC_Win_Color color) -{ - E_TC_Win *tw = NULL; - Evas_Object *elm_win = NULL, *bg = NULL; - Evas_Object *p_elm_win = NULL; - int sw, sh; - - if (parent) p_elm_win = parent->elm_win; - - elm_win = elm_win_add(p_elm_win, name, type); - EINA_SAFETY_ON_NULL_GOTO(elm_win, err); - - if (alpha) elm_win_alpha_set(elm_win, EINA_TRUE); - - elm_win_title_set(elm_win, name); - elm_win_autodel_set(elm_win, EINA_FALSE); - elm_win_borderless_set(elm_win, EINA_TRUE); - if (usr_geom) - elm_win_aux_hint_add(elm_win, "wm.policy.win.user.geometry", "1"); - - bg = elm_bg_add(elm_win); - evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(elm_win, bg); - - switch (color) - { - case E_TC_WIN_COLOR_BLACK: elm_bg_color_set(bg, 0, 0, 0); break; - case E_TC_WIN_COLOR_WHITE: elm_bg_color_set(bg, 255, 255, 255); break; - case E_TC_WIN_COLOR_RED: elm_bg_color_set(bg, 255, 0, 0); break; - case E_TC_WIN_COLOR_GREEN: elm_bg_color_set(bg, 0, 255, 0); break; - case E_TC_WIN_COLOR_BLUE: elm_bg_color_set(bg, 0, 0, 255); break; - case E_TC_WIN_COLOR_YELLOW: elm_bg_color_set(bg, 255, 255, 0); break; - case E_TC_WIN_COLOR_CYAN: elm_bg_color_set(bg, 0, 255, 255); break; - case E_TC_WIN_COLOR_PURPLE: elm_bg_color_set(bg, 255, 0, 255); break; - default: elm_bg_color_set(bg, 255, 0, 0); break; - } - evas_object_show(bg); - - elm_win_screen_size_get(elm_win, NULL, NULL, &sw, &sh); - - tw = E_NEW(E_TC_Win, 1); - EINA_SAFETY_ON_NULL_RETURN_VAL(tw, NULL); - - tw->elm_win = elm_win; - tw->native_win = _e_test_runner_window_id_get(elm_win); - tw->name = eina_stringshare_add(name); - if (usr_geom) - { - tw->x = x; tw->y = y; - tw->w = w; tw->h = h; - } - else - { - tw->x = 0; tw->y = 0; - tw->w = sw; tw->h = sh; - } - tw->layer = layer; - tw->alpha = alpha; - - return tw; - -err: - evas_object_del(elm_win); - E_FREE(tw); - - return NULL; -} - -E_TC_Win * -e_tc_win_info_add(void) -{ - E_TC_Win *tw = NULL; - - tw = E_NEW(E_TC_Win, 1); - EINA_SAFETY_ON_NULL_RETURN_VAL(tw, NULL); - - return tw; -} - -void -e_tc_win_del(E_TC_Win *tw) -{ - EINA_SAFETY_ON_NULL_RETURN(tw); - - if (tw->elm_win) - evas_object_del(tw->elm_win); - - if (tw->name) - eina_stringshare_del(tw->name); - - E_FREE(tw); -} - -void -e_tc_win_geom_update(E_TC_Win *tw) -{ - evas_object_move(tw->elm_win, tw->x, tw->y); - evas_object_resize(tw->elm_win, tw->w, tw->h); -} - -void -e_tc_win_show(E_TC_Win *tw) -{ - EINA_SAFETY_ON_NULL_RETURN(tw); - - evas_object_show(tw->elm_win); -} - -void -e_tc_win_hide(E_TC_Win *tw) -{ - EINA_SAFETY_ON_NULL_RETURN(tw); - - evas_object_hide(tw->elm_win); -} - -Eina_Bool -e_tc_win_transient_for_set(E_TC_Win *tw_child, E_TC_Win *tw_parent, Eina_Bool set) -{ - Eina_Inlist *globals; - Ecore_Wl_Global *global; - struct wl_registry *registry; - - if (!tizen_policy) - { - registry = ecore_wl_registry_get(); - globals = ecore_wl_globals_get(); - - if (!registry || !globals) return EINA_FALSE; - - EINA_INLIST_FOREACH(globals, global) - { - if (!strcmp(global->interface, "tizen_policy")) - { - tizen_policy = - wl_registry_bind(registry, global->id, - &tizen_policy_interface, 7); - } - } - - if (!tizen_policy) return EINA_FALSE; - } - - if (set) - tizen_policy_set_transient_for(tizen_policy, - tw_child->native_win, - tw_parent->native_win); - else - tizen_policy_unset_transient_for(tizen_policy, - tw_child->native_win); - return EINA_TRUE; -} - -static E_TC * -_e_tc_add(unsigned int num, - const char *name, - Eina_Bool (*func)(E_TC*), - Eina_Bool expect, - E_Test_Runner *runner, - Eina_Bool all, - int chosen) -{ - E_TC *tc; - - tc = E_NEW(E_TC, 1); - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, NULL); - - tc->num = num; - tc->name = name; - tc->func = func; - tc->expect = expect; - tc->runner = runner; - - if ((!all) && (num != (unsigned int)chosen)) - tc->skip = EINA_TRUE; - - runner->tc_list = eina_list_append(runner->tc_list, tc); - - return tc; -} - -#undef TC_ADD -#define TC_ADD(num, name, func, expect) _e_tc_add(num, name, func, expect, runner, all, chosen) - -static void -_e_test_runner_init(E_Test_Runner *runner, - Eina_Bool all, - int chosen) -{ -#undef T_FUNC -#define T_FUNC(num_, test_) tc_000##num_##_##test_ - /* [0000 - 0099] test runner verification */ - TC_ADD( 0, "Base: Pass", T_FUNC( 0, base_pass ), 1); - TC_ADD( 1, "Base: Fail", T_FUNC( 1, base_fail ), 0); -#undef T_FUNC -#define T_FUNC(num_, test_) tc_00##num_##_##test_ - TC_ADD( 10, "DBus: Introspect", T_FUNC( 10, introspect ), 1); - TC_ADD( 11, "DBus: Window register", T_FUNC( 11, win_register ), 1); -#undef T_FUNC -#define T_FUNC(num_, test_) tc_0##num_##_##test_ - /* [0100 - 0199] window base operation */ - TC_ADD( 100, "Basic window: Show", T_FUNC( 100, win_show ), 1); - TC_ADD( 101, "Basic window: Stack", T_FUNC( 101, win_stack ), 1); - TC_ADD( 110, "Alpha window: Show", T_FUNC( 110, alpha_win_show ), 1); - TC_ADD( 111, "Alpha window: Stack", T_FUNC( 111, alpha_win_stack ), 1); - - TC_ADD( 150, "Multi window: Basic", T_FUNC( 150, multi_all_wins_basic ), 1); - TC_ADD( 151, "Multi window: 3 Show1", T_FUNC( 151, multi_all_wins_show1 ), 1); - TC_ADD( 152, "Multi window: 3 Show2", T_FUNC( 152, multi_all_wins_show2 ), 1); - TC_ADD( 153, "Multi window: 3 Show3", T_FUNC( 153, multi_all_wins_show3 ), 1); - TC_ADD( 154, "Multi window: 3 Raise1", T_FUNC( 154, multi_all_wins_raise1 ), 1); - TC_ADD( 155, "Multi window: 3 Raise2", T_FUNC( 155, multi_all_wins_raise2 ), 1); - TC_ADD( 156, "Multi window: 3 Stack Above1", T_FUNC( 156, multi_all_wins_stack_above1 ), 1); - TC_ADD( 157, "Multi window: 3 Stack Above2", T_FUNC( 157, multi_all_wins_stack_above2 ), 1); - TC_ADD( 158, "Multi window: 3 Stack Above3", T_FUNC( 158, multi_all_wins_stack_above3 ), 1); - TC_ADD( 159, "Multi window: 3 Lower1", T_FUNC( 159, multi_all_wins_lower1 ), 1); - TC_ADD( 160, "Multi window: 3 Lower2", T_FUNC( 160, multi_all_wins_lower2 ), 1); - - TC_ADD( 161, "Multi full window: Basic", T_FUNC( 161, multi_all_full_wins_basic ), 1); - TC_ADD( 162, "Multi full window: 3 Show1", T_FUNC( 162, multi_all_full_wins_show1 ), 1); - TC_ADD( 163, "Multi full window: 3 Show2", T_FUNC( 163, multi_all_full_wins_show2 ), 1); - TC_ADD( 164, "Multi full window: 3 Show3", T_FUNC( 164, multi_all_full_wins_show3 ), 1); - TC_ADD( 165, "Multi full window: 3 Raise1", T_FUNC( 165, multi_all_full_wins_raise1 ), 1); - TC_ADD( 166, "Multi full window: 3 Raise2", T_FUNC( 166, multi_all_full_wins_raise2 ), 1); - TC_ADD( 167, "Multi full window: 3 Stack Above1", T_FUNC( 167, multi_all_full_wins_stack_above1 ), 1); - TC_ADD( 168, "Multi full window: 3 Stack Above2", T_FUNC( 168, multi_all_full_wins_stack_above2 ), 1); - TC_ADD( 169, "Multi full window: 3 Stack Above3", T_FUNC( 169, multi_all_full_wins_stack_above3 ), 1); - TC_ADD( 170, "Multi full window: 3 Lower1", T_FUNC( 170, multi_all_full_wins_lower1 ), 1); - TC_ADD( 171, "Multi full window: 3 Lower2", T_FUNC( 171, multi_all_full_wins_lower2 ), 1); - - TC_ADD( 180, "Multi window: 2 Show1", T_FUNC( 180, multi_2wins_show1 ), 1); - TC_ADD( 181, "Multi window: 2 Show2", T_FUNC( 181, multi_2wins_show2 ), 1); - TC_ADD( 182, "Multi window: 2 Show3", T_FUNC( 182, multi_2wins_show3 ), 1); - - TC_ADD( 183, "Multi full window: 2 Show1", T_FUNC( 183, multi_full_2wins_show1 ), 1); - TC_ADD( 184, "Multi full window: 2 Show2", T_FUNC( 184, multi_full_2wins_show2 ), 1); - TC_ADD( 185, "Multi full window: 2 Show3", T_FUNC( 185, multi_full_2wins_show3 ), 1); - - /* [0200 - 0299] transient for */ - TC_ADD( 200, "Transient for: Basic", T_FUNC( 200, transient_for_basic ), 1); - TC_ADD( 201, "Transient for: Raise", T_FUNC( 201, transient_for_raise ), 1); - TC_ADD( 202, "Transient for: Lower", T_FUNC( 202, transient_for_lower ), 1); - TC_ADD( 203, "Transient for: Stack above", T_FUNC( 203, transient_for_stack_above ), 1); - TC_ADD( 204, "Transient for: Stack below", T_FUNC( 204, transient_for_stack_below ), 1); - - /* [0300 - 0399] notification */ - TC_ADD( 300, "Noti Level default", T_FUNC( 300, notification_level_default), 1); - TC_ADD( 301, "Noti Level medium", T_FUNC( 301, notification_level_medium ), 1); - TC_ADD( 302, "Noti Level high", T_FUNC( 302, notification_level_high ), 1); - TC_ADD( 303, "Noti Level top", T_FUNC( 303, notification_level_top ), 1); - TC_ADD( 304, "Noti Level none", T_FUNC( 304, notification_level_none ), 1); - TC_ADD( 305, "Noti Level Change", T_FUNC( 305, notification_level_change ), 1); - - TC_ADD( 306, "Fullsize Noti Level default", T_FUNC( 306, notification_fullsize_level_default), 1); - TC_ADD( 307, "Fullsize Noti Level medium", T_FUNC( 307, notification_fullsize_level_medium ), 1); - TC_ADD( 308, "Fullsize Noti Level high", T_FUNC( 308, notification_fullsize_level_high ), 1); - TC_ADD( 309, "Fullsize Noti Level top", T_FUNC( 309, notification_fullsize_level_top ), 1); - TC_ADD( 310, "Fullsize Noti Level none", T_FUNC( 310, notification_fullsize_level_none ), 1); - TC_ADD( 311, "Fullsize Noti Level Change", T_FUNC( 311, notification_fullsize_level_change ), 1); - - /* [0400 - 0499] tizen-ws-shell */ - TC_ADD( 400, "Screensaver: Basic", T_FUNC( 400, scrsaver_basic ), 1); - TC_ADD( 401, "Screensaver Manager: Basic", T_FUNC( 401, scrsaver_mng_basic ), 1); - - TC_ADD( 500, "Rotation: Available Rotation", T_FUNC( 500, rotation_available_rots ), 1); - - /* [0600 - 0699] focus */ - TC_ADD( 600, "Focus: Basic", T_FUNC( 600, focus_basic ), 1); - TC_ADD( 601, "Focus: lower", T_FUNC( 601, focus_lower ), 1); - TC_ADD( 602, "Focus: raise", T_FUNC( 602, focus_raise ), 1); - TC_ADD( 603, "Focus: destroy", T_FUNC( 603, focus_destroy ), 1); - TC_ADD( 604, "Focus: partial window basic", T_FUNC( 604, focus_partial_basic ), 1); -#undef T_FUNC -} - -static void -_e_test_runner_shutdown(E_Test_Runner *runner) -{ - E_TC *tc; - - EINA_LIST_FREE(runner->tc_list, tc) - { - E_FREE(tc); - } - - if (tizen_surface) tizen_surface_destroy(tizen_surface); - if (tizen_policy) tizen_policy_destroy(tizen_policy); - - tizen_surface = NULL; - tizen_policy = NULL; -} - -static void -_e_test_runner_run(E_Test_Runner *runner) -{ - Eina_List *l; - E_TC *tc; - Eina_Bool pass; - - EINA_LIST_FOREACH(runner->tc_list, l, tc) - { - if (tc->skip) continue; - - pass = tc->func(tc); - tc->passed = (pass == tc->expect); - - printf("TEST \"%s\" : %s\n", - tc->name, - tc->passed ? "PASS" : "FAIL"); - } -} - -static void -_e_test_runner_result(E_Test_Runner *runner) -{ - Eina_Strbuf *buf; - Eina_List *l; - E_TC *tc; - int skip_case = 0; - int pass_case = 0; - int fail_case = 0; - int total = 0; - - if (!(buf = eina_strbuf_new())) return; - - eina_strbuf_append(buf, "\n\n"); - eina_strbuf_append(buf, "==============================================\n"); - eina_strbuf_append(buf, "TEST CASE RESULT\n"); - eina_strbuf_append(buf, "==============================================\n"); - - EINA_LIST_FOREACH(runner->tc_list, l, tc) - { - eina_strbuf_append_printf(buf, - "[%04d] TEST \"%-30.30s\" : %s\n", - tc->num, - tc->name, - tc->skip ? "SKIP..." : - tc->passed ? "PASS" : "FAIL"); - - total++; - - tc->skip ? skip_case++ : - tc->passed ? pass_case++ : fail_case++; - } - - eina_strbuf_append(buf, "==============================================\n"); - eina_strbuf_append_printf(buf, "TOTAL: %4d Cases\n", total); - eina_strbuf_append_printf(buf, "SKIP : %4d Cases\n", skip_case); - eina_strbuf_append_printf(buf, "PASS : %4d Cases\n", pass_case); - eina_strbuf_append_printf(buf, "FAIL : %4d Cases\n", fail_case); - eina_strbuf_append(buf, "==============================================\n"); - - printf("%s", eina_strbuf_string_get(buf)); - eina_strbuf_free(buf); -} - -static void -_usage(const char *exec) -{ - printf("\n"); - printf("Usage: %s [OPTION]\n", exec); - printf("\n"); - printf("Options:\n"); - printf(" -h display this help and exit\n"); - printf(" -d display the list of test cases\n"); - printf(" -t num select and run a testcase\n"); - printf("\n"); -} - -static Eina_Bool -_opts_check(int argc, - char **argv, - Eina_Bool *all, - int *chosen) -{ - int tc; - - if (argc == 1) return EINA_TRUE; - - if (!strcmp(argv[1], "-h") || - !strcmp(argv[1], "-help") || - !strcmp(argv[1], "--help")) - { - goto usage; - } - else if (!strcmp(argv[1], "-d")) - { - /* TODO */ - return EINA_FALSE; - } - else if (!strcmp(argv[1], "-t")) - { - if (argc != 3) goto usage; - tc = atoi(argv[2]); - - *all = EINA_FALSE; - *chosen = tc; - return EINA_TRUE; - } - -usage: - _usage(argv[0]); - - return EINA_FALSE; -} - -EAPI_MAIN int -elm_main(int argc, - char **argv) -{ - E_Test_Runner *runner = NULL; - Eina_Bool r, all = EINA_TRUE; - int res, chosen = -1; - int ret = -1; - - r = _opts_check(argc, argv, &all, &chosen); - if (!r) goto err; - - runner = E_NEW(E_Test_Runner, 1); - EINA_SAFETY_ON_NULL_GOTO(runner, err); - - _log_dom = eina_log_domain_register("e-tc", EINA_COLOR_BLUE); - EINA_SAFETY_ON_FALSE_GOTO(_log_dom >= 0, err); - - res = eldbus_init(); - EINA_SAFETY_ON_FALSE_GOTO((res > 0), err); - - runner->dbus.conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM); - EINA_SAFETY_ON_NULL_GOTO(runner->dbus.conn, err); - - runner->dbus.obj = eldbus_object_get(runner->dbus.conn, - "org.enlightenment.wm", - "/org/enlightenment/wm"); - EINA_SAFETY_ON_NULL_GOTO(runner->dbus.obj, err); - - runner->dbus.proxy = eldbus_proxy_get(runner->dbus.obj, - "org.enlightenment.wm.Test"); - EINA_SAFETY_ON_NULL_GOTO(runner->dbus.proxy, err); - - _e_test_runner_init(runner, all, chosen); - _e_test_runner_run(runner); - _e_test_runner_result(runner); - _e_test_runner_shutdown(runner); - - eldbus_proxy_unref(runner->dbus.proxy); - eldbus_object_unref(runner->dbus.obj); - eldbus_connection_unref(runner->dbus.conn); - eldbus_shutdown(); - eina_log_domain_unregister(_log_dom); - - ret = 0; - -err: - E_FREE(runner); - return ret; -} -ELM_MAIN() diff --git a/src/e_test_runner.h b/src/e_test_runner.h deleted file mode 100644 index 78e79de..0000000 --- a/src/e_test_runner.h +++ /dev/null @@ -1,306 +0,0 @@ -#ifndef E_TC_MAIN_H -#define E_TC_MAIN_H - -#include "config.h" -#include -#include -#include -#include -#include - -extern int _log_dom; - -#ifdef ERR -# undef ERR -#endif -#define ERR(...) EINA_LOG_DOM_ERR(_log_dom, __VA_ARGS__) - -#ifdef DBG -# undef DBG -#endif -#define DBG(...) EINA_LOG_DOM_DBG(_log_dom, __VA_ARGS__) - -#ifdef INF -# undef INF -#endif -#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__) - -#ifdef WRN -# undef WRN -#endif -#define WRN(...) EINA_LOG_DOM_WARN(_log_dom, __VA_ARGS__) - -#ifdef CRI -# undef CRI -#endif -#define CRI(...) EINA_LOG_DOM_CRIT(_log_dom, __VA_ARGS__) - -#ifdef E_NEW -# undef E_NEW -#endif -# define E_NEW(s, n) (s *)calloc(n, sizeof(s)) - -#ifdef E_FREE -# undef E_FREE -#endif -# define E_FREE(p) do { free(p); p = NULL; } while (0) - -#ifdef E_FREE_LIST -# undef E_FREE_LIST -#endif -# define E_FREE_LIST(list, free) \ - do \ - { \ - void *_tmp_; \ - EINA_LIST_FREE(list, _tmp_) \ - { \ - free(_tmp_); \ - } \ - } \ - while (0) - -typedef enum _E_TC_Event_Type -{ - E_TC_EVENT_TYPE_NONE = 0, - E_TC_EVENT_TYPE_TIMEOUT, - E_TC_EVENT_TYPE_VIS_ON, - E_TC_EVENT_TYPE_VIS_OFF, - E_TC_EVENT_TYPE_VIS_CHANGED, - E_TC_EVENT_TYPE_STACK_RAISE, - E_TC_EVENT_TYPE_STACK_LOWER, - E_TC_EVENT_TYPE_STACK_ABOVE, - E_TC_EVENT_TYPE_STACK_BELOW, - E_TC_EVENT_TYPE_WINDOW_ROTATION_CHANGE, - E_TC_EVENT_TYPE_FOCUS_CHANGED, - E_TC_EVENT_TYPE_MAX -} E_TC_Event_Type; - -typedef enum _E_TC_Win_Color -{ - E_TC_WIN_COLOR_BLACK = 0, - E_TC_WIN_COLOR_WHITE, - E_TC_WIN_COLOR_RED, - E_TC_WIN_COLOR_GREEN, - E_TC_WIN_COLOR_BLUE, - E_TC_WIN_COLOR_YELLOW, - E_TC_WIN_COLOR_CYAN, - E_TC_WIN_COLOR_PURPLE, -} E_TC_Win_Color; - -/* NB: These types are originally defined in the enlightenment. - * But, we can't use original types in the header files of enlightenment, - * because e_test_runner needs to use tizen-extension-client-protocol that - * conflicts with tizen-extension-server-protocol enlightenment header had. - * - * Duplicated enum types: E_Layer, E_Visibility - */ -typedef enum _E_Layer -{ - E_LAYER_BOTTOM = -100, - E_LAYER_BG = -1, // zone bg stuff - E_LAYER_DESKTOP = 0, // desktop objects: fileman, gadgets, shelves - E_LAYER_DESKTOP_TOP = 10, // raised desktop objects: gadgets - E_LAYER_CLIENT_DESKTOP = 100, //shelves - E_LAYER_CLIENT_BELOW = 150, - E_LAYER_CLIENT_NORMAL = 200, - E_LAYER_CLIENT_ABOVE = 250, - E_LAYER_CLIENT_EDGE = 300, - E_LAYER_CLIENT_FULLSCREEN = 350, - E_LAYER_CLIENT_EDGE_FULLSCREEN = 400, - E_LAYER_CLIENT_POPUP = 450, - E_LAYER_CLIENT_TOP = 500, - E_LAYER_CLIENT_DRAG = 550, - E_LAYER_CLIENT_PRIO = 600, - E_LAYER_CLIENT_NOTIFICATION_LOW = 650, - E_LAYER_CLIENT_NOTIFICATION_NORMAL = 700, - E_LAYER_CLIENT_NOTIFICATION_HIGH = 750, - E_LAYER_CLIENT_NOTIFICATION_TOP = 800, - E_LAYER_CLIENT_ALERT_LOW = 850, - E_LAYER_CLIENT_ALERT = 900, - E_LAYER_CLIENT_ALERT_HIGH = 950, - E_LAYER_CLIENT_CURSOR = 990, - E_LAYER_POPUP = 999, // popups - E_LAYER_EFFECT = 1999, - E_LAYER_MENU = 5000, // menus - E_LAYER_DESKLOCK = 9999, // desklock - E_LAYER_MAX = 32767 // EVAS_LAYER_MAX -} E_Layer; - -typedef enum _E_Visibility -{ - E_VISIBILITY_UNKNOWN = -1, - E_VISIBILITY_UNOBSCURED = 0, - E_VISIBILITY_PARTIALLY_OBSCURED = 1, - E_VISIBILITY_FULLY_OBSCURED = 2, - E_VISIBILITY_PRE_UNOBSCURED = 3, -} E_Visibility; - -typedef struct _E_Test_Runner E_Test_Runner; -typedef struct _E_TC_Win E_TC_Win; -typedef struct _E_TC E_TC; -typedef struct _E_TC_Data E_TC_Data; - -struct _E_Test_Runner -{ - Eina_List *tc_list; // test suite - - struct - { - Ecore_Timer *expire_timer; - E_TC_Event_Type expect; - E_TC_Event_Type response; - } ev; - - struct - { - Eldbus_Connection *conn; - Eldbus_Proxy *proxy; - Eldbus_Object *obj; - } dbus; -}; - -struct _E_TC_Win -{ - Evas_Object *elm_win; // elm_win evas object - Eina_Bool animating; - - Ecore_Window native_win; // native window id - const char *name; // name of client window - int x, y, w, h; // geometry - int rot; - E_Layer layer; - Eina_Bool effect; - struct - { - Eina_Bool win; - Eina_Bool obj; - int opaque; - E_Visibility type; - Eina_Bool skip; - } vis; - Eina_Bool iconic; - Eina_Bool alpha; - struct - { - Eina_Bool win; - Eina_Bool obj; - } focus; -}; - -struct _E_TC -{ - const char *name; - unsigned int num; - Eina_Bool skip; - Eina_Bool (*func) (E_TC *tc); - Eina_Bool passed; - Eina_Bool expect; - E_Test_Runner *runner; - E_TC_Data *data; -}; - -Eina_Bool e_test_runner_req_win_register(E_Test_Runner *runner, E_TC_Win *tw); -Eina_Bool e_test_runner_req_win_deregister(E_Test_Runner *runner, E_TC_Win *tw); -Eina_Bool e_test_runner_req_win_info_get(E_Test_Runner *runner, E_TC_Win *tw); -Eina_List *e_test_runner_req_win_info_list_get(E_Test_Runner *runner); -void e_test_runner_req_win_info_list_free(Eina_List *l); -Eina_Bool e_test_runner_req_win_stack_set(E_Test_Runner *runner, E_TC_Win *tw, E_TC_Win *sibling, Eina_Bool above); -Eina_Bool e_test_runner_req_dpms_on(E_Test_Runner *runner); -Eina_Bool e_test_runner_req_dpms_off(E_Test_Runner *runner); -Eina_Bool e_test_runner_req_ev_freeze(E_Test_Runner *runner); -Eina_Bool e_test_runner_req_ev_thaw(E_Test_Runner *runner); -Eina_Bool e_test_runner_req_ev_feed_mouse_down(E_Test_Runner *runner, int x, int y); -Eina_Bool e_test_runner_req_ev_feed_mouse_move(E_Test_Runner *runner, int x, int y); -Eina_Bool e_test_runner_req_ev_feed_mouse_up(E_Test_Runner *runner, int x, int y); -Eina_Bool e_test_runner_req_ev_feed_key_down(E_Test_Runner *runner, const char *key); -Eina_Bool e_test_runner_req_ev_feed_key_up(E_Test_Runner *runner, const char *key); -Eina_Bool e_test_runner_req_zone_rotation_change(E_Test_Runner *runner, int angle); - -Eina_Bool e_test_runner_ev_wait(E_Test_Runner *runner, E_TC_Event_Type ev); - -E_TC_Win *e_tc_win_add(E_TC_Win *parent, Elm_Win_Type type, Eina_Bool alpha, const char *name, int x, int y, int w, int h, Eina_Bool usr_geom, int layer, E_TC_Win_Color color); -E_TC_Win *e_tc_win_info_add(void); -void e_tc_win_del(E_TC_Win *tw); -void e_tc_win_geom_update(E_TC_Win *tw); -void e_tc_win_show(E_TC_Win *tw); -void e_tc_win_hide(E_TC_Win *tw); -Eina_Bool e_tc_win_transient_for_set(E_TC_Win *tw_parent, E_TC_Win *tw_child, Eina_Bool set); -void e_test_runner_work(void); - -/* utils */ -void e_test_runner_util_win_info_print(E_Test_Runner *runner); - -/* test cases */ -Eina_Bool tc_0000_base_pass(E_TC *tc); -Eina_Bool tc_0001_base_fail(E_TC *tc); -Eina_Bool tc_0010_introspect(E_TC *tc); -Eina_Bool tc_0011_win_register(E_TC *tc); - -Eina_Bool tc_0100_win_show(E_TC *tc); -Eina_Bool tc_0101_win_stack(E_TC *tc); -Eina_Bool tc_0110_alpha_win_show(E_TC *tc); -Eina_Bool tc_0111_alpha_win_stack(E_TC *tc); - -Eina_Bool tc_0150_multi_all_wins_basic(E_TC *tc); -Eina_Bool tc_0151_multi_all_wins_show1(E_TC *tc); -Eina_Bool tc_0152_multi_all_wins_show2(E_TC *tc); -Eina_Bool tc_0153_multi_all_wins_show3(E_TC *tc); -Eina_Bool tc_0154_multi_all_wins_raise1(E_TC *tc); -Eina_Bool tc_0155_multi_all_wins_raise2(E_TC *tc); -Eina_Bool tc_0156_multi_all_wins_stack_above1(E_TC *tc); -Eina_Bool tc_0157_multi_all_wins_stack_above2(E_TC *tc); -Eina_Bool tc_0158_multi_all_wins_stack_above3(E_TC *tc); -Eina_Bool tc_0159_multi_all_wins_lower1(E_TC *tc); -Eina_Bool tc_0160_multi_all_wins_lower2(E_TC *tc); -Eina_Bool tc_0161_multi_all_full_wins_basic(E_TC *tc); -Eina_Bool tc_0162_multi_all_full_wins_show1(E_TC *tc); -Eina_Bool tc_0163_multi_all_full_wins_show2(E_TC *tc); -Eina_Bool tc_0164_multi_all_full_wins_show3(E_TC *tc); -Eina_Bool tc_0165_multi_all_full_wins_raise1(E_TC *tc); -Eina_Bool tc_0166_multi_all_full_wins_raise2(E_TC *tc); -Eina_Bool tc_0167_multi_all_full_wins_stack_above1(E_TC *tc); -Eina_Bool tc_0168_multi_all_full_wins_stack_above2(E_TC *tc); -Eina_Bool tc_0169_multi_all_full_wins_stack_above3(E_TC *tc); -Eina_Bool tc_0170_multi_all_full_wins_lower1(E_TC *tc); -Eina_Bool tc_0171_multi_all_full_wins_lower2(E_TC *tc); - - -Eina_Bool tc_0180_multi_2wins_show1(E_TC *tc); -Eina_Bool tc_0181_multi_2wins_show2(E_TC *tc); -Eina_Bool tc_0182_multi_2wins_show3(E_TC *tc); -Eina_Bool tc_0183_multi_full_2wins_show1(E_TC *tc); -Eina_Bool tc_0184_multi_full_2wins_show2(E_TC *tc); -Eina_Bool tc_0185_multi_full_2wins_show3(E_TC *tc); - - -Eina_Bool tc_0200_transient_for_basic(E_TC *tc); -Eina_Bool tc_0201_transient_for_raise(E_TC *tc); -Eina_Bool tc_0202_transient_for_lower(E_TC *tc); -Eina_Bool tc_0203_transient_for_stack_above(E_TC *tc); -Eina_Bool tc_0204_transient_for_stack_below(E_TC *tc); - -Eina_Bool tc_0300_notification_level_default(E_TC *tc); -Eina_Bool tc_0301_notification_level_medium(E_TC *tc); -Eina_Bool tc_0302_notification_level_high(E_TC *tc); -Eina_Bool tc_0303_notification_level_top(E_TC *tc); -Eina_Bool tc_0304_notification_level_none(E_TC *tc); -Eina_Bool tc_0305_notification_level_change(E_TC *tc); -Eina_Bool tc_0306_notification_fullsize_level_default(E_TC *tc); -Eina_Bool tc_0307_notification_fullsize_level_medium(E_TC *tc); -Eina_Bool tc_0308_notification_fullsize_level_high(E_TC *tc); -Eina_Bool tc_0309_notification_fullsize_level_top(E_TC *tc); -Eina_Bool tc_0310_notification_fullsize_level_none(E_TC *tc); -Eina_Bool tc_0311_notification_fullsize_level_change(E_TC *tc); - -Eina_Bool tc_0400_scrsaver_basic(E_TC *tc); -Eina_Bool tc_0401_scrsaver_mng_basic(E_TC *tc); - -Eina_Bool tc_0600_focus_basic(E_TC *tc); -Eina_Bool tc_0601_focus_lower(E_TC *tc); -Eina_Bool tc_0602_focus_raise(E_TC *tc); -Eina_Bool tc_0603_focus_destroy(E_TC *tc); -Eina_Bool tc_0604_focus_partial_basic(E_TC *tc); - -#include "0500_rotation.h" - -#endif diff --git a/src/e_test_util.h b/src/e_test_util.h new file mode 100644 index 0000000..793cc96 --- /dev/null +++ b/src/e_test_util.h @@ -0,0 +1,153 @@ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef E_TC_MAIN_H +#define E_TC_MAIN_H + +#include "config.h" +#include "eina_list_ext.h" +#include +#include +#include +#include +#include + +int _GetLogDomain(); + +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_GetLogDomain(), __VA_ARGS__) + +#ifdef DBG +# undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_GetLogDomain(), __VA_ARGS__) + +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_GetLogDomain(), __VA_ARGS__) + +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_GetLogDomain(), __VA_ARGS__) + +#ifdef CRI +# undef CRI +#endif +#define CRI(...) EINA_LOG_DOM_CRIT(_GetLogDomain(), __VA_ARGS__) + +#ifdef E_NEW +# undef E_NEW +#endif +# define E_NEW(s, n) (s *)calloc(n, sizeof(s)) + +#ifdef E_FREE +# undef E_FREE +#endif +# define E_FREE(p) do { free(p); p = NULL; } while (0) + +#ifdef E_FREE_LIST +# undef E_FREE_LIST +#endif +# define E_FREE_LIST(list, free) \ + do \ + { \ + void *_tmp_; \ + EINA_LIST_FREE(list, _tmp_) \ + { \ + free(_tmp_); \ + } \ + } \ + while (0) + +typedef enum _E_TC_Event_Type +{ + E_TC_EVENT_TYPE_NONE = 0, + E_TC_EVENT_TYPE_TIMEOUT, + E_TC_EVENT_TYPE_VIS_ON, + E_TC_EVENT_TYPE_VIS_OFF, + E_TC_EVENT_TYPE_VIS_CHANGED, + E_TC_EVENT_TYPE_STACK_RAISE, + E_TC_EVENT_TYPE_STACK_LOWER, + E_TC_EVENT_TYPE_STACK_ABOVE, + E_TC_EVENT_TYPE_STACK_BELOW, + E_TC_EVENT_TYPE_WINDOW_ROTATION_CHANGE, + E_TC_EVENT_TYPE_FOCUS_CHANGED, + E_TC_EVENT_TYPE_MAX +} E_TC_Event_Type; + +typedef enum _E_TC_Win_Color +{ + E_TC_WIN_COLOR_BLACK = 0, + E_TC_WIN_COLOR_WHITE, + E_TC_WIN_COLOR_RED, + E_TC_WIN_COLOR_GREEN, + E_TC_WIN_COLOR_BLUE, + E_TC_WIN_COLOR_YELLOW, + E_TC_WIN_COLOR_CYAN, + E_TC_WIN_COLOR_PURPLE, +} E_TC_Win_Color; + +/* NB: These types are originally defined in the enlightenment. + * But, we can't use original types in the header files of enlightenment, + * because e_test_data needs to use tizen-extension-client-protocol that + * conflicts with tizen-extension-server-protocol enlightenment header had. + * + * Duplicated enum types: E_Layer, E_Visibility + */ +typedef enum _E_Layer +{ + E_LAYER_BOTTOM = -100, + E_LAYER_BG = -1, // zone bg stuff + E_LAYER_DESKTOP = 0, // desktop objects: fileman, gadgets, shelves + E_LAYER_DESKTOP_TOP = 10, // raised desktop objects: gadgets + E_LAYER_CLIENT_DESKTOP = 100, //shelves + E_LAYER_CLIENT_BELOW = 150, + E_LAYER_CLIENT_NORMAL = 200, + E_LAYER_CLIENT_ABOVE = 250, + E_LAYER_CLIENT_EDGE = 300, + E_LAYER_CLIENT_FULLSCREEN = 350, + E_LAYER_CLIENT_EDGE_FULLSCREEN = 400, + E_LAYER_CLIENT_POPUP = 450, + E_LAYER_CLIENT_TOP = 500, + E_LAYER_CLIENT_DRAG = 550, + E_LAYER_CLIENT_PRIO = 600, + E_LAYER_CLIENT_NOTIFICATION_LOW = 650, + E_LAYER_CLIENT_NOTIFICATION_NORMAL = 700, + E_LAYER_CLIENT_NOTIFICATION_HIGH = 750, + E_LAYER_CLIENT_NOTIFICATION_TOP = 800, + E_LAYER_CLIENT_ALERT_LOW = 850, + E_LAYER_CLIENT_ALERT = 900, + E_LAYER_CLIENT_ALERT_HIGH = 950, + E_LAYER_CLIENT_CURSOR = 990, + E_LAYER_POPUP = 999, // popups + E_LAYER_EFFECT = 1999, + E_LAYER_MENU = 5000, // menus + E_LAYER_DESKLOCK = 9999, // desklock + E_LAYER_MAX = 32767 // EVAS_LAYER_MAX +} E_Layer; + +typedef enum _E_Visibility +{ + E_VISIBILITY_UNKNOWN = -1, + E_VISIBILITY_UNOBSCURED = 0, + E_VISIBILITY_PARTIALLY_OBSCURED = 1, + E_VISIBILITY_FULLY_OBSCURED = 2, + E_VISIBILITY_PRE_UNOBSCURED = 3, +} E_Visibility; + +typedef struct _Window_Info_List +{ + Eina_List *list; + Eina_Bool retry; +} Window_Info_List; + +#endif // end of E_TC_MAIN_H + +#ifdef __cplusplus +} +#endif diff --git a/src/e_test_win.cpp b/src/e_test_win.cpp new file mode 100644 index 0000000..191e6b1 --- /dev/null +++ b/src/e_test_win.cpp @@ -0,0 +1,101 @@ +#include "e_test_win.h" + +/********************** + class EtWin + **********************/ + +EtWin::EtWin() +{ + // nothing to do. you should use initializer with args. + this->elm_win = NULL; + this->animating = EINA_FALSE; + this->native_win = 0; +} + +EtWin::~EtWin() +{ + this->DeInit(); +} + +Eina_Bool EtWin::Init(EtWin *parent, + Elm_Win_Type type, + Eina_Bool alpha, + const char *name, + int x, int y, + int w, int h, + Eina_Bool usr_geom, + E_Layer layer, + E_TC_Win_Color color) +{ + Evas_Object *bg = NULL; + int screen_width = 0, screen_height = 0; + + this->parent = parent; + + this->elm_win = elm_win_add(NULL, name, type); + EINA_SAFETY_ON_NULL_GOTO(this->elm_win, error); + + if (alpha) + elm_win_alpha_set(this->elm_win, EINA_TRUE); + + elm_win_title_set(this->elm_win, name); + elm_win_autodel_set(this->elm_win, EINA_FALSE); + elm_win_borderless_set(this->elm_win, EINA_TRUE); + + if (usr_geom) + elm_win_aux_hint_add(elm_win, "wm.policy.win.user.geometry", "1"); + + bg = elm_bg_add(this->elm_win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(elm_win, bg); + + switch (color) + { + case E_TC_WIN_COLOR_BLACK: elm_bg_color_set(bg, 0, 0, 0); break; + case E_TC_WIN_COLOR_WHITE: elm_bg_color_set(bg, 255, 255, 255); break; + case E_TC_WIN_COLOR_RED: elm_bg_color_set(bg, 255, 0, 0); break; + case E_TC_WIN_COLOR_GREEN: elm_bg_color_set(bg, 0, 255, 0); break; + case E_TC_WIN_COLOR_BLUE: elm_bg_color_set(bg, 0, 0, 255); break; + case E_TC_WIN_COLOR_YELLOW: elm_bg_color_set(bg, 255, 255, 0); break; + case E_TC_WIN_COLOR_CYAN: elm_bg_color_set(bg, 0, 255, 255); break; + case E_TC_WIN_COLOR_PURPLE: elm_bg_color_set(bg, 255, 0, 255); break; + default: elm_bg_color_set(bg, 100, 100, 100); break; + } + evas_object_show(bg); + + elm_win_screen_size_get(this->elm_win, NULL, NULL, &screen_width, &screen_height); + + goto finish; + +error: + // TODO:: add error case + printf("ERROR OCCURED IN EtWin INITIALIZATION\n"); + return EINA_FALSE; + +finish: + // set information + this->animating = EINA_FALSE; + this->native_win = 0; // TODO:: get Ecore_Window from static get_win_id function + 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; + this->h = usr_geom? h : screen_height; + + return EINA_TRUE; +} + +void EtWin::DeInit() +{ + if (this->elm_win) + { + evas_object_del(this->elm_win); + this->elm_win = NULL; + } + + if (this->name) + { + eina_stringshare_del(name); + this->name = NULL; + } +} diff --git a/src/e_test_win.h b/src/e_test_win.h new file mode 100644 index 0000000..2e80d55 --- /dev/null +++ b/src/e_test_win.h @@ -0,0 +1,80 @@ +#ifndef __ET_WIN_H__ +#define __ET_WIN_H__ + +#include + +#include "e_test_util.h" + +class EtWin +{ + public: // TODO:: Change to private and add getter & setter + EtWin *parent = NULL; + Evas_Object *elm_win = NULL; + Eina_Bool animating = EINA_FALSE; + Ecore_Window native_win = 0; + const char *name = NULL; + int x = 0, y = 0, w = 0, h = 0; + int rot = 0; + E_Layer layer = E_LAYER_CLIENT_NORMAL; + Eina_Bool effect = EINA_FALSE; + struct + { + Eina_Bool win = EINA_FALSE; + Eina_Bool obj = EINA_FALSE; + int opaque = 0; + E_Visibility type = E_VISIBILITY_UNKNOWN; + Eina_Bool skip = EINA_FALSE; + } vis; + Eina_Bool iconic = EINA_FALSE; + Eina_Bool alpha = EINA_FALSE; + struct + { + Eina_Bool win = EINA_FALSE; + Eina_Bool obj = EINA_FALSE; + } focus; + + public: + EtWin(); + ~EtWin(); + + /* methods */ + Eina_Bool Init(EtWin *parent, + Elm_Win_Type type, + Eina_Bool alpha, + 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() + { + EINA_SAFETY_ON_NULL_RETURN(elm_win); + evas_object_move(elm_win, x, y); + evas_object_resize(elm_win, w, h); + } + void Show() + { + EINA_SAFETY_ON_NULL_RETURN(elm_win); + evas_object_show(elm_win); + } + void Hide() + { + EINA_SAFETY_ON_NULL_RETURN(elm_win); + evas_object_hide(elm_win); + } + + /* getter&setter */ + Evas_Object *GetElmWin() + { + return elm_win; + } + Ecore_Window GetNativeWin() + { + return native_win; + } + + protected: +}; + +#endif // end of __ET_WIN_H__ diff --git a/src/eina_list_ext.h b/src/eina_list_ext.h new file mode 100644 index 0000000..216747a --- /dev/null +++ b/src/eina_list_ext.h @@ -0,0 +1,56 @@ +/* + eina_list_ext.h + + This header is extension of EINA_LIST_FOREACH macro function. + It provides EINA_LIST_CAST_* macro functions to avoid compile error in g++ compiler. + + USAGE: + EINA_LIST_CAST_*(as,you,did, variable type) + { + for_loop_codes; + } + +*/ + +#include + +#ifndef __EINA_LIST_EXT_H__ +#define __EINA_LIST_EXT_H__ + +#define EINA_LIST_CAST_FOREACH(list, l, data, caster) \ + for (l = list, \ + data = (caster) eina_list_data_get(l); \ + l; \ + 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_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_REVERSE_FOREACH_SAFE(list, l, l_prev, data, caster) \ + for (l = eina_list_last(list), \ + l_prev = eina_list_prev(l), \ + data = (caster)eina_list_data_get(l); \ + l; \ + l = l_prev, \ + l_prev = eina_list_prev(l), \ + data = (caster)eina_list_data_get(l)) + +#define EINA_LIST_CAST_FREE(list, data, caster) \ + for (data = (caster)eina_list_data_get(list); \ + list; \ + list = eina_list_remove_list(list, list), \ + data = (caster)eina_list_data_get(list)) + +#endif diff --git a/src/0000_easy.c b/src/testcase/1_easy.cpp similarity index 62% rename from src/0000_easy.c rename to src/testcase/1_easy.cpp index 8a7600f..8428495 100644 --- a/src/0000_easy.c +++ b/src/testcase/1_easy.cpp @@ -1,11 +1,25 @@ -#include "e_test_runner.h" +#include +#include "e_test_event.h" + +#define _WIN_ID 0x123456 + +using ::testing::Test; + +extern EtEventLoop *gLoop; + +class TestcaseEasy : public ::testing::Test +{ + protected: + static void SetUpTestCase() {}; + static void TearDownTestCase() {}; +}; static void _cb_introspect(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED) { - E_TC *tc = data; + Eina_Bool *result = (Eina_Bool *)data; const char *arg, *name = NULL, *text = NULL; Eina_Bool res; @@ -37,35 +51,30 @@ _cb_introspect(void *data, goto finish; } - tc->passed = EINA_TRUE; + *result = EINA_TRUE; finish: - if (!tc->passed) ERR("errname:%s errmsg:%s\n", name, text); + if (*result == EINA_FALSE) + ERR("errname:%s errmsg:%s\n", name, text); elm_exit(); } -#define _WIN_ID 0x123456 - static void _cb_prop_registrant(void *data, const Eldbus_Message *msg, Eldbus_Pending *p EINA_UNUSED) { - E_TC *tc = data; + Eina_Bool *result = (Eina_Bool *)data; const char *name = NULL, *text = NULL; Eldbus_Message_Iter *variant = NULL; Ecore_Window win; Eina_Bool res; char *type; - if (!tc) - { - elm_exit(); - return; - } + EINA_SAFETY_ON_NULL_GOTO(result, finish); - tc->passed = EINA_FALSE; + *result = EINA_FALSE; res = eldbus_message_error_get(msg, &name, &text); EINA_SAFETY_ON_TRUE_GOTO(res, finish); @@ -82,10 +91,10 @@ _cb_prop_registrant(void *data, EINA_SAFETY_ON_FALSE_GOTO(res, finish); EINA_SAFETY_ON_FALSE_GOTO((win == _WIN_ID), finish); - tc->passed = EINA_TRUE; + *result = EINA_TRUE; finish: - if (!tc->passed) + if (!(*result)) { ERR("errname:%s errmsg:%s\n", name, text); } @@ -93,78 +102,61 @@ finish: elm_exit(); } -Eina_Bool -tc_0000_base_pass(E_TC *tc) +TEST_F(TestcaseEasy, base_pass) { - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + Eina_Bool result = EINA_TRUE; - tc->passed = EINA_TRUE; - - return tc->passed; + ASSERT_TRUE(result); } -Eina_Bool -tc_0001_base_fail(E_TC *tc) +TEST_F(TestcaseEasy, base_fail) { - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - tc->passed = EINA_FALSE; + Eina_Bool result = EINA_FALSE; - return tc->passed; + ASSERT_FALSE(result); } -Eina_Bool -tc_0010_introspect(E_TC *tc) +TEST_F(TestcaseEasy, introspect) { - Eldbus_Pending *p; + Eina_Bool result = EINA_FALSE; + Eldbus_Pending *p = NULL; + Eldbus_Object *obj = NULL; - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); + obj = gLoop->GetEldbusObject(); + ASSERT_TRUE(obj != NULL); - p = eldbus_object_introspect(tc->runner->dbus.obj, + p = eldbus_object_introspect(obj, _cb_introspect, - tc); - EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + &result); + ASSERT_TRUE(p != NULL); - elm_run(); + gLoop->Work(); - return tc->passed; + ASSERT_TRUE(result); } -Eina_Bool -tc_0011_win_register(E_TC *tc) +TEST_F(TestcaseEasy, win_register) { - Eldbus_Pending *p; - Eina_Bool res; - E_TC_Win *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eldbus_Pending *p = NULL; - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - tw = e_tc_win_info_add(); - EINA_SAFETY_ON_NULL_GOTO(tw, finish); + EtWin *tw = new EtWin(); + ASSERT_TRUE(tw != NULL); tw->native_win = _WIN_ID; - /* check RegisterWindow method */ - res = e_test_runner_req_win_register(tc->runner, tw); - EINA_SAFETY_ON_FALSE_GOTO(res, finish); + result = gLoop->RegisterWin(tw); + ASSERT_TRUE(result); - /* check whether registered window id is same */ - p = eldbus_proxy_property_get(tc->runner->dbus.proxy, + p = eldbus_proxy_property_get(gLoop->GetEldbusProxy(), "Registrant", _cb_prop_registrant, - tc); - EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + &result); + ASSERT_TRUE(p != NULL); - elm_run(); - EINA_SAFETY_ON_FALSE_RETURN_VAL(tc->passed, EINA_FALSE); + gLoop->Work(); + ASSERT_TRUE(result); - /* check DeregisterWindow method */ - res = e_test_runner_req_win_deregister(tc->runner, tw); - EINA_SAFETY_ON_FALSE_GOTO(res, finish); - - tc->passed = EINA_TRUE; - -finish: - e_tc_win_del(tw); - return tc->passed; + result = gLoop->DeregisterWin(tw); + ASSERT_TRUE(result); } diff --git a/src/testcase/2_base_operation.cpp b/src/testcase/2_base_operation.cpp new file mode 100644 index 0000000..38ce02c --- /dev/null +++ b/src/testcase/2_base_operation.cpp @@ -0,0 +1,133 @@ +#include +#include "e_test_event.h" + +using ::testing::Test; + +extern EtEventLoop *gLoop; + +class TestcaseBaseOperation : public ::testing::Test +{ + public: + TestcaseBaseOperation() + { + }; + ~TestcaseBaseOperation() + { + if (gLoop->HasLastWinInfoList()) + gLoop->FreeLastWinInfoList(); + + if (tw) + { + gLoop->DeregisterWin(tw); + tw->DeInit(); + delete tw; + } + }; + + protected: + EtWin *tw = NULL; + + static void SetUpTestCase() + { + }; + static void TearDownTestCase() + { + }; + + Eina_Bool InitTC(Eina_Bool alpha) + { + Eina_Bool result = EINA_FALSE; + + this->tw = new EtWin(); + this->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); + this->tw->native_win = gLoop->GetWinId(this->tw->elm_win); + + result = gLoop->RegisterWin(this->tw); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + this->tw->UpdateGeometry(); + this->tw->Show(); + + gLoop->WaitEvent(E_TC_EVENT_TYPE_VIS_ON); + + return EINA_TRUE; + }; +}; + +TEST_F(TestcaseBaseOperation, win_show) +{ + Eina_Bool result = EINA_FALSE; + + result = this->InitTC(EINA_FALSE); + ASSERT_TRUE(result); +} + +TEST_F(TestcaseBaseOperation, win_stack) +{ + EtWin *tw2 = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + + result = this->InitTC(EINA_FALSE); + ASSERT_TRUE(result); + + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw2, EtWin*) + { + if (tw2->layer > tw->layer) continue; + if (tw2->layer < tw->layer) break; + + if (!strncmp(tw2->name, tw->name, strlen(tw2->name))) + result = EINA_TRUE; + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_TRUE(result); +} + +TEST_F(TestcaseBaseOperation, alpha_win_show) +{ + Eina_Bool result = EINA_FALSE; + + result = this->InitTC(EINA_TRUE); + ASSERT_TRUE(result); +} + +TEST_F(TestcaseBaseOperation, alpha_win_stack) +{ + EtWin *tw2 = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + + result = this->InitTC(EINA_TRUE); + ASSERT_TRUE(result); + + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw2, EtWin*) + { + if (tw2->layer > tw->layer) continue; + if (tw2->layer < tw->layer) break; + + if (!strncmp(tw2->name, tw->name, strlen(tw2->name))) + result = EINA_TRUE; + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_TRUE(EINA_TRUE); +} + diff --git a/src/testcase/3_base_operation_multi_wins.cpp b/src/testcase/3_base_operation_multi_wins.cpp new file mode 100644 index 0000000..9826ae8 --- /dev/null +++ b/src/testcase/3_base_operation_multi_wins.cpp @@ -0,0 +1,1606 @@ +#include +#include "e_test_event.h" + +using ::testing::Test; + +extern EtEventLoop *gLoop; + +class TestcaseBaseMulti : public ::testing::Test +{ + public: + TestcaseBaseMulti() + { + }; + ~TestcaseBaseMulti() + { + if (gLoop->HasLastWinInfoList()) + gLoop->FreeLastWinInfoList(); + + if (tw_register) + gLoop->DeregisterWin(tw_register); + + if (tw_red) + delete tw_red; + + if (tw_blue) + delete tw_blue; + + if (tw_green) + delete tw_green; + }; + + protected: + EtWin *tw_red = NULL; + EtWin *tw_green = NULL; + EtWin *tw_blue = NULL; + + EtWin *tw_register = NULL; + + static void SetUpTestCase() + { + }; + static void TearDownTestCase() + { + }; + + Eina_Bool RegisterTCWin(EtWin *tw) + { + Eina_Bool result = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); + EINA_SAFETY_ON_TRUE_RETURN_VAL(tw == tw_register, EINA_TRUE); + + if (this->tw_register) + { + gLoop->DeregisterWin(this->tw_register); + this->tw_register = NULL; + } + + result = gLoop->RegisterWin(tw); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + this->tw_register = tw; + + return EINA_TRUE; + } + + Eina_Bool InitTC(Eina_Bool show_win, Eina_Bool use_geom) + { + this->tw_red = new EtWin(); + this->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(this->tw_red, EINA_FALSE); + this->tw_red->native_win = gLoop->GetWinId(this->tw_red->elm_win); + + if (show_win) + { + this->tw_red->UpdateGeometry(); + this->tw_red->Show(); + } + + this->tw_green = new EtWin(); + this->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(this->tw_green, EINA_FALSE); + this->tw_green->native_win = gLoop->GetWinId(this->tw_green->elm_win); + + if (show_win) + { + this->tw_green->UpdateGeometry(); + this->tw_green->Show(); + } + + this->tw_blue = new EtWin(); + this->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(this->tw_blue, EINA_FALSE); + this->tw_blue->native_win = gLoop->GetWinId(this->tw_blue->elm_win); + + if (show_win) + { + this->RegisterTCWin(this->tw_blue); + + this->tw_blue->UpdateGeometry(); + this->tw_blue->Show(); + + gLoop->WaitEvent(E_TC_EVENT_TYPE_VIS_ON); + } + + return EINA_TRUE; + }; + + Eina_Bool ShowTCWin(EtWin *tw) + { + Eina_Bool result = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); + + result = this->RegisterTCWin(tw); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + tw->UpdateGeometry(); + tw->Show(); + gLoop->WaitEvent(E_TC_EVENT_TYPE_VIS_ON); + + return EINA_TRUE; + } +}; + +TEST_F(TestcaseBaseMulti, multi_all_wins_basic) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_TRUE); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] Blue -> Green -> Red [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_wins_show1) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE, EINA_TRUE); + ASSERT_TRUE(result); + + // show red + result = this->ShowTCWin(this->tw_red); + ASSERT_TRUE(result); + + // show blue + result = this->ShowTCWin(this->tw_blue); + ASSERT_TRUE(result); + + // show green + result = this->ShowTCWin(this->tw_green); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] Green -> Blue -> Red [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_wins_show2) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE, EINA_TRUE); + ASSERT_TRUE(result); + + // show blue + result = this->ShowTCWin(this->tw_blue); + ASSERT_TRUE(result); + + // show red + result = this->ShowTCWin(this->tw_red); + ASSERT_TRUE(result); + + // show green + result = this->ShowTCWin(this->tw_green); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] Green -> Red -> Blue [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_wins_show3) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE, EINA_TRUE); + ASSERT_TRUE(result); + + // show green + result = this->ShowTCWin(this->tw_green); + ASSERT_TRUE(result); + + // show blue + result = this->ShowTCWin(this->tw_blue); + ASSERT_TRUE(result); + + // show red + result = this->ShowTCWin(this->tw_red); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] Red -> Blue -> Green [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_wins_raise1) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_TRUE); + ASSERT_TRUE(result); + + // Raise Red + gLoop->SetWinStack(tw_red, NULL, EINA_TRUE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Red -> Blue -> Green [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_wins_raise2) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_TRUE); + ASSERT_TRUE(result); + + // Raise Green + gLoop->SetWinStack(tw_green, NULL, EINA_TRUE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Green-> Blue -> Red [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_wins_stack_above1) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_TRUE); + ASSERT_TRUE(result); + + // Raise Red on the Green + gLoop->SetWinStack(tw_red, tw_green, EINA_TRUE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Blue -> Red -> Green [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_wins_stack_above2) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_TRUE); + ASSERT_TRUE(result); + + // Raise Blue on the Red + gLoop->SetWinStack(tw_blue, tw_red, EINA_TRUE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Green-> Blue -> Red [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_wins_stack_above3) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_TRUE); + ASSERT_TRUE(result); + + // Raise Red on the Blue + gLoop->SetWinStack(tw_red, tw_blue, EINA_TRUE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Green-> Blue -> Red [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_wins_lower1) +{ + EtWin *tw = NULL, *tw_above = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_TRUE); + ASSERT_TRUE(result); + + // Lower Blue + gLoop->SetWinStack(tw_blue, NULL, EINA_FALSE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Green -> Red -> ... -> Blue [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else + { + if (tw->layer < 200) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + } + else + { + tw_above = tw; + continue; + } + } + + break; + } + + // check the tw_above when there is no window under 200 layer + if (tw == NULL) + { + ASSERT_TRUE(tw_above != NULL); + ASSERT_EQ(tw_above->native_win, this->tw_blue->native_win); + pass_count++; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_wins_lower2) +{ + EtWin *tw = NULL, *tw_above = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_TRUE); + ASSERT_TRUE(result); + + // Lower Green + gLoop->SetWinStack(tw_green, NULL, EINA_FALSE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Blue -> Red -> ... -> Green [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else + { + if (tw->layer < 200) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + } + else + { + tw_above = tw; + continue; + } + } + + break; + } + + // check the tw_above when there is no window under 200 layer + if (tw == NULL) + { + ASSERT_TRUE(tw_above != NULL); + ASSERT_EQ(tw_above->native_win, this->tw_green->native_win); + pass_count++; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_full_wins_basic) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] Blue -> Green -> Red [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_full_wins_show1) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE, EINA_FALSE); + ASSERT_TRUE(result); + + // show red + result = this->ShowTCWin(this->tw_red); + ASSERT_TRUE(result); + + // show blue + result = this->ShowTCWin(this->tw_blue); + ASSERT_TRUE(result); + + // show green + result = this->ShowTCWin(this->tw_green); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] Green -> Blue -> Red [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_full_wins_show2) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE, EINA_FALSE); + ASSERT_TRUE(result); + + // show blue + result = this->ShowTCWin(this->tw_blue); + ASSERT_TRUE(result); + + // show red + result = this->ShowTCWin(this->tw_red); + ASSERT_TRUE(result); + + // show green + result = this->ShowTCWin(this->tw_green); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] Green -> Red -> Blue [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_full_wins_show3) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE, EINA_FALSE); + ASSERT_TRUE(result); + + // show green + result = this->ShowTCWin(this->tw_green); + ASSERT_TRUE(result); + + // show blue + result = this->ShowTCWin(this->tw_blue); + ASSERT_TRUE(result); + + // show red + result = this->ShowTCWin(this->tw_red); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] Red -> Blue -> Green [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_full_wins_raise1) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(result); + + // Raise Red + gLoop->SetWinStack(tw_red, NULL, EINA_TRUE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Red -> Blue -> Green [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_full_wins_raise2) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(result); + + // Raise Green + gLoop->SetWinStack(tw_green, NULL, EINA_TRUE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Green-> Blue -> Red [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_full_wins_stack_above1) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(result); + + // Raise Red on the Green + gLoop->SetWinStack(tw_red, tw_green, EINA_TRUE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Blue -> Red -> Green [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_full_wins_stack_above2) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(result); + + // Raise Blue on the Red + gLoop->SetWinStack(tw_blue, tw_red, EINA_TRUE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Green-> Blue -> Red [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_full_wins_stack_above3) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(result); + + // Raise Red on the Blue + gLoop->SetWinStack(tw_red, tw_blue, EINA_TRUE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Green-> Blue -> Red [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_full_wins_lower1) +{ + EtWin *tw = NULL, *tw_above = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(result); + + // Lower Blue + gLoop->SetWinStack(tw_blue, NULL, EINA_FALSE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Green -> Red -> ... -> Blue [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else + { + if (tw->layer < 200) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + } + else + { + tw_above = tw; + continue; + } + } + + break; + } + + // check the tw_above when there is no window under 200 layer + if (tw == NULL) + { + ASSERT_TRUE(tw_above != NULL); + ASSERT_EQ(tw_above->native_win, this->tw_blue->native_win); + pass_count++; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_all_full_wins_lower2) +{ + EtWin *tw = NULL, *tw_above = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(result); + + // Lower Green + gLoop->SetWinStack(tw_green, NULL, EINA_FALSE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + // Expected stack result: + // [Top] Blue -> Red -> ... -> Green [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else + { + if (tw->layer < 200) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + } + else + { + tw_above = tw; + continue; + } + } + + break; + } + + // check the tw_above when there is no window under 200 layer + if (tw == NULL) + { + ASSERT_TRUE(tw_above != NULL); + ASSERT_EQ(tw_above->native_win, this->tw_green->native_win); + pass_count++; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_2wins_show1) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE, EINA_TRUE); + ASSERT_TRUE(result); + + // show green + result = this->ShowTCWin(this->tw_green); + ASSERT_TRUE(result); + + // show red + result = this->ShowTCWin(this->tw_red); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] Red -> Green [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(2, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_2wins_show2) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE, EINA_TRUE); + ASSERT_TRUE(result); + + // show blue + result = this->ShowTCWin(this->tw_blue); + ASSERT_TRUE(result); + + // show green + result = this->ShowTCWin(this->tw_green); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] Green -> Blue [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(2, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_2wins_show3) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE, EINA_TRUE); + ASSERT_TRUE(result); + + // show red + result = this->ShowTCWin(this->tw_red); + ASSERT_TRUE(result); + + // show blue + result = this->ShowTCWin(this->tw_blue); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] Blue -> Red [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(2, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_full_2wins_show1) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE, EINA_FALSE); + ASSERT_TRUE(result); + + // show green + result = this->ShowTCWin(this->tw_green); + ASSERT_TRUE(result); + + // show red + result = this->ShowTCWin(this->tw_red); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] Red -> Green [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(2, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_full_2wins_show2) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE, EINA_FALSE); + ASSERT_TRUE(result); + + // show blue + result = this->ShowTCWin(this->tw_blue); + ASSERT_TRUE(result); + + // show green + result = this->ShowTCWin(this->tw_green); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] Green -> Blue [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_green->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(2, pass_count); +} + +TEST_F(TestcaseBaseMulti, multi_full_2wins_show3) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE, EINA_FALSE); + ASSERT_TRUE(result); + + // show red + result = this->ShowTCWin(this->tw_red); + ASSERT_TRUE(result); + + // show blue + result = this->ShowTCWin(this->tw_blue); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] Blue -> Red [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_blue->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_red->native_win); + pass_count++; + } + + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(2, pass_count); +} diff --git a/src/testcase/4_transient_for.cpp b/src/testcase/4_transient_for.cpp new file mode 100644 index 0000000..0b1f4cb --- /dev/null +++ b/src/testcase/4_transient_for.cpp @@ -0,0 +1,351 @@ +#include "e_test_event.h" + +using ::testing::Test; + +extern EtEventLoop *gLoop; + +class TestcaseTransientFor : public ::testing::Test +{ + public: + TestcaseTransientFor() + { + }; + ~TestcaseTransientFor() + { + if (gLoop->HasLastWinInfoList()) + gLoop->FreeLastWinInfoList(); + + if (tw_register) + gLoop->DeregisterWin(tw_register); + + if (tw_base) + delete tw_base; + + if (tw_parent) + delete tw_parent; + + if (tw_child) + delete tw_child; + }; + + protected: + EtWin *tw_base = NULL; + EtWin *tw_parent = NULL; + EtWin *tw_child = NULL; + + EtWin *tw_register = NULL; + + static void SetUpTestCase() + { + }; + static void TearDownTestCase() + { + }; + + Eina_Bool RegisterTCWin(EtWin *tw) + { + Eina_Bool result = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); + + if (this->tw_register) + { + gLoop->DeregisterWin(this->tw_register); + this->tw_register = NULL; + } + + result = gLoop->RegisterWin(tw); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + this->tw_register = tw; + + return EINA_TRUE; + }; + + Eina_Bool InitTC() + { + Eina_Bool result = EINA_FALSE; + + this->tw_parent = new EtWin(); + this->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(this->tw_parent, EINA_FALSE); + this->tw_parent->native_win = gLoop->GetWinId(this->tw_parent->elm_win); + + result = this->ShowTCWin(this->tw_parent); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + this->tw_child = new EtWin(); + this->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(this->tw_child, EINA_FALSE); + this->tw_child->native_win = gLoop->GetWinId(this->tw_child->elm_win); + + result = this->ShowTCWin(this->tw_child); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + this->tw_base = new EtWin(); + this->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(this->tw_base, EINA_FALSE); + this->tw_base->native_win = gLoop->GetWinId(this->tw_base->elm_win); + + result = this->ShowTCWin(this->tw_base); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + // set transient_for + result = gLoop->SetWinTransientFor(this->tw_child, + this->tw_parent, + EINA_TRUE); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + // TODO:: have to write this->work()? + + return EINA_TRUE; + }; + + Eina_Bool ShowTCWin(EtWin *tw) + { + Eina_Bool result = EINA_FALSE; + + result = this->RegisterTCWin(tw); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + tw->UpdateGeometry(); + tw->Show(); + gLoop->WaitEvent(E_TC_EVENT_TYPE_VIS_ON); + + return EINA_TRUE; + }; +}; + +TEST_F(TestcaseTransientFor, transient_for_basic) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] tw_base -> tw_child -> tw_parent [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_base->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_child->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_parent->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseTransientFor, transient_for_raise) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(); + ASSERT_TRUE(result); + + result = this->RegisterTCWin(this->tw_parent); + EXPECT_TRUE(result); + + // tw_parent raise + result = gLoop->SetWinStack(this->tw_parent, NULL, EINA_TRUE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] tw_child -> tw_parent -> tw_base [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_child->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_parent->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_base->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseTransientFor, transient_for_lower) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(); + ASSERT_TRUE(result); + + result = this->RegisterTCWin(this->tw_parent); + EXPECT_TRUE(result); + + // tw_parent raise for prepare lower + result = gLoop->SetWinStack(this->tw_parent, NULL, EINA_TRUE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + ASSERT_TRUE(result); + + // tw_parent lower + result = gLoop->SetWinStack(this->tw_parent, NULL, EINA_FALSE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_LOWER); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] tw_base -> ... -> tw_child -> tw_parent [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_base->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + if (tw->native_win != this->tw_child->native_win) + continue; // skip for find lower layer + ASSERT_EQ(tw->native_win, this->tw_child->native_win); + pass_count++; + continue; + } + else if (pass_count == 2) + { + ASSERT_EQ(tw->native_win, this->tw_parent->native_win); + pass_count++; + } + else + { + if (tw->layer < 200) + break; + else + // expected stack result is tw_parent is lowest window. + // so, it is failed testcase. + ASSERT_FALSE(EINA_TRUE); + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseTransientFor, transient_for_above) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + int pass_count = 0; + + result = this->InitTC(); + ASSERT_TRUE(result); + + result = this->RegisterTCWin(this->tw_parent); + EXPECT_TRUE(result); + + // tw_parent raise for prepare lower + result = gLoop->SetWinStack(this->tw_parent, this->tw_base, EINA_TRUE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_ABOVE); + ASSERT_TRUE(result); + + // Expected stack result: + // [Top] tw_child -> tw_parent -> tw_base [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + continue; + + if (pass_count == 0) + { + ASSERT_EQ(tw->native_win, this->tw_child->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_parent->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_base->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} diff --git a/src/testcase/5_notification.cpp b/src/testcase/5_notification.cpp new file mode 100644 index 0000000..ad46d6b --- /dev/null +++ b/src/testcase/5_notification.cpp @@ -0,0 +1,1181 @@ +#include "e_test_event.h" +#include + +using ::testing::Test; + +extern EtEventLoop *gLoop; + +class TestcaseNotification : public ::testing::Test +{ + public: + TestcaseNotification() + { + }; + ~TestcaseNotification() + { + if (tw_register) + gLoop->DeregisterWin(tw_register); + + if (tw_normal) + delete tw_normal; + + if (tw_noti1) + delete tw_noti1; + + if (tw_noti2) + delete tw_noti2; + }; + + 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 result = EINA_FALSE; + this->tw_normal = new EtWin(); + this->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(this->tw_normal, EINA_FALSE); + this->tw_normal->native_win = gLoop->GetWinId(this->tw_normal->elm_win); + + this->tw_normal->UpdateGeometry(); + this->tw_normal->Show(); + + this->tw_noti1 = new EtWin(); + this->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(this->tw_noti1, EINA_FALSE); + this->tw_noti1->native_win = gLoop->GetWinId(this->tw_noti1->elm_win); + + this->tw_noti1->UpdateGeometry(); + this->tw_noti1->Show(); + + this->tw_noti2 = new EtWin(); + this->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(this->tw_noti2, EINA_FALSE); + this->tw_noti2->native_win = gLoop->GetWinId(this->tw_noti2->elm_win); + + this->tw_noti2->UpdateGeometry(); + this->tw_noti2->Show(); + + // register window + result = this->RegisterTCWin(this->tw_normal); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + gLoop->WaitEvent(E_TC_EVENT_TYPE_VIS_ON); + + return EINA_TRUE; + }; + + Eina_Bool RegisterTCWin(EtWin *tw) + { + Eina_Bool result = EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); + + if (this->tw_register) + { + gLoop->DeregisterWin(this->tw_register); + this->tw_register = NULL; + } + + result = gLoop->RegisterWin(tw); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + this->tw_register = tw; + + return EINA_TRUE; + } +}; + +TEST_F(TestcaseNotification, notification_level_default) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE); + ASSERT_TRUE(result); + + // set tw_noti1 to notification layer + result = gLoop->SetWinNotiLevel(this->tw_noti1, + EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); + EXPECT_TRUE(result); + + // TODO:: add ev_wait for notification level + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + level = gLoop->GetWinNotiLevel(this->tw_noti1); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT, level); + + // Expected stack result: + // [Top] Noti1 -> Noti2 -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (pass_count == 0) + { + if (tw->layer > 200) + { + // check notification level + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_LOW) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + } + continue; + } + else if (tw->layer > 200) + { + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseNotification, notification_level_medium) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE); + ASSERT_TRUE(result); + + // set tw_noti1 to notification layer + result = gLoop->SetWinNotiLevel(this->tw_noti1, + EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); + EXPECT_TRUE(result); + + // TODO:: add ev_wait for notification level + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + level = gLoop->GetWinNotiLevel(this->tw_noti1); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM, level); + + // Expected stack result: + // [Top] Noti1 -> Noti2 -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (pass_count == 0) + { + if (tw->layer > 200) + { + // check notification level + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_NORMAL) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + } + continue; + } + else if (tw->layer > 200) + { + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseNotification, notification_level_high) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE); + ASSERT_TRUE(result); + + // set tw_noti1 to notification layer + result = gLoop->SetWinNotiLevel(this->tw_noti1, + EFL_UTIL_NOTIFICATION_LEVEL_HIGH); + EXPECT_TRUE(result); + + // TODO:: add ev_wait for notification level + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + level = gLoop->GetWinNotiLevel(this->tw_noti1); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_HIGH, level); + + // Expected stack result: + // [Top] Noti1 -> Noti2 -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (pass_count == 0) + { + if (tw->layer > 200) + { + // check notification level + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_HIGH) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + } + continue; + } + else if (tw->layer > 200) + { + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseNotification, notification_level_top) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE); + ASSERT_TRUE(result); + + // set tw_noti1 to notification layer + result = gLoop->SetWinNotiLevel(this->tw_noti1, + EFL_UTIL_NOTIFICATION_LEVEL_TOP); + EXPECT_TRUE(result); + + // TODO:: add ev_wait for notification level + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + level = gLoop->GetWinNotiLevel(this->tw_noti1); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_TOP, level); + + // Expected stack result: + // [Top] Noti1 -> Noti2 -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (pass_count == 0) + { + if (tw->layer > 200) + { + // check notification level + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_TOP) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + } + continue; + } + else if (tw->layer > 200) + { + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseNotification, notification_level_none) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE); + ASSERT_TRUE(result); + + // set tw_noti1 to notification high + result = gLoop->SetWinNotiLevel(this->tw_noti1, + EFL_UTIL_NOTIFICATION_LEVEL_HIGH); + EXPECT_TRUE(result); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + level = gLoop->GetWinNotiLevel(this->tw_noti1); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_HIGH, level); + + // set tw_noti2 to notification top + result = gLoop->SetWinNotiLevel(this->tw_noti2, + EFL_UTIL_NOTIFICATION_LEVEL_TOP); + EXPECT_TRUE(result); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + level = gLoop->GetWinNotiLevel(this->tw_noti2); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_TOP, level); + + // Expected stack result: + // [Top] Noti1 -> Noti2 -> ... -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + { + // check notification level + if (pass_count == 0) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_TOP) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_HIGH) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + continue; + } + else + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); + pass_count = 0; + + // set tw_noti2 to notification none + result = gLoop->SetWinNotiLevel(this->tw_noti2, + EFL_UTIL_NOTIFICATION_LEVEL_NONE); + EXPECT_TRUE(result); + + // TODO:: add ev_wait for notification level + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + level = gLoop->GetWinNotiLevel(this->tw_noti2); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_NONE, level); + + // Expected stack result: + // [Top] Noti1 -> ... -> Noti2 -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (pass_count == 0) + { + if (tw->layer > 200) + { + // check notification level + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_HIGH) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + } + continue; + } + else if (pass_count == 1) + { + if (tw->layer > 200) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseNotification, notification_level_change) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; + int pass_count = 0; + + result = this->InitTC(EINA_TRUE); + ASSERT_TRUE(result); + + // set tw_noti1 to notification default + result = gLoop->SetWinNotiLevel(this->tw_noti1, + EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); + EXPECT_TRUE(result); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + level = gLoop->GetWinNotiLevel(this->tw_noti1); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT, level); + + // set tw_noti2 to notification medium + result = gLoop->SetWinNotiLevel(this->tw_noti2, + EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); + EXPECT_TRUE(result); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + level = gLoop->GetWinNotiLevel(this->tw_noti2); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM, level); + + // Expected stack result: + // [Top] Noti2 -> Noti1 -> ... -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + { + // check notification level + if (pass_count == 0) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_NORMAL) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_LOW) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + continue; + } + else + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); + pass_count = 0; + + // set tw_noti1 to notification high + result = gLoop->SetWinNotiLevel(this->tw_noti1, + EFL_UTIL_NOTIFICATION_LEVEL_HIGH); + EXPECT_TRUE(result); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + level = gLoop->GetWinNotiLevel(this->tw_noti1); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_HIGH, level); + + // Expected stack result: + // [Top] Noti1 -> Noti2 -> ... -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + { + // check notification level + if (pass_count == 0) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_HIGH) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_NORMAL) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); + pass_count = 0; + + // set tw_noti2 to notification top + result = gLoop->SetWinNotiLevel(this->tw_noti2, + EFL_UTIL_NOTIFICATION_LEVEL_TOP); + EXPECT_TRUE(result); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + level = gLoop->GetWinNotiLevel(this->tw_noti2); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_TOP, level); + + // Expected stack result: + // [Top] Noti2 -> Noti1 -> ... -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + { + // check notification level + if (pass_count == 0) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_TOP) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_HIGH) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + continue; + } + else + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseNotification, notification_fullsize_level_default) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE); + ASSERT_TRUE(result); + + // set tw_noti1 to notification layer + result = gLoop->SetWinNotiLevel(this->tw_noti1, + EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); + EXPECT_TRUE(result); + + // TODO:: add ev_wait for notification level + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + level = gLoop->GetWinNotiLevel(this->tw_noti1); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT, level); + + // Expected stack result: + // [Top] Noti1 -> Noti2 -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (pass_count == 0) + { + if (tw->layer > 200) + { + // check notification level + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_LOW) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + } + continue; + } + else if (tw->layer > 200) + { + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseNotification, notification_fullsize_level_medium) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE); + ASSERT_TRUE(result); + + // set tw_noti1 to notification layer + result = gLoop->SetWinNotiLevel(this->tw_noti1, + EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); + EXPECT_TRUE(result); + + // TODO:: add ev_wait for notification level + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + level = gLoop->GetWinNotiLevel(this->tw_noti1); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM, level); + + // Expected stack result: + // [Top] Noti1 -> Noti2 -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (pass_count == 0) + { + if (tw->layer > 200) + { + // check notification level + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_NORMAL) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + } + continue; + } + else if (tw->layer > 200) + { + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseNotification, notification_fullsize_level_high) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE); + ASSERT_TRUE(result); + + // set tw_noti1 to notification layer + result = gLoop->SetWinNotiLevel(this->tw_noti1, + EFL_UTIL_NOTIFICATION_LEVEL_HIGH); + EXPECT_TRUE(result); + + // TODO:: add ev_wait for notification level + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + level = gLoop->GetWinNotiLevel(this->tw_noti1); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_HIGH, level); + + // Expected stack result: + // [Top] Noti1 -> Noti2 -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (pass_count == 0) + { + if (tw->layer > 200) + { + // check notification level + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_HIGH) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + } + continue; + } + else if (tw->layer > 200) + { + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseNotification, notification_fullsize_level_top) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE); + ASSERT_TRUE(result); + + // set tw_noti1 to notification layer + result = gLoop->SetWinNotiLevel(this->tw_noti1, + EFL_UTIL_NOTIFICATION_LEVEL_TOP); + EXPECT_TRUE(result); + + // TODO:: add ev_wait for notification level + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + level = gLoop->GetWinNotiLevel(this->tw_noti1); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_TOP, level); + + // Expected stack result: + // [Top] Noti1 -> Noti2 -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (pass_count == 0) + { + if (tw->layer > 200) + { + // check notification level + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_TOP) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + } + continue; + } + else if (tw->layer > 200) + { + continue; + } + else if (pass_count == 1) + { + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseNotification, notification_fullsize_level_none) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE); + ASSERT_TRUE(result); + + // set tw_noti1 to notification high + result = gLoop->SetWinNotiLevel(this->tw_noti1, + EFL_UTIL_NOTIFICATION_LEVEL_HIGH); + EXPECT_TRUE(result); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + level = gLoop->GetWinNotiLevel(this->tw_noti1); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_HIGH, level); + + // set tw_noti2 to notification top + result = gLoop->SetWinNotiLevel(this->tw_noti2, + EFL_UTIL_NOTIFICATION_LEVEL_TOP); + EXPECT_TRUE(result); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + level = gLoop->GetWinNotiLevel(this->tw_noti2); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_TOP, level); + + // Expected stack result: + // [Top] Noti1 -> Noti2 -> ... -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + { + // check notification level + if (pass_count == 0) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_TOP) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_HIGH) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + continue; + } + else + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); + pass_count = 0; + + // set tw_noti2 to notification none + result = gLoop->SetWinNotiLevel(this->tw_noti2, + EFL_UTIL_NOTIFICATION_LEVEL_NONE); + EXPECT_TRUE(result); + + // TODO:: add ev_wait for notification level + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + + level = gLoop->GetWinNotiLevel(this->tw_noti2); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_NONE, level); + + // Expected stack result: + // [Top] Noti1 -> ... -> Noti2 -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (pass_count == 0) + { + if (tw->layer > 200) + { + // check notification level + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_HIGH) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + } + continue; + } + else if (pass_count == 1) + { + if (tw->layer > 200) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + +TEST_F(TestcaseNotification, notification_fullsize_level_change) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + efl_util_notification_level_e level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; + int pass_count = 0; + + result = this->InitTC(EINA_FALSE); + ASSERT_TRUE(result); + + // set tw_noti1 to notification default + result = gLoop->SetWinNotiLevel(this->tw_noti1, + EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT); + EXPECT_TRUE(result); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + level = gLoop->GetWinNotiLevel(this->tw_noti1); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT, level); + + // set tw_noti2 to notification medium + result = gLoop->SetWinNotiLevel(this->tw_noti2, + EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM); + EXPECT_TRUE(result); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + level = gLoop->GetWinNotiLevel(this->tw_noti2); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM, level); + + // Expected stack result: + // [Top] Noti2 -> Noti1 -> ... -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + { + // check notification level + if (pass_count == 0) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_NORMAL) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_LOW) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + continue; + } + else + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); + pass_count = 0; + + // set tw_noti1 to notification high + result = gLoop->SetWinNotiLevel(this->tw_noti1, + EFL_UTIL_NOTIFICATION_LEVEL_HIGH); + EXPECT_TRUE(result); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + level = gLoop->GetWinNotiLevel(this->tw_noti1); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_HIGH, level); + + // Expected stack result: + // [Top] Noti1 -> Noti2 -> ... -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + { + // check notification level + if (pass_count == 0) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_HIGH) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_NORMAL) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); + pass_count = 0; + + // set tw_noti2 to notification top + result = gLoop->SetWinNotiLevel(this->tw_noti2, + EFL_UTIL_NOTIFICATION_LEVEL_TOP); + EXPECT_TRUE(result); + gLoop->WaitEvent(E_TC_EVENT_TYPE_STACK_RAISE); + level = gLoop->GetWinNotiLevel(this->tw_noti2); + ASSERT_EQ(EFL_UTIL_NOTIFICATION_LEVEL_TOP, level); + + // Expected stack result: + // [Top] Noti2 -> Noti1 -> ... -> Normal [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->layer > 200) + { + // check notification level + if (pass_count == 0) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_TOP) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti2->native_win); + pass_count++; + continue; + } + else if (pass_count == 1) + { + if (tw->layer != E_LAYER_CLIENT_NOTIFICATION_HIGH) + continue; + ASSERT_EQ(tw->native_win, this->tw_noti1->native_win); + pass_count++; + continue; + } + else + continue; + } + else + { + ASSERT_EQ(tw->native_win, this->tw_normal->native_win); + pass_count++; + } + break; + } + gLoop->FreeWinInfoList(list); + + ASSERT_EQ(3, pass_count); +} + -- 2.7.4 From 0c55e10055fba37de0553e9240d6c3bb3cddee79 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Fri, 2 Mar 2018 13:40:04 +0900 Subject: [PATCH 11/16] e-tizen-testcase: migrate other test cases with gtest framework Change-Id: I4fafbe5d8be8a39198a643df6ad04e97b5a0385f --- src/0400_tzsh.c | 256 -------------------- src/0500_rotation.c | 111 --------- src/0500_rotation.h | 10 - src/Makefile.am | 26 +- src/e_test_event.cpp | 72 ++++-- src/e_test_event.h | 5 + src/e_test_win.h | 4 +- src/testcase/{1_easy.cpp => 0001_easy.cpp} | 10 +- ..._base_operation.cpp => 0002_base_operation.cpp} | 21 +- ...wins.cpp => 0003_base_operation_multi_wins.cpp} | 68 +++--- ...{4_transient_for.cpp => 0004_transient_for.cpp} | 20 +- .../{5_notification.cpp => 0005_notification.cpp} | 35 +-- src/testcase/0006_tzsh.cpp | 239 +++++++++++++++++++ src/testcase/0007_rotation.cpp | 118 ++++++++++ src/testcase/0008_focus.cpp | 262 +++++++++++++++++++++ 15 files changed, 775 insertions(+), 482 deletions(-) delete mode 100644 src/0400_tzsh.c delete mode 100644 src/0500_rotation.c delete mode 100644 src/0500_rotation.h rename src/testcase/{1_easy.cpp => 0001_easy.cpp} (95%) rename src/testcase/{2_base_operation.cpp => 0002_base_operation.cpp} (88%) rename src/testcase/{3_base_operation_multi_wins.cpp => 0003_base_operation_multi_wins.cpp} (95%) rename src/testcase/{4_transient_for.cpp => 0004_transient_for.cpp} (96%) rename src/testcase/{5_notification.cpp => 0005_notification.cpp} (97%) create mode 100644 src/testcase/0006_tzsh.cpp create mode 100644 src/testcase/0007_rotation.cpp create mode 100644 src/testcase/0008_focus.cpp diff --git a/src/0400_tzsh.c b/src/0400_tzsh.c deleted file mode 100644 index 96e125b..0000000 --- a/src/0400_tzsh.c +++ /dev/null @@ -1,256 +0,0 @@ -#include -#include -#include "e_test_runner.h" - -/* Name: - * [0400] screensaver basic - * Description: - * Check screensaver type window that is shown on the notification layer. - * Steps: - * 01. Create an elm basic window - * 02. Set elm window to be screensaver type using tzsh - * 03. Show window - * 04. Check window stack - * Expected results: - * A window is shown on the notification layer. - */ -Eina_Bool -tc_0400_scrsaver_basic(E_TC *tc) -{ - Eina_Bool res = EINA_FALSE; - Eina_List *l = NULL, *ll = NULL; - E_TC_Win *tw = NULL, *tw2 = NULL; - - tzsh_h tzsh = NULL; - tzsh_window tz_win = 0x0; - tzsh_screensaver_service_h tz_scrsaver = NULL; - - Eina_Bool chk_found = EINA_FALSE; - Eina_Bool chk_ly = EINA_FALSE; - Eina_Bool chk_vis = EINA_FALSE; - Eina_Bool chk_focus = EINA_FALSE; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - tw = e_tc_win_add(NULL, ELM_WIN_BASIC, EINA_FALSE, NULL, - 0, 0, 0, 0, EINA_FALSE, - 0, E_TC_WIN_COLOR_RED); - EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); - - tzsh = tzsh_create(TZSH_TOOLKIT_TYPE_EFL); - EINA_SAFETY_ON_NULL_GOTO(tzsh, cleanup); - - tz_win = elm_win_window_id_get(tw->elm_win); - EINA_SAFETY_ON_FALSE_GOTO(tz_win, cleanup); - - tz_scrsaver = tzsh_screensaver_service_create(tzsh, tz_win); - EINA_SAFETY_ON_NULL_GOTO(tz_scrsaver, cleanup); - - res = e_test_runner_req_win_register(tc->runner, tw); - EINA_SAFETY_ON_FALSE_GOTO(res, cleanup); - - e_tc_win_geom_update(tw); - e_tc_win_show(tw); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); - - l = e_test_runner_req_win_info_list_get(tc->runner); - EINA_SAFETY_ON_NULL_GOTO(l, cleanup); - - EINA_LIST_FOREACH(l, ll, tw2) - { - if (tw2->native_win != tw->native_win) continue; - - chk_found = EINA_TRUE; - - if (tw2->layer == E_LAYER_CLIENT_ALERT) - chk_ly = EINA_TRUE; - - if ((tw2->vis.win) && - (tw2->vis.obj) && - (tw2->vis.type == E_VISIBILITY_UNOBSCURED)) - chk_vis = EINA_TRUE; - - if ((tw2->focus.obj) && - (tw2->focus.win)) - chk_focus = EINA_TRUE; - - break; - } - - EINA_SAFETY_ON_FALSE_GOTO(chk_found, cleanup); - EINA_SAFETY_ON_FALSE_GOTO(chk_ly, cleanup); - EINA_SAFETY_ON_FALSE_GOTO(chk_vis, cleanup); - EINA_SAFETY_ON_FALSE_GOTO(chk_focus, cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - e_test_runner_req_win_info_list_free(l); - e_tc_win_hide(tw); - e_test_runner_req_win_deregister(tc->runner, tw); - e_tc_win_del(tw); - - tzsh_screensaver_service_destroy(tz_scrsaver); - tzsh_destroy(tzsh); - - return tc->passed; -} - -struct _E_TC_Data -{ - E_Test_Runner *runner; - Ecore_Timer *expire_timer; - - /* 0401 */ - Eina_Bool chk_timeout_val; - Eina_Bool chk_ev_state_idle_timeout; - Eina_Bool chk_ev_state_not_idle; - int chk_cb_called; -}; - -static Eina_Bool -_cb_timeout(void *data) -{ - E_TC_Data *tc_data = data; - - tc_data->expire_timer = NULL; - - elm_exit(); - - return ECORE_CALLBACK_DONE; -} - -static void -_cb_state_change(void *data, - tzsh_screensaver_manager_service_h service, - int states) -{ - E_TC_Data *tc_data = data; - unsigned int time; - - tc_data->chk_cb_called++; - - if (states & TZSH_SCREENSAVER_MANAGER_SERVICE_STATE_IDLE_TIMEOUT_EXPIRED) - { - EINA_SAFETY_ON_FALSE_RETURN(tc_data->chk_cb_called == 1); - - if (tc_data->expire_timer) - { - ecore_timer_del(tc_data->expire_timer); - tc_data->expire_timer = NULL; - } - tc_data->expire_timer = ecore_timer_add(1.1, _cb_timeout, tc_data); - - tc_data->chk_ev_state_idle_timeout = EINA_TRUE; - - e_test_runner_req_ev_thaw(tc_data->runner); - e_test_runner_req_ev_feed_mouse_down(tc_data->runner, 1, 1); - e_test_runner_req_ev_feed_mouse_up(tc_data->runner, 1, 1); - e_test_runner_req_ev_freeze(tc_data->runner); - } - else if (states & TZSH_SCREENSAVER_MANAGER_SERVICE_STATE_NOT_IDLE) - { - EINA_SAFETY_ON_FALSE_RETURN(tc_data->chk_cb_called == 2); - - if (tc_data->expire_timer) - { - ecore_timer_del(tc_data->expire_timer); - tc_data->expire_timer = NULL; - } - - tc_data->chk_ev_state_not_idle = EINA_TRUE; - - tzsh_screensaver_manager_service_idle_timeout_get(service, &time); - EINA_SAFETY_ON_FALSE_RETURN(time == 1000); - - tc_data->chk_timeout_val = EINA_TRUE; - - elm_exit(); - } - else - { - EINA_SAFETY_ON_FALSE_RETURN(EINA_FALSE); - } -} - -/* Name: - * [0401] screensaver manager basic - * Description: - * Check screensaver manager APIs and 'state changed' callback - * Steps: - * 01. Create an elm basic window that won't be shown - * 02. Set elm window to be screensaver manager using tzsh - * 03. Set idle timeout to 1.0 seconds - * 04. Set screensaver feature enabled - * 05. Check TZSH_SCREENSAVER_MANAGER_SERVICE_STATE_IDLE_TIMEOUT_EXPIRED event - * 06. Request to feed fake key event - * 07. Check TZSH_SCREENSAVER_MANAGER_SERVICE_STATE_NOT_IDLE event - * Expected results: - * TZSH_SCREENSAVER_MANAGER_SERVICE_STATE_IDLE_TIMEOUT_EXPIRED event occurs. - * TZSH_SCREENSAVER_MANAGER_SERVICE_STATE_NOT_IDLE event occurs. - */ -Eina_Bool -tc_0401_scrsaver_mng_basic(E_TC *tc) -{ - E_TC_Win *tw = NULL; - tzsh_h tzsh = NULL; - tzsh_window tz_win = 0x0; - tzsh_screensaver_manager_service_h tz_scrsaver_mng = NULL; - int res = 0; - E_TC_Data *data; - - EINA_SAFETY_ON_NULL_RETURN_VAL(tc, EINA_FALSE); - - data = E_NEW(E_TC_Data, 1); - EINA_SAFETY_ON_NULL_RETURN_VAL(data, EINA_FALSE); - - tw = e_tc_win_add(NULL, ELM_WIN_BASIC, EINA_FALSE, NULL, - 0, 0, 0, 0, EINA_FALSE, - 0, E_TC_WIN_COLOR_RED); - EINA_SAFETY_ON_NULL_GOTO(tw, cleanup); - - tzsh = tzsh_create(TZSH_TOOLKIT_TYPE_EFL); - EINA_SAFETY_ON_NULL_GOTO(tzsh, cleanup); - - tz_win = elm_win_window_id_get(tw->elm_win); - EINA_SAFETY_ON_FALSE_GOTO(tz_win, cleanup); - - tz_scrsaver_mng = tzsh_screensaver_manager_service_create(tzsh, tz_win); - EINA_SAFETY_ON_NULL_GOTO(tz_scrsaver_mng, cleanup); - - res = tzsh_screensaver_manager_service_idle_timeout_set(tz_scrsaver_mng, 1000); - EINA_SAFETY_ON_FALSE_GOTO(res == 0, cleanup); - - res = tzsh_screensaver_manager_service_enable(tz_scrsaver_mng); - EINA_SAFETY_ON_FALSE_GOTO(res == 0, cleanup); - - res = tzsh_screensaver_manager_service_state_change_cb_set(tz_scrsaver_mng, - _cb_state_change, - data); - EINA_SAFETY_ON_FALSE_GOTO(res == 0, cleanup); - - data->expire_timer = ecore_timer_add(1.1, _cb_timeout, data); - data->runner = tc->runner; - - e_test_runner_req_ev_freeze(tc->runner); - - e_test_runner_work(); - - e_test_runner_req_ev_thaw(tc->runner); - - EINA_SAFETY_ON_FALSE_GOTO(data->chk_ev_state_idle_timeout, cleanup); - EINA_SAFETY_ON_FALSE_GOTO(data->chk_ev_state_not_idle, cleanup); - EINA_SAFETY_ON_FALSE_GOTO(data->chk_timeout_val, cleanup); - EINA_SAFETY_ON_FALSE_GOTO(data->chk_cb_called == 2, cleanup); - - tc->passed = EINA_TRUE; - -cleanup: - if (data->expire_timer) ecore_timer_del(data->expire_timer); - E_FREE(data); - e_tc_win_del(tw); - tzsh_screensaver_manager_service_destroy(tz_scrsaver_mng); - tzsh_destroy(tzsh); - - return tc->passed; -} diff --git a/src/0500_rotation.c b/src/0500_rotation.c deleted file mode 100644 index 293b542..0000000 --- a/src/0500_rotation.c +++ /dev/null @@ -1,111 +0,0 @@ -#include "e_test_runner.h" - -static Eina_Bool -_e_tc_rot_win_rotation_test(E_Test_Runner *runner, E_TC_Win *tw, int rot) -{ - Eina_Bool res; - - res = e_test_runner_req_zone_rotation_change(runner, rot); - if (!res) - { - ERR("Changing rotaiton is denied."); - return EINA_FALSE; - } - - res = e_test_runner_ev_wait(runner, E_TC_EVENT_TYPE_WINDOW_ROTATION_CHANGE); - if (!res) - { - ERR("Failed waiting rotation change event"); - return EINA_FALSE; - } - - res = e_test_runner_req_win_info_get(runner, tw); - if ((!res) || - (tw->rot != rot)) - { - ERR("Failed to rotate res %d, pass %d, result %d", res, rot, tw->rot); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -/* @ Brief - * Test whether available rotation works fine for a window. - * - * @ Test Step: - * 1. Creating a Window - * 2. Set a available rotation list(0, 90, 180, 270) to window - * 3. Request to server for rotation about all available angles. - * 4. Verifying a window is rotated. - * - * @ Expected Result: - * Window should be rotated after accepted request for rotation. - */ -ROT_TC_DEFINE(00, available_rots) -{ - E_TC_Win *tw; - Eina_Bool res; - int rot, saved_rot; - const int rots[4] = {0, 90, 180, 270}; - - /* create window */ - tw = e_tc_win_add(NULL, ELM_WIN_BASIC, - EINA_FALSE, "Test Window for Rotation", - 0, 0, 0, 0, EINA_FALSE, - 200, E_TC_WIN_COLOR_BLUE); - EINA_SAFETY_ON_NULL_GOTO(tw, end); - - /* set available rotations */ - elm_win_wm_rotation_available_rotations_set(tw->elm_win, rots, 4); - - /* register window */ - res = e_test_runner_req_win_register(tc->runner, tw); - if (!res) - goto err_reg; - - e_tc_win_geom_update(tw); - e_tc_win_show(tw); - e_test_runner_ev_wait(tc->runner, E_TC_EVENT_TYPE_VIS_ON); - - /* Update window info */ - res = e_test_runner_req_win_info_get(tc->runner, tw); - if (!res) - { - ERR("Failed to get initial window info"); - goto err_info_get; - } - - /* to restore orientation after finishing tc */ - saved_rot = tw->rot; - - for (rot = ((saved_rot + 90) % 360); - rot == saved_rot; - rot = ((rot + 90) % 360)) - { - /* hard coded, reverse portrait(180) mode is disabled in mobile */ - if (rot == 180) continue; - - res = _e_tc_rot_win_rotation_test(tc->runner, tw, rot); - if (!res) - { - ERR("Failed to try to rotate given angle: %d", rot); - goto err_tc; - } - } - - tc->passed = EINA_TRUE; - -err_tc: - /* restore orientation */ - res = e_test_runner_req_zone_rotation_change(tc->runner, saved_rot); - if (!res) - ERR("Failed to restore orientation"); -err_info_get: - e_test_runner_req_win_deregister(tc->runner, tw); - e_tc_win_hide(tw); -err_reg: - e_tc_win_del(tw); -end: - return tc->passed; -} diff --git a/src/0500_rotation.h b/src/0500_rotation.h deleted file mode 100644 index 20a35c0..0000000 --- a/src/0500_rotation.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef TC_ROTATION_H -#define TC_ROTATION_H - -#include - -#define ROT_TC_DEFINE(num, name) Eina_Bool tc_05##num##_rotation_##name(E_TC *tc) - -ROT_TC_DEFINE(00, available_rots); - -#endif diff --git a/src/Makefile.am b/src/Makefile.am index 5cf7dbd..e689757 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,11 +10,14 @@ e_test_runner_LDADD = \ @E_TEST_RUNNER_LIBS@ e_test_runner_TESTCASES = \ -testcase/1_easy.cpp \ -testcase/2_base_operation.cpp \ -testcase/3_base_operation_multi_wins.cpp \ -testcase/4_transient_for.cpp \ -testcase/5_notification.cpp +testcase/0001_easy.cpp \ +testcase/0002_base_operation.cpp \ +testcase/0003_base_operation_multi_wins.cpp \ +testcase/0004_transient_for.cpp \ +testcase/0005_notification.cpp \ +testcase/0006_tzsh.cpp \ +testcase/0007_rotation.cpp \ +testcase/0008_focus.cpp e_test_runner_SOURCES = \ e_test_main.cpp \ @@ -23,11 +26,14 @@ e_test_event.cpp \ e_test_win.h \ e_test_win.cpp \ e_test_util.h \ -testcase/1_easy.cpp \ -testcase/2_base_operation.cpp \ -testcase/3_base_operation_multi_wins.cpp \ -testcase/4_transient_for.cpp \ -testcase/5_notification.cpp +testcase/0001_easy.cpp \ +testcase/0002_base_operation.cpp \ +testcase/0003_base_operation_multi_wins.cpp \ +testcase/0004_transient_for.cpp \ +testcase/0005_notification.cpp \ +testcase/0006_tzsh.cpp \ +testcase/0007_rotation.cpp \ +testcase/0008_focus.cpp MAINTAINERCLEANFILES = \ Makefile.in diff --git a/src/e_test_event.cpp b/src/e_test_event.cpp index 17e739c..fca38b6 100644 --- a/src/e_test_event.cpp +++ b/src/e_test_event.cpp @@ -50,6 +50,7 @@ static const struct tizen_resource_listener _e_test_tizen_resource_listener = EtEventLoop::EtEventLoop() { this->log_dom_ = -1; + this->time_for_wait_work_ = E_TEST_WORK_TIME; this->tizen_policy_ = NULL; this->tizen_surface_ = NULL; @@ -613,7 +614,7 @@ finish: void EtEventLoop::Work() { /* give a turn to deal with deferred job for E_TEST_WORK_TIME */ - ecore_timer_add(E_TEST_WORK_TIME, _cb_work_timeout, NULL); + ecore_timer_add(time_for_wait_work_, _cb_work_timeout, NULL); elm_run(); } @@ -631,20 +632,47 @@ void EtEventLoop::PrintWinInfoList() (unsigned int)tw->native_win, tw->alpha, tw->x, tw->y, tw->w, tw->h, - tw->vis.win, - tw->vis.obj, - tw->vis.opaque, - tw->vis.type, - tw->vis.skip, + tw->Vis.win, + tw->Vis.obj, + tw->Vis.opaque, + tw->Vis.type, + tw->Vis.skip, tw->iconic, - tw->focus.win, - tw->focus.obj, + tw->Focus.win, + tw->Focus.obj, tw->name); } this->FreeWinInfoList(l); printf("--------------------------------------------------------------------------------------------------------------------------\n"); } +void EtEventLoop::DelTimer() +{ + if (this->Ev.expire_timer) + { + ecore_timer_del(this->Ev.expire_timer); + this->Ev.expire_timer = NULL; + } +} + +void EtEventLoop::RunTimer() +{ + if (this->Ev.expire_timer) + this->DelTimer(); + + this->Ev.expire_timer = ecore_timer_add(this->time_for_wait_work_, _cb_work_timeout, NULL); +} + +void EtEventLoop::WaitForDestroy() +{ + printf("###########################\n"); + printf("Destroy Wait Timer Start!!!\n"); + printf("###########################\n"); + this->SetWaitWorkTime(E_TEST_WORK_TIME); + this->RunTimer(); + elm_run(); +} + Ecore_Window EtEventLoop::GetWinId(Evas_Object *elm_win) { Ecore_Wl_Window *wlwin = NULL; @@ -760,15 +788,15 @@ static void _cb_method_win_info_get(void *data, &tw->x, &tw->y, &tw->w, &tw->h, &tw->layer, &tw->effect, - &tw->vis.win, - &tw->vis.obj, - &tw->vis.opaque, - &tw->vis.type, - &tw->vis.skip, + &tw->Vis.win, + &tw->Vis.obj, + &tw->Vis.opaque, + &tw->Vis.type, + &tw->Vis.skip, &tw->iconic, &tw->alpha, - &tw->focus.win, - &tw->focus.obj, + &tw->Focus.win, + &tw->Focus.obj, &tw->rot); if (wname) @@ -820,15 +848,15 @@ static void _cb_method_win_info_list_get(void *data, &tw->x, &tw->y, &tw->w, &tw->h, &tw->layer, &tw->effect, - &tw->vis.win, - &tw->vis.obj, - &tw->vis.opaque, - &tw->vis.type, - &tw->vis.skip, + &tw->Vis.win, + &tw->Vis.obj, + &tw->Vis.opaque, + &tw->Vis.type, + &tw->Vis.skip, &tw->iconic, &tw->alpha, - &tw->focus.win, - &tw->focus.obj, + &tw->Focus.win, + &tw->Focus.obj, &tw->rot); if (wname) diff --git a/src/e_test_event.h b/src/e_test_event.h index dea5e48..87e4f25 100644 --- a/src/e_test_event.h +++ b/src/e_test_event.h @@ -16,6 +16,7 @@ class EtEventLoop struct tizen_surface *tizen_surface_ = NULL; int log_dom_ = -1; + double time_for_wait_work_ = 0.0; struct { @@ -75,6 +76,10 @@ class EtEventLoop /* methods */ void Work(); void PrintWinInfoList(); + void SetWaitWorkTime(double time) { this->time_for_wait_work_ = time; }; + void DelTimer(); + void RunTimer(); + void WaitForDestroy(); /* getter & setter */ Eldbus_Connection *GetEldbusConnection() { return this->Dbus.conn; }; diff --git a/src/e_test_win.h b/src/e_test_win.h index 2e80d55..3c5c9de 100644 --- a/src/e_test_win.h +++ b/src/e_test_win.h @@ -24,14 +24,14 @@ class EtWin int opaque = 0; E_Visibility type = E_VISIBILITY_UNKNOWN; Eina_Bool skip = EINA_FALSE; - } vis; + } Vis; Eina_Bool iconic = EINA_FALSE; Eina_Bool alpha = EINA_FALSE; struct { Eina_Bool win = EINA_FALSE; Eina_Bool obj = EINA_FALSE; - } focus; + } Focus; public: EtWin(); diff --git a/src/testcase/1_easy.cpp b/src/testcase/0001_easy.cpp similarity index 95% rename from src/testcase/1_easy.cpp rename to src/testcase/0001_easy.cpp index 8428495..5650f7e 100644 --- a/src/testcase/1_easy.cpp +++ b/src/testcase/0001_easy.cpp @@ -7,7 +7,7 @@ using ::testing::Test; extern EtEventLoop *gLoop; -class TestcaseEasy : public ::testing::Test +class EtTestEasy : public ::testing::Test { protected: static void SetUpTestCase() {}; @@ -102,21 +102,21 @@ finish: elm_exit(); } -TEST_F(TestcaseEasy, base_pass) +TEST_F(EtTestEasy, base_pass) { Eina_Bool result = EINA_TRUE; ASSERT_TRUE(result); } -TEST_F(TestcaseEasy, base_fail) +TEST_F(EtTestEasy, base_fail) { Eina_Bool result = EINA_FALSE; ASSERT_FALSE(result); } -TEST_F(TestcaseEasy, introspect) +TEST_F(EtTestEasy, introspect) { Eina_Bool result = EINA_FALSE; Eldbus_Pending *p = NULL; @@ -135,7 +135,7 @@ TEST_F(TestcaseEasy, introspect) ASSERT_TRUE(result); } -TEST_F(TestcaseEasy, win_register) +TEST_F(EtTestEasy, win_register) { Eina_Bool result = EINA_FALSE; Eldbus_Pending *p = NULL; diff --git a/src/testcase/2_base_operation.cpp b/src/testcase/0002_base_operation.cpp similarity index 88% rename from src/testcase/2_base_operation.cpp rename to src/testcase/0002_base_operation.cpp index 38ce02c..b48eced 100644 --- a/src/testcase/2_base_operation.cpp +++ b/src/testcase/0002_base_operation.cpp @@ -5,23 +5,26 @@ using ::testing::Test; extern EtEventLoop *gLoop; -class TestcaseBaseOperation : public ::testing::Test +class EtTestBaseOperation : public ::testing::Test { public: - TestcaseBaseOperation() + EtTestBaseOperation() { }; - ~TestcaseBaseOperation() + ~EtTestBaseOperation() { - if (gLoop->HasLastWinInfoList()) - gLoop->FreeLastWinInfoList(); + gLoop->WaitForDestroy(); if (tw) { gLoop->DeregisterWin(tw); tw->DeInit(); delete tw; + tw = NULL; } + + if (gLoop->HasLastWinInfoList()) + gLoop->FreeLastWinInfoList(); }; protected: @@ -61,7 +64,7 @@ class TestcaseBaseOperation : public ::testing::Test }; }; -TEST_F(TestcaseBaseOperation, win_show) +TEST_F(EtTestBaseOperation, win_show) { Eina_Bool result = EINA_FALSE; @@ -69,7 +72,7 @@ TEST_F(TestcaseBaseOperation, win_show) ASSERT_TRUE(result); } -TEST_F(TestcaseBaseOperation, win_stack) +TEST_F(EtTestBaseOperation, win_stack) { EtWin *tw2 = NULL; Eina_Bool result = EINA_FALSE; @@ -96,7 +99,7 @@ TEST_F(TestcaseBaseOperation, win_stack) ASSERT_TRUE(result); } -TEST_F(TestcaseBaseOperation, alpha_win_show) +TEST_F(EtTestBaseOperation, alpha_win_show) { Eina_Bool result = EINA_FALSE; @@ -104,7 +107,7 @@ TEST_F(TestcaseBaseOperation, alpha_win_show) ASSERT_TRUE(result); } -TEST_F(TestcaseBaseOperation, alpha_win_stack) +TEST_F(EtTestBaseOperation, alpha_win_stack) { EtWin *tw2 = NULL; Eina_Bool result = EINA_FALSE; diff --git a/src/testcase/3_base_operation_multi_wins.cpp b/src/testcase/0003_base_operation_multi_wins.cpp similarity index 95% rename from src/testcase/3_base_operation_multi_wins.cpp rename to src/testcase/0003_base_operation_multi_wins.cpp index 9826ae8..db1c5fc 100644 --- a/src/testcase/3_base_operation_multi_wins.cpp +++ b/src/testcase/0003_base_operation_multi_wins.cpp @@ -5,16 +5,15 @@ using ::testing::Test; extern EtEventLoop *gLoop; -class TestcaseBaseMulti : public ::testing::Test +class EtTestBaseMulti : public ::testing::Test { public: - TestcaseBaseMulti() + EtTestBaseMulti() { }; - ~TestcaseBaseMulti() + ~EtTestBaseMulti() { - if (gLoop->HasLastWinInfoList()) - gLoop->FreeLastWinInfoList(); + gLoop->WaitForDestroy(); if (tw_register) gLoop->DeregisterWin(tw_register); @@ -27,6 +26,9 @@ class TestcaseBaseMulti : public ::testing::Test if (tw_green) delete tw_green; + + if (gLoop->HasLastWinInfoList()) + gLoop->FreeLastWinInfoList(); }; protected: @@ -141,7 +143,7 @@ class TestcaseBaseMulti : public ::testing::Test } }; -TEST_F(TestcaseBaseMulti, multi_all_wins_basic) +TEST_F(EtTestBaseMulti, multi_all_wins_basic) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -186,7 +188,7 @@ TEST_F(TestcaseBaseMulti, multi_all_wins_basic) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_wins_show1) +TEST_F(EtTestBaseMulti, multi_all_wins_show1) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -243,7 +245,7 @@ TEST_F(TestcaseBaseMulti, multi_all_wins_show1) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_wins_show2) +TEST_F(EtTestBaseMulti, multi_all_wins_show2) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -300,7 +302,7 @@ TEST_F(TestcaseBaseMulti, multi_all_wins_show2) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_wins_show3) +TEST_F(EtTestBaseMulti, multi_all_wins_show3) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -357,7 +359,7 @@ TEST_F(TestcaseBaseMulti, multi_all_wins_show3) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_wins_raise1) +TEST_F(EtTestBaseMulti, multi_all_wins_raise1) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -406,7 +408,7 @@ TEST_F(TestcaseBaseMulti, multi_all_wins_raise1) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_wins_raise2) +TEST_F(EtTestBaseMulti, multi_all_wins_raise2) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -455,7 +457,7 @@ TEST_F(TestcaseBaseMulti, multi_all_wins_raise2) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_wins_stack_above1) +TEST_F(EtTestBaseMulti, multi_all_wins_stack_above1) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -504,7 +506,7 @@ TEST_F(TestcaseBaseMulti, multi_all_wins_stack_above1) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_wins_stack_above2) +TEST_F(EtTestBaseMulti, multi_all_wins_stack_above2) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -553,7 +555,7 @@ TEST_F(TestcaseBaseMulti, multi_all_wins_stack_above2) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_wins_stack_above3) +TEST_F(EtTestBaseMulti, multi_all_wins_stack_above3) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -602,7 +604,7 @@ TEST_F(TestcaseBaseMulti, multi_all_wins_stack_above3) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_wins_lower1) +TEST_F(EtTestBaseMulti, multi_all_wins_lower1) { EtWin *tw = NULL, *tw_above = NULL; Eina_Bool result = EINA_FALSE; @@ -667,7 +669,7 @@ TEST_F(TestcaseBaseMulti, multi_all_wins_lower1) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_wins_lower2) +TEST_F(EtTestBaseMulti, multi_all_wins_lower2) { EtWin *tw = NULL, *tw_above = NULL; Eina_Bool result = EINA_FALSE; @@ -732,7 +734,7 @@ TEST_F(TestcaseBaseMulti, multi_all_wins_lower2) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_full_wins_basic) +TEST_F(EtTestBaseMulti, multi_all_full_wins_basic) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -777,7 +779,7 @@ TEST_F(TestcaseBaseMulti, multi_all_full_wins_basic) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_full_wins_show1) +TEST_F(EtTestBaseMulti, multi_all_full_wins_show1) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -834,7 +836,7 @@ TEST_F(TestcaseBaseMulti, multi_all_full_wins_show1) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_full_wins_show2) +TEST_F(EtTestBaseMulti, multi_all_full_wins_show2) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -891,7 +893,7 @@ TEST_F(TestcaseBaseMulti, multi_all_full_wins_show2) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_full_wins_show3) +TEST_F(EtTestBaseMulti, multi_all_full_wins_show3) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -948,7 +950,7 @@ TEST_F(TestcaseBaseMulti, multi_all_full_wins_show3) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_full_wins_raise1) +TEST_F(EtTestBaseMulti, multi_all_full_wins_raise1) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -997,7 +999,7 @@ TEST_F(TestcaseBaseMulti, multi_all_full_wins_raise1) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_full_wins_raise2) +TEST_F(EtTestBaseMulti, multi_all_full_wins_raise2) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -1046,7 +1048,7 @@ TEST_F(TestcaseBaseMulti, multi_all_full_wins_raise2) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_full_wins_stack_above1) +TEST_F(EtTestBaseMulti, multi_all_full_wins_stack_above1) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -1095,7 +1097,7 @@ TEST_F(TestcaseBaseMulti, multi_all_full_wins_stack_above1) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_full_wins_stack_above2) +TEST_F(EtTestBaseMulti, multi_all_full_wins_stack_above2) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -1144,7 +1146,7 @@ TEST_F(TestcaseBaseMulti, multi_all_full_wins_stack_above2) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_full_wins_stack_above3) +TEST_F(EtTestBaseMulti, multi_all_full_wins_stack_above3) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -1193,7 +1195,7 @@ TEST_F(TestcaseBaseMulti, multi_all_full_wins_stack_above3) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_full_wins_lower1) +TEST_F(EtTestBaseMulti, multi_all_full_wins_lower1) { EtWin *tw = NULL, *tw_above = NULL; Eina_Bool result = EINA_FALSE; @@ -1258,7 +1260,7 @@ TEST_F(TestcaseBaseMulti, multi_all_full_wins_lower1) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_all_full_wins_lower2) +TEST_F(EtTestBaseMulti, multi_all_full_wins_lower2) { EtWin *tw = NULL, *tw_above = NULL; Eina_Bool result = EINA_FALSE; @@ -1323,7 +1325,7 @@ TEST_F(TestcaseBaseMulti, multi_all_full_wins_lower2) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseBaseMulti, multi_2wins_show1) +TEST_F(EtTestBaseMulti, multi_2wins_show1) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -1370,7 +1372,7 @@ TEST_F(TestcaseBaseMulti, multi_2wins_show1) ASSERT_EQ(2, pass_count); } -TEST_F(TestcaseBaseMulti, multi_2wins_show2) +TEST_F(EtTestBaseMulti, multi_2wins_show2) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -1417,7 +1419,7 @@ TEST_F(TestcaseBaseMulti, multi_2wins_show2) ASSERT_EQ(2, pass_count); } -TEST_F(TestcaseBaseMulti, multi_2wins_show3) +TEST_F(EtTestBaseMulti, multi_2wins_show3) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -1464,7 +1466,7 @@ TEST_F(TestcaseBaseMulti, multi_2wins_show3) ASSERT_EQ(2, pass_count); } -TEST_F(TestcaseBaseMulti, multi_full_2wins_show1) +TEST_F(EtTestBaseMulti, multi_full_2wins_show1) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -1511,7 +1513,7 @@ TEST_F(TestcaseBaseMulti, multi_full_2wins_show1) ASSERT_EQ(2, pass_count); } -TEST_F(TestcaseBaseMulti, multi_full_2wins_show2) +TEST_F(EtTestBaseMulti, multi_full_2wins_show2) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -1558,7 +1560,7 @@ TEST_F(TestcaseBaseMulti, multi_full_2wins_show2) ASSERT_EQ(2, pass_count); } -TEST_F(TestcaseBaseMulti, multi_full_2wins_show3) +TEST_F(EtTestBaseMulti, multi_full_2wins_show3) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; diff --git a/src/testcase/4_transient_for.cpp b/src/testcase/0004_transient_for.cpp similarity index 96% rename from src/testcase/4_transient_for.cpp rename to src/testcase/0004_transient_for.cpp index 0b1f4cb..fc74766 100644 --- a/src/testcase/4_transient_for.cpp +++ b/src/testcase/0004_transient_for.cpp @@ -4,16 +4,15 @@ using ::testing::Test; extern EtEventLoop *gLoop; -class TestcaseTransientFor : public ::testing::Test +class EtTestTransientFor : public ::testing::Test { public: - TestcaseTransientFor() + EtTestTransientFor() { }; - ~TestcaseTransientFor() + ~EtTestTransientFor() { - if (gLoop->HasLastWinInfoList()) - gLoop->FreeLastWinInfoList(); + gLoop->WaitForDestroy(); if (tw_register) gLoop->DeregisterWin(tw_register); @@ -26,6 +25,9 @@ class TestcaseTransientFor : public ::testing::Test if (tw_child) delete tw_child; + + if (gLoop->HasLastWinInfoList()) + gLoop->FreeLastWinInfoList(); }; protected: @@ -134,7 +136,7 @@ class TestcaseTransientFor : public ::testing::Test }; }; -TEST_F(TestcaseTransientFor, transient_for_basic) +TEST_F(EtTestTransientFor, transient_for_basic) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -178,7 +180,7 @@ TEST_F(TestcaseTransientFor, transient_for_basic) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseTransientFor, transient_for_raise) +TEST_F(EtTestTransientFor, transient_for_raise) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -230,7 +232,7 @@ TEST_F(TestcaseTransientFor, transient_for_raise) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseTransientFor, transient_for_lower) +TEST_F(EtTestTransientFor, transient_for_lower) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -298,7 +300,7 @@ TEST_F(TestcaseTransientFor, transient_for_lower) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseTransientFor, transient_for_above) +TEST_F(EtTestTransientFor, transient_for_above) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; diff --git a/src/testcase/5_notification.cpp b/src/testcase/0005_notification.cpp similarity index 97% rename from src/testcase/5_notification.cpp rename to src/testcase/0005_notification.cpp index ad46d6b..8dd06f4 100644 --- a/src/testcase/5_notification.cpp +++ b/src/testcase/0005_notification.cpp @@ -5,14 +5,16 @@ using ::testing::Test; extern EtEventLoop *gLoop; -class TestcaseNotification : public ::testing::Test +class EtTestNotification : public ::testing::Test { public: - TestcaseNotification() + EtTestNotification() { }; - ~TestcaseNotification() + ~EtTestNotification() { + gLoop->WaitForDestroy(); + if (tw_register) gLoop->DeregisterWin(tw_register); @@ -24,6 +26,9 @@ class TestcaseNotification : public ::testing::Test if (tw_noti2) delete tw_noti2; + + if (gLoop->HasLastWinInfoList()) + gLoop->FreeLastWinInfoList(); }; protected: @@ -107,7 +112,7 @@ class TestcaseNotification : public ::testing::Test } }; -TEST_F(TestcaseNotification, notification_level_default) +TEST_F(EtTestNotification, notification_level_default) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -170,7 +175,7 @@ TEST_F(TestcaseNotification, notification_level_default) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseNotification, notification_level_medium) +TEST_F(EtTestNotification, notification_level_medium) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -233,7 +238,7 @@ TEST_F(TestcaseNotification, notification_level_medium) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseNotification, notification_level_high) +TEST_F(EtTestNotification, notification_level_high) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -296,7 +301,7 @@ TEST_F(TestcaseNotification, notification_level_high) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseNotification, notification_level_top) +TEST_F(EtTestNotification, notification_level_top) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -359,7 +364,7 @@ TEST_F(TestcaseNotification, notification_level_top) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseNotification, notification_level_none) +TEST_F(EtTestNotification, notification_level_none) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -477,7 +482,7 @@ TEST_F(TestcaseNotification, notification_level_none) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseNotification, notification_level_change) +TEST_F(EtTestNotification, notification_level_change) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -643,7 +648,7 @@ TEST_F(TestcaseNotification, notification_level_change) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseNotification, notification_fullsize_level_default) +TEST_F(EtTestNotification, notification_fullsize_level_default) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -706,7 +711,7 @@ TEST_F(TestcaseNotification, notification_fullsize_level_default) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseNotification, notification_fullsize_level_medium) +TEST_F(EtTestNotification, notification_fullsize_level_medium) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -769,7 +774,7 @@ TEST_F(TestcaseNotification, notification_fullsize_level_medium) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseNotification, notification_fullsize_level_high) +TEST_F(EtTestNotification, notification_fullsize_level_high) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -832,7 +837,7 @@ TEST_F(TestcaseNotification, notification_fullsize_level_high) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseNotification, notification_fullsize_level_top) +TEST_F(EtTestNotification, notification_fullsize_level_top) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -895,7 +900,7 @@ TEST_F(TestcaseNotification, notification_fullsize_level_top) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseNotification, notification_fullsize_level_none) +TEST_F(EtTestNotification, notification_fullsize_level_none) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; @@ -1013,7 +1018,7 @@ TEST_F(TestcaseNotification, notification_fullsize_level_none) ASSERT_EQ(3, pass_count); } -TEST_F(TestcaseNotification, notification_fullsize_level_change) +TEST_F(EtTestNotification, notification_fullsize_level_change) { EtWin *tw = NULL; Eina_Bool result = EINA_FALSE; diff --git a/src/testcase/0006_tzsh.cpp b/src/testcase/0006_tzsh.cpp new file mode 100644 index 0000000..bbc733b --- /dev/null +++ b/src/testcase/0006_tzsh.cpp @@ -0,0 +1,239 @@ +#include "e_test_event.h" + +#include +#include + +#define E_TEST_WORK_TIME 3.0 + +using ::testing::Test; + +extern EtEventLoop *gLoop; + +class EtTestTzsh : public :: testing::Test +{ + 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() + { + gLoop->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) + { + gLoop->DeregisterWin(tw); + delete tw; + } + + if (gLoop->HasLastWinInfoList()) + gLoop->FreeLastWinInfoList(); + }; + protected: + EtWin *tw = NULL; + + Eina_Bool InitTC() + { + Eina_Bool result = EINA_FALSE; + + this->tw = new EtWin(); + result = this->tw->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(result, EINA_FALSE); + this->tw->native_win = gLoop->GetWinId(this->tw->elm_win); + + result = gLoop->RegisterWin(this->tw); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + return EINA_TRUE; + }; +}; + +/****************** + callbacks +*******************/ +static void +_cb_state_change(void *data, + tzsh_screensaver_manager_service_h service, + int states) +{ + EtTestTzsh *tc_data = (EtTestTzsh *)data; + unsigned int time; + + tc_data->chk_cb_called_++; + + if (states & TZSH_SCREENSAVER_MANAGER_SERVICE_STATE_IDLE_TIMEOUT_EXPIRED) + { + EINA_SAFETY_ON_FALSE_RETURN(tc_data->chk_cb_called_ == 1); + + gLoop->RunTimer(); + + tc_data->chk_ev_state_idle_timeout_ = EINA_TRUE; + + gLoop->ThawEvent(); + gLoop->FeedMouseDown(1, 1); + gLoop->FeedMouseUp(1, 1); + gLoop->FreezeEvent(); + } + else if (states & TZSH_SCREENSAVER_MANAGER_SERVICE_STATE_NOT_IDLE) + { + EINA_SAFETY_ON_FALSE_RETURN(tc_data->chk_cb_called_ == 2); + + gLoop->DelTimer(); + + tc_data->chk_ev_state_not_idle_ = EINA_TRUE; + + tzsh_screensaver_manager_service_idle_timeout_get(service, &time); + EINA_SAFETY_ON_FALSE_RETURN(time == 1000); + + tc_data->chk_timeout_val_ = EINA_TRUE; + + elm_exit(); + } + else + { + EINA_SAFETY_ON_FALSE_RETURN(EINA_FALSE); + } +} + +/* Name: + * EtTestTzsh.scrsaver_basic + * Description: + * Check screensaver type window that is shown on the notification layer. + * Steps: + * 01. Create an elm basic window + * 02. Set elm window to be screensaver type using tzsh + * 03. Show window + * 04. Check window stack + * Expected results: + * A window is shown on the notification layer. + */ +TEST_F(EtTestTzsh, scrsaver_basic) +{ + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + EtWin *tw = NULL; + + this->InitTC(); + + this->tzsh = tzsh_create(TZSH_TOOLKIT_TYPE_EFL); + ASSERT_TRUE(this->tzsh != NULL); + + this->tz_win = elm_win_window_id_get(this->tw->elm_win); + ASSERT_NE(0, this->tz_win); + + this->tz_scrsaver = tzsh_screensaver_service_create(this->tzsh, this->tz_win); + ASSERT_TRUE(tz_scrsaver != NULL); + + this->tw->UpdateGeometry(); + this->tw->Show(); + gLoop->WaitEvent(E_TC_EVENT_TYPE_VIS_ON); + + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->native_win != this->tw->native_win) + continue; + + // check layer + ASSERT_EQ(E_LAYER_CLIENT_ALERT, tw->layer); + + // check visibility + ASSERT_TRUE(tw->Vis.win); + ASSERT_TRUE(tw->Vis.obj); + ASSERT_EQ(E_VISIBILITY_UNOBSCURED, tw->Vis.type); + + // check focus + ASSERT_TRUE(tw->Focus.obj); + ASSERT_TRUE(tw->Focus.win); + + break; + } + gLoop->FreeWinInfoList(list); + +} + +/* Name: + * EtTestTzsh.Screensaver_manager_basic + * Description: + * Check screensaver manager APIs and 'state changed' callback + * Steps: + * 01. Create an elm basic window that won't be shown + * 02. Set elm window to be screensaver manager using tzsh + * 03. Set idle timeout to 1.0 seconds + * 04. Set screensaver feature enabled + * 05. Check TZSH_SCREENSAVER_MANAGER_SERVICE_STATE_IDLE_TIMEOUT_EXPIRED event + * 06. Request to feed fake key event + * 07. Check TZSH_SCREENSAVER_MANAGER_SERVICE_STATE_NOT_IDLE event + * Expected results: + * TZSH_SCREENSAVER_MANAGER_SERVICE_STATE_IDLE_TIMEOUT_EXPIRED event occurs. + * TZSH_SCREENSAVER_MANAGER_SERVICE_STATE_NOT_IDLE event occurs. + */ +TEST_F(EtTestTzsh, scrsaver_mng_basic) +{ + Eina_Bool result = EINA_FALSE; + + result = this->InitTC(); + ASSERT_TRUE(result); + + this->tzsh = tzsh_create(TZSH_TOOLKIT_TYPE_EFL); + ASSERT_TRUE(this->tzsh != NULL); + + this->tz_win = elm_win_window_id_get(this->tw->elm_win); + ASSERT_NE(0, this->tz_win); + + this->tz_scrsaver_mng = tzsh_screensaver_manager_service_create(this->tzsh, this->tz_win); + ASSERT_TRUE(this->tz_scrsaver_mng != NULL); + + result = tzsh_screensaver_manager_service_idle_timeout_set(this->tz_scrsaver_mng, 1000); + ASSERT_EQ(TZSH_ERROR_NONE, result); + + result = tzsh_screensaver_manager_service_enable(this->tz_scrsaver_mng); + ASSERT_EQ(TZSH_ERROR_NONE, result); + + result = tzsh_screensaver_manager_service_state_change_cb_set(this->tz_scrsaver_mng, + _cb_state_change, + this); + ASSERT_EQ(TZSH_ERROR_NONE, result); + + gLoop->SetWaitWorkTime(1.1); + gLoop->FreezeEvent(); + gLoop->Work(); + gLoop->ThawEvent(); + gLoop->SetWaitWorkTime(E_TEST_WORK_TIME); + + ASSERT_TRUE(this->chk_ev_state_idle_timeout_); + ASSERT_TRUE(this->chk_ev_state_not_idle_); + ASSERT_TRUE(this->chk_timeout_val_); + ASSERT_EQ(2, this->chk_cb_called_); + +} diff --git a/src/testcase/0007_rotation.cpp b/src/testcase/0007_rotation.cpp new file mode 100644 index 0000000..3566125 --- /dev/null +++ b/src/testcase/0007_rotation.cpp @@ -0,0 +1,118 @@ +#include "e_test_event.h" + +using ::testing::Test; + +extern EtEventLoop *gLoop; + +class EtTestRotation : public ::testing::Test +{ + public: + EtTestRotation() + { + }; + ~EtTestRotation() + { + gLoop->WaitForDestroy(); + + if (tw_register) + gLoop->DeregisterWin(tw_register); + + if (tw) + { + delete tw; + } + + if (gLoop->HasLastWinInfoList()) + gLoop->FreeLastWinInfoList(); + }; + + protected: + const int rots[4] = {0, 90, 180, 270}; + EtWin *tw = NULL; + EtWin *tw_register = NULL; + + int saved_rot_ = 0; + + Eina_Bool InitTC() + { + Eina_Bool result = EINA_FALSE; + + this->tw = new EtWin(); + result = this->tw->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(result, EINA_FALSE); + this->tw->native_win = gLoop->GetWinId(this->tw->elm_win); + + // available rotations + elm_win_wm_rotation_available_rotations_set(this->tw->elm_win, + this->rots, 4); + + result = gLoop->RegisterWin(this->tw); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + this->tw_register = this->tw; + + this->tw->UpdateGeometry(); + this->tw->Show(); + gLoop->WaitEvent(E_TC_EVENT_TYPE_VIS_ON); + + return EINA_TRUE; + }; + + Eina_Bool TestWinRotation(EtWin *tw, int rot) + { + Eina_Bool result = EINA_FALSE; + + result = gLoop->SetZoneRotation(rot); + if (!result) + { + ERR("Changing rotation is denied."); + return EINA_FALSE; + } + + result = gLoop->WaitEvent(E_TC_EVENT_TYPE_WINDOW_ROTATION_CHANGE); + if (!result) + { + ERR("Failed waiting rotation change event"); + return EINA_FALSE; + } + + result = gLoop->GetWinInfo(tw); + if ((!result) || (tw->rot != rot)) + { + ERR("Failed to rotate res %d, pass %d, result %d", result, rot, tw->rot); + return EINA_FALSE; + } + return EINA_TRUE; + }; +}; + +TEST_F(EtTestRotation, available_rotations) +{ + Eina_Bool result = EINA_FALSE; + int rot = 0; + + result = this->InitTC(); + ASSERT_TRUE(result); + + result = gLoop->GetWinInfo(this->tw); + ASSERT_TRUE(result); + + this->saved_rot_ = this->tw->rot; + + for (rot = ((this->saved_rot_ + 90) % 360); + rot == this->saved_rot_; + rot = ((rot + 90) % 360)) + { + /* hard coded, reverse portrait(180) mode is disabled in mobile */ + if (rot == 180) continue; + + result = this->TestWinRotation(this->tw, rot); + ASSERT_TRUE(result); + } +} diff --git a/src/testcase/0008_focus.cpp b/src/testcase/0008_focus.cpp new file mode 100644 index 0000000..dd29786 --- /dev/null +++ b/src/testcase/0008_focus.cpp @@ -0,0 +1,262 @@ +#include "e_test_event.h" + +using ::testing::Test; + +extern EtEventLoop *gLoop; + +class EtTestFocus : public ::testing::Test +{ + public: + EtTestFocus() + { + }; + ~EtTestFocus() + { + gLoop->WaitForDestroy(); + + if (this->tw_register) + { + gLoop->DeregisterWin(this->tw_register); + this->tw_register = NULL; + } + + if (this->tw_red) + { + delete this->tw_red; + this->tw_red = NULL; + } + + if (this->tw_green) + { + delete this->tw_green; + this->tw_green = NULL; + } + + if (this->tw_blue) + { + delete this->tw_blue; + this->tw_blue = NULL; + } + + if (gLoop->HasLastWinInfoList()) + gLoop->FreeLastWinInfoList(); + }; + + protected: + EtWin *tw_red = NULL; + EtWin *tw_green = NULL; + EtWin *tw_blue = NULL; + + EtWin *tw_register = NULL; + + Eina_Bool InitTC(Eina_Bool show_win, Eina_Bool use_geom) + { + Eina_Bool result = EINA_FALSE; + + this->tw_red = new EtWin(); + result = this->tw_red->Init(NULL, + ELM_WIN_BASIC, + EINA_FALSE, + "EtWin Red", + 0, 0, 720, 640, EINA_FALSE, + E_LAYER_CLIENT_NORMAL, + E_TC_WIN_COLOR_RED); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + this->tw_red->native_win = gLoop->GetWinId(this->tw_red->elm_win); + + if (show_win) + { + this->tw_red->UpdateGeometry(); + this->tw_red->Show(); + } + + this->tw_green = new EtWin(); + result = this->tw_green->Init(NULL, + ELM_WIN_BASIC, + EINA_FALSE, + "EtWin Green", + 0, 0, 720, 640, EINA_FALSE, + E_LAYER_CLIENT_NORMAL, + E_TC_WIN_COLOR_GREEN); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + this->tw_green->native_win = gLoop->GetWinId(this->tw_green->elm_win); + + if (show_win) + { + this->tw_green->UpdateGeometry(); + this->tw_green->Show(); + } + + this->tw_blue = new EtWin(); + result = this->tw_blue->Init(NULL, + ELM_WIN_BASIC, + EINA_FALSE, + "EtWin Blue", + 0, 0, 720, 640, use_geom, + E_LAYER_CLIENT_NORMAL, + E_TC_WIN_COLOR_GREEN); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + this->tw_blue->native_win = gLoop->GetWinId(this->tw_blue->elm_win); + + if (show_win) + { + this->tw_blue->UpdateGeometry(); + this->tw_blue->Show(); + + this->RegisterTCWin(this->tw_blue); + } + + gLoop->WaitEvent(E_TC_EVENT_TYPE_VIS_ON); + + return EINA_TRUE; + }; + + Eina_Bool RegisterTCWin(EtWin *tw) + { + Eina_Bool result = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); + + if (this->tw_register) + { + result = gLoop->DeregisterWin(this->tw_register); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + this->tw_register = NULL; + } + + result = gLoop->RegisterWin(tw); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + this->tw_register = tw; + + return EINA_TRUE; + }; + + Eina_Bool ShowTCWin(EtWin *tw) + { + Eina_Bool result = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE); + + result = this->RegisterTCWin(tw); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + + tw->UpdateGeometry(); + tw->Show(); + + return EINA_TRUE; + }; +}; + +TEST_F(EtTestFocus, focus_basic) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + + result = this->InitTC(EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(result); + + // Expected focus result: + // [Top] Blue[focused] -> Green -> Red [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->native_win == this->tw_blue->native_win) + ASSERT_TRUE(tw->Focus.obj); + else + ASSERT_FALSE(tw->Focus.obj); + } + gLoop->FreeWinInfoList(list); +} + +TEST_F(EtTestFocus, focus_lower) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + + result = this->InitTC(EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(result); + + // make tw_blue lower + result = gLoop->SetWinStack(this->tw_blue, NULL, EINA_FALSE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + ASSERT_TRUE(result); + + // Expected focus result: + // [Top] Green[focused] -> Red -> ... -> Blue [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->native_win == this->tw_green->native_win) + ASSERT_TRUE(tw->Focus.obj); + else + ASSERT_FALSE(tw->Focus.obj); + } + gLoop->FreeWinInfoList(list); +} + +TEST_F(EtTestFocus, focus_raise) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + + result = this->InitTC(EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(result); + + // make tw_red raise + result = gLoop->SetWinStack(this->tw_red, NULL, EINA_TRUE); + gLoop->WaitEvent(E_TC_EVENT_TYPE_FOCUS_CHANGED); + ASSERT_TRUE(result); + + // Expected focus result: + // [Top] Red[focused] -> Blue -> Green [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->native_win == this->tw_red->native_win) + ASSERT_TRUE(tw->Focus.obj); + else + ASSERT_FALSE(tw->Focus.obj); + } + gLoop->FreeWinInfoList(list); +} + +TEST_F(EtTestFocus, focus_destroy) +{ + EtWin *tw = NULL; + Eina_Bool result = EINA_FALSE; + Eina_List *list = NULL, *l = NULL; + + result = this->InitTC(EINA_TRUE, EINA_FALSE); + ASSERT_TRUE(result); + + // delete tw_blue + this->tw_blue->Hide(); + delete this->tw_blue; + this->tw_blue = NULL; + gLoop->WaitEvent(E_TC_EVENT_TYPE_VIS_OFF); + + // Expected focus result: + // [Top] Green[focused] -> Red [Bottom] + list = gLoop->GetWinInfoList(); + ASSERT_TRUE(list != NULL); + + EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) + { + if (tw->native_win == this->tw_green->native_win) + ASSERT_TRUE(tw->Focus.obj); + else + ASSERT_FALSE(tw->Focus.obj); + } + gLoop->FreeWinInfoList(list); +} -- 2.7.4 From cd9e5559f0cdfa2ce79fcc9493e0c7a80e829e5c Mon Sep 17 00:00:00 2001 From: Gwanglim Lee Date: Wed, 7 Mar 2018 13:47:52 +0900 Subject: [PATCH 12/16] fixed a warning Change-Id: I526ea1e2f130aa8fcf381945e9a5872f6778b4ac --- src/testcase/0006_tzsh.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/testcase/0006_tzsh.cpp b/src/testcase/0006_tzsh.cpp index bbc733b..051af1c 100644 --- a/src/testcase/0006_tzsh.cpp +++ b/src/testcase/0006_tzsh.cpp @@ -137,7 +137,6 @@ _cb_state_change(void *data, */ TEST_F(EtTestTzsh, scrsaver_basic) { - Eina_Bool result = EINA_FALSE; Eina_List *list = NULL, *l = NULL; EtWin *tw = NULL; -- 2.7.4 From 5c7cd42a96e6220e7580eabbad1409c4144b50b4 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Thu, 8 Mar 2018 19:44:28 +0900 Subject: [PATCH 13/16] e-tizen-testcase: remove debug msg and rename internal values Change-Id: I44343ed986bf93fb5691526526b94a67b93b56fa --- src/e_test_event.cpp | 3 --- src/e_test_event.h | 4 +-- src/testcase/0006_tzsh.cpp | 50 +++++++++++++++++------------------ src/testcase/0007_rotation.cpp | 60 +++++++++++++++++++++--------------------- 4 files changed, 57 insertions(+), 60 deletions(-) diff --git a/src/e_test_event.cpp b/src/e_test_event.cpp index fca38b6..be51cfb 100644 --- a/src/e_test_event.cpp +++ b/src/e_test_event.cpp @@ -665,9 +665,6 @@ void EtEventLoop::RunTimer() void EtEventLoop::WaitForDestroy() { - printf("###########################\n"); - printf("Destroy Wait Timer Start!!!\n"); - printf("###########################\n"); this->SetWaitWorkTime(E_TEST_WORK_TIME); this->RunTimer(); elm_run(); diff --git a/src/e_test_event.h b/src/e_test_event.h index 87e4f25..c7210a1 100644 --- a/src/e_test_event.h +++ b/src/e_test_event.h @@ -40,8 +40,6 @@ class EtEventLoop ~EtEventLoop(); /* requests */ - Eina_Bool Init(); - void Shutdown(); Eina_Bool RegisterWin(EtWin *tw); Eina_Bool DeregisterWin(EtWin *tw); Eina_Bool SetWinStack(EtWin *tw, @@ -74,6 +72,8 @@ class EtEventLoop Eina_Bool WaitEvent(E_TC_Event_Type ev); /* methods */ + Eina_Bool Init(); + void Shutdown(); void Work(); void PrintWinInfoList(); void SetWaitWorkTime(double time) { this->time_for_wait_work_ = time; }; diff --git a/src/testcase/0006_tzsh.cpp b/src/testcase/0006_tzsh.cpp index 051af1c..05ff65e 100644 --- a/src/testcase/0006_tzsh.cpp +++ b/src/testcase/0006_tzsh.cpp @@ -29,47 +29,47 @@ class EtTestTzsh : public :: testing::Test chk_ev_state_not_idle_ = EINA_FALSE; chk_cb_called_ = 0; }; - ~EtTestTzsh() + ~EtTestTzsh() { gLoop->WaitForDestroy(); if (tz_scrsaver_mng) - tzsh_screensaver_manager_service_destroy(tz_scrsaver_mng); + tzsh_screensaver_manager_service_destroy(tz_scrsaver_mng); if (tz_scrsaver) - tzsh_screensaver_service_destroy(tz_scrsaver); + tzsh_screensaver_service_destroy(tz_scrsaver); if (tzsh) - tzsh_destroy(tzsh); + tzsh_destroy(tzsh); - if (tw) + if (tw_base) { - gLoop->DeregisterWin(tw); - delete tw; + gLoop->DeregisterWin(tw_base); + delete tw_base; } if (gLoop->HasLastWinInfoList()) gLoop->FreeLastWinInfoList(); }; protected: - EtWin *tw = NULL; + EtWin *tw_base = NULL; Eina_Bool InitTC() { Eina_Bool result = EINA_FALSE; - this->tw = new EtWin(); - result = this->tw->Init(NULL, - ELM_WIN_BASIC, - EINA_FALSE, - "EtWin Tzsh", - 0, 0, 0, 0, EINA_FALSE, - (E_Layer) 0, - E_TC_WIN_COLOR_RED); + this->tw_base = new EtWin(); + result = this->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(result, EINA_FALSE); - this->tw->native_win = gLoop->GetWinId(this->tw->elm_win); + this->tw_base->native_win = gLoop->GetWinId(this->tw_base->elm_win); - result = gLoop->RegisterWin(this->tw); + result = gLoop->RegisterWin(this->tw_base); EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); return EINA_TRUE; @@ -77,8 +77,8 @@ class EtTestTzsh : public :: testing::Test }; /****************** - callbacks -*******************/ + callbacks + *******************/ static void _cb_state_change(void *data, tzsh_screensaver_manager_service_h service, @@ -145,14 +145,14 @@ TEST_F(EtTestTzsh, scrsaver_basic) this->tzsh = tzsh_create(TZSH_TOOLKIT_TYPE_EFL); ASSERT_TRUE(this->tzsh != NULL); - this->tz_win = elm_win_window_id_get(this->tw->elm_win); + this->tz_win = elm_win_window_id_get(this->tw_base->elm_win); ASSERT_NE(0, this->tz_win); this->tz_scrsaver = tzsh_screensaver_service_create(this->tzsh, this->tz_win); ASSERT_TRUE(tz_scrsaver != NULL); - this->tw->UpdateGeometry(); - this->tw->Show(); + this->tw_base->UpdateGeometry(); + this->tw_base->Show(); gLoop->WaitEvent(E_TC_EVENT_TYPE_VIS_ON); list = gLoop->GetWinInfoList(); @@ -160,7 +160,7 @@ TEST_F(EtTestTzsh, scrsaver_basic) EINA_LIST_CAST_FOREACH(list, l, tw, EtWin*) { - if (tw->native_win != this->tw->native_win) + if (tw->native_win != this->tw_base->native_win) continue; // check layer @@ -207,7 +207,7 @@ TEST_F(EtTestTzsh, scrsaver_mng_basic) this->tzsh = tzsh_create(TZSH_TOOLKIT_TYPE_EFL); ASSERT_TRUE(this->tzsh != NULL); - this->tz_win = elm_win_window_id_get(this->tw->elm_win); + this->tz_win = elm_win_window_id_get(this->tw_base->elm_win); ASSERT_NE(0, this->tz_win); this->tz_scrsaver_mng = tzsh_screensaver_manager_service_create(this->tzsh, this->tz_win); diff --git a/src/testcase/0007_rotation.cpp b/src/testcase/0007_rotation.cpp index 3566125..05b589a 100644 --- a/src/testcase/0007_rotation.cpp +++ b/src/testcase/0007_rotation.cpp @@ -15,11 +15,11 @@ class EtTestRotation : public ::testing::Test gLoop->WaitForDestroy(); if (tw_register) - gLoop->DeregisterWin(tw_register); + gLoop->DeregisterWin(tw_register); - if (tw) + if (tw_base) { - delete tw; + delete tw_base; } if (gLoop->HasLastWinInfoList()) @@ -28,41 +28,41 @@ class EtTestRotation : public ::testing::Test protected: const int rots[4] = {0, 90, 180, 270}; - EtWin *tw = NULL; + EtWin *tw_base = NULL; EtWin *tw_register = NULL; int saved_rot_ = 0; Eina_Bool InitTC() - { - Eina_Bool result = EINA_FALSE; + { + Eina_Bool result = EINA_FALSE; - this->tw = new EtWin(); - result = this->tw->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(result, EINA_FALSE); - this->tw->native_win = gLoop->GetWinId(this->tw->elm_win); + this->tw_base = new EtWin(); + result = this->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(result, EINA_FALSE); + this->tw_base->native_win = gLoop->GetWinId(this->tw_base->elm_win); - // available rotations - elm_win_wm_rotation_available_rotations_set(this->tw->elm_win, - this->rots, 4); + // available rotations + elm_win_wm_rotation_available_rotations_set(this->tw_base->elm_win, + this->rots, 4); - result = gLoop->RegisterWin(this->tw); - EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + result = gLoop->RegisterWin(this->tw_base); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); - this->tw_register = this->tw; + this->tw_register = this->tw_base; - this->tw->UpdateGeometry(); - this->tw->Show(); - gLoop->WaitEvent(E_TC_EVENT_TYPE_VIS_ON); + this->tw_base->UpdateGeometry(); + this->tw_base->Show(); + gLoop->WaitEvent(E_TC_EVENT_TYPE_VIS_ON); - return EINA_TRUE; - }; + return EINA_TRUE; + }; Eina_Bool TestWinRotation(EtWin *tw, int rot) { @@ -100,10 +100,10 @@ TEST_F(EtTestRotation, available_rotations) result = this->InitTC(); ASSERT_TRUE(result); - result = gLoop->GetWinInfo(this->tw); + result = gLoop->GetWinInfo(this->tw_base); ASSERT_TRUE(result); - this->saved_rot_ = this->tw->rot; + this->saved_rot_ = this->tw_base->rot; for (rot = ((this->saved_rot_ + 90) % 360); rot == this->saved_rot_; @@ -112,7 +112,7 @@ TEST_F(EtTestRotation, available_rotations) /* hard coded, reverse portrait(180) mode is disabled in mobile */ if (rot == 180) continue; - result = this->TestWinRotation(this->tw, rot); + result = this->TestWinRotation(this->tw_base, rot); ASSERT_TRUE(result); } } -- 2.7.4 From 9beb8e7449b9e77c9f03738b3e86fa0d1ee90dc8 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Thu, 8 Mar 2018 19:54:32 +0900 Subject: [PATCH 14/16] e-tizen-testcase: bug fixes due to unerased timer There was a bug in 0001_easy testcase and 0006_tzsh testcase due to a timer was not cleared. This patch fixes this problem. Change-Id: I35e479b8b3532a5627610b5271993bf97ad06968 --- src/e_test_event.cpp | 31 ++++++++++++++++++------- src/e_test_event.h | 10 ++++++-- src/testcase/0001_easy.cpp | 15 +++++++++--- src/testcase/0002_base_operation.cpp | 3 ++- src/testcase/0003_base_operation_multi_wins.cpp | 3 ++- src/testcase/0004_transient_for.cpp | 3 ++- src/testcase/0005_notification.cpp | 3 ++- src/testcase/0006_tzsh.cpp | 5 ++-- src/testcase/0007_rotation.cpp | 3 ++- src/testcase/0008_focus.cpp | 3 ++- 10 files changed, 58 insertions(+), 21 deletions(-) diff --git a/src/e_test_event.cpp b/src/e_test_event.cpp index be51cfb..56639f9 100644 --- a/src/e_test_event.cpp +++ b/src/e_test_event.cpp @@ -50,7 +50,8 @@ static const struct tizen_resource_listener _e_test_tizen_resource_listener = EtEventLoop::EtEventLoop() { this->log_dom_ = -1; - this->time_for_wait_work_ = E_TEST_WORK_TIME; + this->Worker.work_timer_ = NULL; + this->Worker.time_for_wait_work_ = E_TEST_WORK_TIME; this->tizen_policy_ = NULL; this->tizen_surface_ = NULL; @@ -614,10 +615,21 @@ finish: void EtEventLoop::Work() { /* give a turn to deal with deferred job for E_TEST_WORK_TIME */ - ecore_timer_add(time_for_wait_work_, _cb_work_timeout, NULL); + this->Worker.work_timer_ = ecore_timer_add(this->Worker.time_for_wait_work_, _cb_work_timeout, this); elm_run(); } +void EtEventLoop::FinishWork() +{ + if (this->Worker.work_timer_) + { + ecore_timer_del(this->Worker.work_timer_); + this->Worker.work_timer_ = NULL; + } + + elm_exit(); +} + void EtEventLoop::PrintWinInfoList() { EtWin *tw = NULL; @@ -648,19 +660,19 @@ void EtEventLoop::PrintWinInfoList() void EtEventLoop::DelTimer() { - if (this->Ev.expire_timer) + if (this->Worker.work_timer_) { - ecore_timer_del(this->Ev.expire_timer); - this->Ev.expire_timer = NULL; + ecore_timer_del(this->Worker.work_timer_); + this->Worker.work_timer_ = NULL; } } void EtEventLoop::RunTimer() { - if (this->Ev.expire_timer) + if (this->Worker.work_timer_) this->DelTimer(); - this->Ev.expire_timer = ecore_timer_add(this->time_for_wait_work_, _cb_work_timeout, NULL); + this->Worker.work_timer_ = ecore_timer_add(this->Worker.time_for_wait_work_, _cb_work_timeout, this); } void EtEventLoop::WaitForDestroy() @@ -1051,7 +1063,10 @@ finish: static Eina_Bool _cb_work_timeout(void *data) { - elm_exit(); + EtEventLoop *ev_loop = (EtEventLoop *)data; + + ev_loop->FinishWork(); + return ECORE_CALLBACK_CANCEL; } diff --git a/src/e_test_event.h b/src/e_test_event.h index c7210a1..7972382 100644 --- a/src/e_test_event.h +++ b/src/e_test_event.h @@ -16,7 +16,6 @@ class EtEventLoop struct tizen_surface *tizen_surface_ = NULL; int log_dom_ = -1; - double time_for_wait_work_ = 0.0; struct { @@ -27,6 +26,12 @@ class EtEventLoop struct { + Ecore_Timer *work_timer_; + double time_for_wait_work_; + } Worker; + + struct + { Eldbus_Connection *conn; Eldbus_Proxy *proxy; Eldbus_Object *obj; @@ -75,8 +80,9 @@ class EtEventLoop Eina_Bool Init(); void Shutdown(); void Work(); + void FinishWork(); void PrintWinInfoList(); - void SetWaitWorkTime(double time) { this->time_for_wait_work_ = time; }; + void SetWaitWorkTime(double time) { this->Worker.time_for_wait_work_ = time; }; void DelTimer(); void RunTimer(); void WaitForDestroy(); diff --git a/src/testcase/0001_easy.cpp b/src/testcase/0001_easy.cpp index 5650f7e..d94415b 100644 --- a/src/testcase/0001_easy.cpp +++ b/src/testcase/0001_easy.cpp @@ -9,6 +9,16 @@ extern EtEventLoop *gLoop; class EtTestEasy : public ::testing::Test { + public: + EtTestEasy() + { + }; + ~EtTestEasy() + { + if (HasFailure()) + gLoop->WaitForDestroy(); + }; + protected: static void SetUpTestCase() {}; static void TearDownTestCase() {}; @@ -57,7 +67,7 @@ finish: if (*result == EINA_FALSE) ERR("errname:%s errmsg:%s\n", name, text); - elm_exit(); + gLoop->FinishWork(); } static void @@ -99,7 +109,7 @@ finish: ERR("errname:%s errmsg:%s\n", name, text); } - elm_exit(); + gLoop->FinishWork(); } TEST_F(EtTestEasy, base_pass) @@ -131,7 +141,6 @@ TEST_F(EtTestEasy, introspect) ASSERT_TRUE(p != NULL); gLoop->Work(); - ASSERT_TRUE(result); } diff --git a/src/testcase/0002_base_operation.cpp b/src/testcase/0002_base_operation.cpp index b48eced..e46c926 100644 --- a/src/testcase/0002_base_operation.cpp +++ b/src/testcase/0002_base_operation.cpp @@ -13,7 +13,8 @@ class EtTestBaseOperation : public ::testing::Test }; ~EtTestBaseOperation() { - gLoop->WaitForDestroy(); + if (HasFailure()) + gLoop->WaitForDestroy(); if (tw) { diff --git a/src/testcase/0003_base_operation_multi_wins.cpp b/src/testcase/0003_base_operation_multi_wins.cpp index db1c5fc..35dc9a3 100644 --- a/src/testcase/0003_base_operation_multi_wins.cpp +++ b/src/testcase/0003_base_operation_multi_wins.cpp @@ -13,7 +13,8 @@ class EtTestBaseMulti : public ::testing::Test }; ~EtTestBaseMulti() { - gLoop->WaitForDestroy(); + if (HasFailure()) + gLoop->WaitForDestroy(); if (tw_register) gLoop->DeregisterWin(tw_register); diff --git a/src/testcase/0004_transient_for.cpp b/src/testcase/0004_transient_for.cpp index fc74766..5b8c468 100644 --- a/src/testcase/0004_transient_for.cpp +++ b/src/testcase/0004_transient_for.cpp @@ -12,7 +12,8 @@ class EtTestTransientFor : public ::testing::Test }; ~EtTestTransientFor() { - gLoop->WaitForDestroy(); + if (HasFailure()) + gLoop->WaitForDestroy(); if (tw_register) gLoop->DeregisterWin(tw_register); diff --git a/src/testcase/0005_notification.cpp b/src/testcase/0005_notification.cpp index 8dd06f4..8b94839 100644 --- a/src/testcase/0005_notification.cpp +++ b/src/testcase/0005_notification.cpp @@ -13,7 +13,8 @@ class EtTestNotification : public ::testing::Test }; ~EtTestNotification() { - gLoop->WaitForDestroy(); + if (HasFailure()) + gLoop->WaitForDestroy(); if (tw_register) gLoop->DeregisterWin(tw_register); diff --git a/src/testcase/0006_tzsh.cpp b/src/testcase/0006_tzsh.cpp index 05ff65e..7ded964 100644 --- a/src/testcase/0006_tzsh.cpp +++ b/src/testcase/0006_tzsh.cpp @@ -31,7 +31,8 @@ class EtTestTzsh : public :: testing::Test }; ~EtTestTzsh() { - gLoop->WaitForDestroy(); + if (HasFailure()) + gLoop->WaitForDestroy(); if (tz_scrsaver_mng) tzsh_screensaver_manager_service_destroy(tz_scrsaver_mng); @@ -115,7 +116,7 @@ _cb_state_change(void *data, tc_data->chk_timeout_val_ = EINA_TRUE; - elm_exit(); + gLoop->FinishWork(); } else { diff --git a/src/testcase/0007_rotation.cpp b/src/testcase/0007_rotation.cpp index 05b589a..a72a486 100644 --- a/src/testcase/0007_rotation.cpp +++ b/src/testcase/0007_rotation.cpp @@ -12,7 +12,8 @@ class EtTestRotation : public ::testing::Test }; ~EtTestRotation() { - gLoop->WaitForDestroy(); + if (HasFailure()) + gLoop->WaitForDestroy(); if (tw_register) gLoop->DeregisterWin(tw_register); diff --git a/src/testcase/0008_focus.cpp b/src/testcase/0008_focus.cpp index dd29786..9465080 100644 --- a/src/testcase/0008_focus.cpp +++ b/src/testcase/0008_focus.cpp @@ -12,7 +12,8 @@ class EtTestFocus : public ::testing::Test }; ~EtTestFocus() { - gLoop->WaitForDestroy(); + if (HasFailure()) + gLoop->WaitForDestroy(); if (this->tw_register) { -- 2.7.4 From 12501ec11f526d1fff1b572948c26bd4d2ab6b83 Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Tue, 13 Mar 2018 21:39:45 +0900 Subject: [PATCH 15/16] e-tizen-testcase: add ResetRegisterWindow request method Change-Id: I8092c40ee17a8a8aa3061be00b375a30ad35f26b --- src/e_test_event.cpp | 22 ++++++++++++++++++++++ src/e_test_event.h | 1 + src/testcase/0001_easy.cpp | 1 + 3 files changed, 24 insertions(+) diff --git a/src/e_test_event.cpp b/src/e_test_event.cpp index 56639f9..78b4ddb 100644 --- a/src/e_test_event.cpp +++ b/src/e_test_event.cpp @@ -126,6 +126,10 @@ Eina_Bool EtEventLoop::Init() "org.enlightenment.wm.Test"); EINA_SAFETY_ON_NULL_RETURN_VAL(this->Dbus.proxy, EINA_FALSE); + // reset registered window of e_test_helper + result = this->ResetRegisterWin(); + EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); + return EINA_TRUE; } @@ -204,6 +208,24 @@ Eina_Bool EtEventLoop::DeregisterWin(EtWin *tw) return accepted; } +Eina_Bool EtEventLoop::ResetRegisterWin() +{ + Eldbus_Pending *p = NULL; + Eina_Bool accepted = EINA_FALSE; + + p = eldbus_proxy_call(this->Dbus.proxy, + "ResetRegisterWindow", + _cb_method_window_register, + &accepted, + -1, + ""); + EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE); + + elm_run(); + + return accepted; +} + Eina_Bool EtEventLoop::SetWinStack(EtWin *tw, EtWin *sibiling, Eina_Bool above) diff --git a/src/e_test_event.h b/src/e_test_event.h index 7972382..f5ff661 100644 --- a/src/e_test_event.h +++ b/src/e_test_event.h @@ -47,6 +47,7 @@ class EtEventLoop /* requests */ Eina_Bool RegisterWin(EtWin *tw); Eina_Bool DeregisterWin(EtWin *tw); + Eina_Bool ResetRegisterWin(); Eina_Bool SetWinStack(EtWin *tw, EtWin *sibiling, Eina_Bool above); diff --git a/src/testcase/0001_easy.cpp b/src/testcase/0001_easy.cpp index d94415b..cb28754 100644 --- a/src/testcase/0001_easy.cpp +++ b/src/testcase/0001_easy.cpp @@ -41,6 +41,7 @@ _cb_introspect(void *data, if ((!strstr(arg, "method name=\"RegisterWindow\"" )) || (!strstr(arg, "method name=\"DeregisterWindow\"" )) || + (!strstr(arg, "method name=\"ResetRegisterWindow\"" )) || (!strstr(arg, "method name=\"SetWindowStack\"" )) || (!strstr(arg, "method name=\"GetWinInfo\"" )) || (!strstr(arg, "method name=\"GetWinsInfo\"" )) || -- 2.7.4 From 3c361518d70b750e716ff2ca26250e1d0c3b65ea Mon Sep 17 00:00:00 2001 From: "JunSeok, Kim" Date: Tue, 20 Mar 2018 17:03:45 +0900 Subject: [PATCH 16/16] e-tizen-testcase: use ecore_wl2 instead of ecore_wl library Change-Id: Ieccf43415b15fefb6aa03e49c086e8fb25b57bb0 --- configure.ac | 2 +- packaging/e-tizen-testcase.spec | 3 ++- src/e_test_event.cpp | 36 +++++++++++++++++++++--------------- src/e_test_util.h | 1 - 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index 32345e2..d9c3d68 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,7 @@ requirements="\ enlightenment \ capi-ui-efl-util \ wayland-client \ - ecore-wayland \ + ecore-wl2 \ tizen-extension-client \ tzsh-screensaver-manager-service \ tzsh-screensaver-service \ diff --git a/packaging/e-tizen-testcase.spec b/packaging/e-tizen-testcase.spec index e309be5..bea6220 100644 --- a/packaging/e-tizen-testcase.spec +++ b/packaging/e-tizen-testcase.spec @@ -9,6 +9,7 @@ License: BSD-2-Clause BuildRequires: pkgconfig(enlightenment) BuildRequires: pkgconfig(eldbus) BuildRequires: pkgconfig(capi-ui-efl-util) +BuildRequires: pkgconfig(ecore-wl2) BuildRequires: gettext BuildRequires: pkgconfig(tizen-extension-client) BuildRequires: pkgconfig(tzsh-screensaver-manager-service) @@ -23,7 +24,7 @@ This package is a test case runner for enlightenment. %build export GC_SECTIONS_FLAGS="-fdata-sections -ffunction-sections -Wl,--gc-sections" -export CXXFLAGS+=" -Wall -g -fPIC -rdynamic ${GC_SECTIONS_FLAGS}" +export CXXFLAGS+=" -Wall -g -fPIC -rdynamic ${GC_SECTIONS_FLAGS} -DEFL_BETA_API_SUPPORT " export LDFLAGS+=" -Wl,--hash-style=both -Wl,--as-needed -Wl,--rpath=/usr/lib" %autogen diff --git a/src/e_test_event.cpp b/src/e_test_event.cpp index 78b4ddb..574470b 100644 --- a/src/e_test_event.cpp +++ b/src/e_test_event.cpp @@ -1,3 +1,5 @@ +#include + #include "e_test_event.h" #define E_TEST_WORK_TIME 3.0 @@ -105,6 +107,10 @@ Eina_Bool EtEventLoop::Init() this->log_dom_ = eina_log_domain_register("e-tc", EINA_COLOR_BLUE); + // Init Ecore_Wl2 + if (!ecore_wl2_connected_display_get(NULL)) + ecore_wl2_display_connect(NULL); + // init tizen_extension protocol result = GetTizenPolicy(); EINA_SAFETY_ON_FALSE_RETURN_VAL(result, EINA_FALSE); @@ -706,15 +712,15 @@ void EtEventLoop::WaitForDestroy() Ecore_Window EtEventLoop::GetWinId(Evas_Object *elm_win) { - Ecore_Wl_Window *wlwin = NULL; + Ecore_Wl2_Window *wlwin = NULL; struct wl_surface *surf = NULL; Ecore_Window id = 0; struct tizen_resource *tzres = NULL; - wlwin = elm_win_wl_window_get(elm_win); + wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(elm_win); EINA_SAFETY_ON_NULL_RETURN_VAL(wlwin, 0); - surf = ecore_wl_window_surface_get(wlwin); + surf = ecore_wl2_window_surface_get(wlwin); EINA_SAFETY_ON_NULL_RETURN_VAL(surf, 0); if (!this->tizen_surface_) @@ -735,19 +741,19 @@ Ecore_Window EtEventLoop::GetWinId(Evas_Object *elm_win) Eina_Bool EtEventLoop::GetTizenPolicy() { - Eina_Inlist *globals = NULL; - Ecore_Wl_Global *global = NULL; + Eina_Iterator *globals = NULL; + Ecore_Wl2_Global *global = NULL; struct wl_registry *registry = NULL; if (!this->tizen_policy_) { - registry = ecore_wl_registry_get(); - globals = ecore_wl_globals_get(); + 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_INLIST_FOREACH(globals, global) + EINA_ITERATOR_FOREACH(globals, global) { if (!strcmp(global->interface, "tizen_policy")) { @@ -755,7 +761,7 @@ Eina_Bool EtEventLoop::GetTizenPolicy() wl_registry_bind(registry, global->id, &tizen_policy_interface, - 7); + (global->version > 7)? 7 : global->version); } } @@ -767,19 +773,19 @@ Eina_Bool EtEventLoop::GetTizenPolicy() Eina_Bool EtEventLoop::GetTizenSurface() { - Eina_Inlist *globals = NULL; - Ecore_Wl_Global *global = NULL; + Eina_Iterator *globals = NULL; + Ecore_Wl2_Global *global = NULL; struct wl_registry *registry = NULL; if (!this->tizen_surface_) { - registry = ecore_wl_registry_get(); - globals = ecore_wl_globals_get(); + 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_INLIST_FOREACH(globals, global) + EINA_ITERATOR_FOREACH(globals, global) { if (!strcmp(global->interface, "tizen_surface")) { @@ -787,7 +793,7 @@ Eina_Bool EtEventLoop::GetTizenSurface() wl_registry_bind(registry, global->id, &tizen_surface_interface, - 1); + (global->version > 1)? 1 : global->version); } } diff --git a/src/e_test_util.h b/src/e_test_util.h index 793cc96..702e3ec 100644 --- a/src/e_test_util.h +++ b/src/e_test_util.h @@ -9,7 +9,6 @@ extern "C" { #include "eina_list_ext.h" #include #include -#include #include #include -- 2.7.4