On Fri, 01 Feb 2019 13:13:43 -0800 Mike Blumenkrantz
<michael.blumenkra...@gmail.com> said:

why is multiple loops a valid case? (multiple loops within the same thread)?
all you do is use them as a container which can already be done more simply
with an eo base class object as a parent. delete this parent to delete all
children (e.g. timers etc.). this adds unneeded complexity and requirements in
efl.

> derekf pushed a commit to branch master.
> 
> http://git.enlightenment.org/core/efl.git/commit/?id=21bdcf42650a4f4bbe6f634d2133c6a6f50fba3c
> 
> commit 21bdcf42650a4f4bbe6f634d2133c6a6f50fba3c
> Author: Mike Blumenkrantz <zm...@samsung.com>
> Date:   Fri Feb 1 15:11:04 2019 -0500
> 
>     tests: add explicit test for concentric loop usage
>     
>     having multiple loops which interact is a valid use case that should be
>     tested to ensure functionality
>     
>     Reviewed-by: Derek Foreman <der...@osg.samsung.com>
>     Differential Revision: https://phab.enlightenment.org/D7868
> ---
>  src/tests/ecore/efl_app_test_loop.c | 45 ++++++++++++++++++++++++++++++++++++
> + 1 file changed, 45 insertions(+)
> 
> diff --git a/src/tests/ecore/efl_app_test_loop.c
> b/src/tests/ecore/efl_app_test_loop.c index f8e0b5548f..f02af90707 100644
> --- a/src/tests/ecore/efl_app_test_loop.c
> +++ b/src/tests/ecore/efl_app_test_loop.c
> @@ -39,7 +39,52 @@ EFL_START_TEST(efl_app_test_efl_loop_register)
>  }
>  EFL_END_TEST
>  
> +static void
> +efl_app_test_efl_loop_concentric_fail(void *data EINA_UNUSED, const
> Efl_Event *ev EINA_UNUSED) +{
> +   ck_abort_msg("test timeout");
> +}
> +
> +static void
> +loop_idle(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
> +{
> +   static int num = 0;
> +
> +   if (num++ == 5) efl_loop_quit(efl_main_loop_get(),
> eina_value_int_init(0)); +}
> +
> +static void
> +loop_timer_tick(void *data, const Efl_Event *ev EINA_UNUSED)
> +{
> +   efl_loop_iterate(data);
> +}
> +
> +EFL_START_TEST(efl_app_test_efl_loop_concentric)
> +{
> +   Eo *loop, *loop2, *timer, *timer2;
> +   int exitcode;
> +
> +   loop = efl_main_loop_get();
> +   efl_event_callback_add(loop, EFL_LOOP_EVENT_IDLE, loop_idle, NULL);
> +   loop2 = efl_add(EFL_LOOP_CLASS, loop);
> +   timer = efl_add(EFL_LOOP_TIMER_CLASS, loop2,
> +     efl_loop_timer_interval_set(efl_added, 0.01),
> +     efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TICK,
> loop_timer_tick, loop)
> +     );
> +   timer2 = efl_add(EFL_LOOP_TIMER_CLASS, loop,
> +     efl_loop_timer_interval_set(efl_added, 0.5),
> +     efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TICK,
> efl_app_test_efl_loop_concentric_fail, NULL)
> +     );
> +   exitcode = efl_loop_exit_code_process(efl_loop_begin(loop));
> +   ck_assert_int_eq(exitcode, 0);
> +   efl_del(timer2);
> +   efl_del(timer);
> +   efl_del(loop2);
> +}
> +EFL_END_TEST
> +
>  void efl_app_test_efl_loop(TCase *tc)
>  {
>     tcase_add_test(tc, efl_app_test_efl_loop_register);
> +   tcase_add_test(tc, efl_app_test_efl_loop_concentric);
>  }
> 
> -- 
> 
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
Carsten Haitzler - ras...@rasterman.com



_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to