forked from enlightenment/efl
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
This commit is contained in:
parent
355effed5f
commit
e8d40a04b9
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue