From e8d40a04b98cc9d86beb4d4501248a0e4014ca33 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 6 Aug 2018 16:26:52 +0900 Subject: [PATCH] tests/elm: when using buffer engine, clamp render and edje timing to 0.05s Summary: this sets manual render on buffer engine windows and dumps the render at every interval in order to avoid doing any real rendering or animating or having to wait on some irrelevant timing. tests using buffer engine just want to complete as fast as possible, as they are never being displayed anywhere, so just perform canvas operations (recalcs mostly) and BAIL Reviewers: Hermet Reviewed By: Hermet Subscribers: cedric, #committers Tags: #efl_tests Differential Revision: https://phab.enlightenment.org/D6749 --- src/tests/elementary/elm_suite.c | 42 +++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/src/tests/elementary/elm_suite.c b/src/tests/elementary/elm_suite.c index b05eb64448..e97795a69f 100644 --- a/src/tests/elementary/elm_suite.c +++ b/src/tests/elementary/elm_suite.c @@ -9,6 +9,7 @@ static int main_pid = -1; static Eina_Bool did_shutdown; static Evas_Object *global_win; +static Eina_Bool buffer = EINA_FALSE; static const Efl_Test_Case etc[] = { { "elm_config", elm_test_config }, @@ -131,6 +132,39 @@ static const Efl_Test_Case etc_init[] = { { NULL, NULL } }; +#define BUFFER_RENDER_INTERVAL 0.05 + +static Eina_Bool +_win_manual_render(void *data) +{ + evas_norender(evas_object_evas_get(data)); + return EINA_TRUE; +} + +static void +_win_show(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + evas_object_data_set(obj, "timer", ecore_timer_add(0.05, _win_manual_render, obj)); +} + +static void +_win_hide(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + ecore_timer_del(evas_object_data_del(obj, "timer")); +} + +static Evas_Object * +_elm_suite_win_create() +{ + Evas_Object *win = elm_win_add(NULL, "elm_suite", ELM_WIN_BASIC); + if (!buffer) return win; + ecore_evas_manual_render_set(ecore_evas_ecore_evas_get(evas_object_evas_get(win)), EINA_TRUE); + edje_frametime_set(0.05); + evas_object_event_callback_add(win, EVAS_CALLBACK_SHOW, _win_show, NULL); + evas_object_event_callback_add(win, EVAS_CALLBACK_HIDE, _win_hide, NULL); + return win; +} + Evas_Object * win_add() { @@ -138,14 +172,13 @@ win_add() { if (global_win) return global_win; } - return elm_win_add(NULL, "elm_suite", ELM_WIN_BASIC);; + return _elm_suite_win_create(); } int main(int argc, char **argv) { int failed_count; - Eina_Bool buffer = EINA_FALSE; if (!_efl_test_option_disp(argc, argv, etc)) return 0; @@ -168,7 +201,10 @@ main(int argc, char **argv) failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1, "Elementary_Init", etc_init, SUITE_INIT_FN(elm), SUITE_SHUTDOWN_FN(elm)); failed_count += !elm_init(1, (char*[]){"exe"}); - if (buffer) global_win = elm_win_add(NULL, "elm_suite", ELM_WIN_BASIC); + if (buffer) + { + global_win = _elm_suite_win_create(); + } EINA_SAFETY_ON_TRUE_RETURN_VAL(failed_count, 255); /* preload default theme */ failed_count += !elm_theme_group_path_find(NULL, "elm/button/base/default");