From fab4c313f45e6f4cc77d584df1842c633300f059 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 9 Apr 2018 13:37:00 +0200 Subject: [PATCH] tests: move disabled efl loop timer test into efl_app_suite Summary: ref T6815 Depends on D5895 Reviewers: stefan_schmidt Subscribers: cedric Maniphest Tasks: T6815 Differential Revision: https://phab.enlightenment.org/D5896 --- src/Makefile_Ecore.am | 1 + src/tests/ecore/ecore_test_timer.c | 56 ----------------- src/tests/ecore/efl_app_suite.c | 1 + src/tests/ecore/efl_app_suite.h | 1 + src/tests/ecore/efl_app_test_loop_timer.c | 73 +++++++++++++++++++++++ 5 files changed, 76 insertions(+), 56 deletions(-) create mode 100644 src/tests/ecore/efl_app_test_loop_timer.c diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am index 3430ce196a..1915225c59 100644 --- a/src/Makefile_Ecore.am +++ b/src/Makefile_Ecore.am @@ -330,6 +330,7 @@ tests_ecore_ecore_suite_DEPENDENCIES = \ tests_ecore_efl_app_suite_SOURCES = \ tests/ecore/efl_app_test_loop.c \ +tests/ecore/efl_app_test_loop_timer.c \ tests/ecore/efl_app_suite.c \ tests/ecore/efl_app_suite.h diff --git a/src/tests/ecore/ecore_test_timer.c b/src/tests/ecore/ecore_test_timer.c index 93406ad103..e1ffc8f4a8 100644 --- a/src/tests/ecore/ecore_test_timer.c +++ b/src/tests/ecore/ecore_test_timer.c @@ -204,59 +204,6 @@ EFL_START_TEST(ecore_test_timer_inside_call) } EFL_END_TEST -static Eina_Bool -_test_time_cb(void *data) -{ - Eina_Bool *run = data; - - *run = EINA_TRUE; - - return EINA_TRUE; -} - -static void -_test_death_cb(void *data, const Efl_Event *ev EINA_UNUSED) -{ - Eina_Bool *die = data; - - *die = EINA_TRUE; -} - -static void -_test_run_cb(void *data, const Efl_Event *ev EINA_UNUSED) -{ - _test_time_cb(data); -} - -EFL_START_TEST(ecore_test_timer_lifecycle) -{ - Eina_Bool rl = EINA_FALSE, re = EINA_FALSE; - Eina_Bool dl = EINA_FALSE, de = EINA_FALSE; - Ecore_Timer *t; - Eo *et; - - efl_object_init(); - - t = ecore_timer_add(1.0, _test_time_cb, &rl); - efl_event_callback_add((Eo*) t, EFL_EVENT_DEL, _test_death_cb, &dl); - - et = efl_add(EFL_LOOP_TIMER_CLASS, efl_main_loop_get(), - efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TICK, _test_run_cb, &re), - efl_event_callback_add(efl_added, EFL_EVENT_DEL, _test_death_cb, &de), - efl_loop_timer_interval_set(efl_added, 1.0)); - efl_ref(et); - - fail_if(re == EINA_TRUE && rl == EINA_TRUE); - fail_if(dl == EINA_FALSE); - fail_if(de == EINA_TRUE); - - efl_del(et); - fail_if(de == EINA_FALSE); - - efl_object_shutdown(); -} -EFL_END_TEST - EFL_START_TEST(ecore_test_timer_valid_callbackfunc) { @@ -299,9 +246,6 @@ EFL_END_TEST void ecore_test_timer(TCase *tc) { tcase_add_test(tc, ecore_test_timers); -/* XXX: this seems a silly test - that we del the loop object? - tcase_add_test(tc, ecore_test_timer_lifecycle); - */ tcase_add_test(tc, ecore_test_timer_inside_call); tcase_add_test(tc, ecore_test_timer_valid_callbackfunc); tcase_add_test(tc, ecore_test_ecore_main_loop_timer); diff --git a/src/tests/ecore/efl_app_suite.c b/src/tests/ecore/efl_app_suite.c index 1618120f46..25854ff528 100644 --- a/src/tests/ecore/efl_app_suite.c +++ b/src/tests/ecore/efl_app_suite.c @@ -48,6 +48,7 @@ void efl_test_efl_app(TCase *tc) static const Efl_Test_Case etc[] = { { "App", efl_test_efl_app }, { "Loop", efl_app_test_efl_loop }, + { "Loop_Timer", efl_app_test_efl_loop_timer }, { NULL, NULL } }; diff --git a/src/tests/ecore/efl_app_suite.h b/src/tests/ecore/efl_app_suite.h index ae273c0a76..391231dd32 100644 --- a/src/tests/ecore/efl_app_suite.h +++ b/src/tests/ecore/efl_app_suite.h @@ -5,5 +5,6 @@ #include "../efl_check.h" void efl_app_test_efl_app(TCase *tc); void efl_app_test_efl_loop(TCase *tc); +void efl_app_test_efl_loop_timer(TCase *tc); #endif /* _EFL_APP_SUITE_H */ diff --git a/src/tests/ecore/efl_app_test_loop_timer.c b/src/tests/ecore/efl_app_test_loop_timer.c new file mode 100644 index 0000000000..be1c6876c3 --- /dev/null +++ b/src/tests/ecore/efl_app_test_loop_timer.c @@ -0,0 +1,73 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#define EFL_NOLEGACY_API_SUPPORT +#include +#include +#include "efl_app_suite.h" +#include "../efl_check.h" + +/* +static Eina_Bool +_test_time_cb(void *data) +{ + Eina_Bool *run = data; + + *run = EINA_TRUE; + + return EINA_TRUE; +} + +static void +_test_death_cb(void *data, const Efl_Event *ev EINA_UNUSED) +{ + Eina_Bool *die = data; + + *die = EINA_TRUE; +} + +static void +_test_run_cb(void *data, const Efl_Event *ev EINA_UNUSED) +{ + _test_time_cb(data); +} + +EFL_START_TEST(ecore_test_timer_lifecycle) +{ + Eina_Bool rl = EINA_FALSE, re = EINA_FALSE; + Eina_Bool dl = EINA_FALSE, de = EINA_FALSE; + Ecore_Timer *t; + Eo *et; + + efl_object_init(); + + t = ecore_timer_add(1.0, _test_time_cb, &rl); + efl_event_callback_add((Eo*) t, EFL_EVENT_DEL, _test_death_cb, &dl); + + et = efl_add(EFL_LOOP_TIMER_CLASS, efl_main_loop_get(), + efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TICK, _test_run_cb, &re), + efl_event_callback_add(efl_added, EFL_EVENT_DEL, _test_death_cb, &de), + efl_loop_timer_interval_set(efl_added, 1.0)); + efl_ref(et); + + fail_if(re == EINA_TRUE && rl == EINA_TRUE); + fail_if(dl == EINA_FALSE); + fail_if(de == EINA_TRUE); + + efl_del(et); + fail_if(de == EINA_FALSE); + + efl_object_shutdown(); +} +EFL_END_TEST +*/ + +void efl_app_test_efl_loop_timer(TCase *tc EINA_UNUSED) +{ + /* XXX: this seems a silly test - that we del the loop object? + tcase_add_test(tc, ecore_test_timer_lifecycle); + */ +}