[prev in list] [next in list] [prev in thread] [next in thread]
List: enlightenment-devel
Subject: Re: [E-devel] [EGIT] [core/efl] master 01/01: tests: add explicit test for concentric loop usage
From: Carsten Haitzler (The Rasterman) <raster () rasterman ! com>
Date: 2019-02-02 13:17:49
Message-ID: 20190202131749.6f5723690f2751ecec0cde0b () rasterman ! com
[Download RAW message or body]
On Fri, 01 Feb 2019 13:13:43 -0800 Mike Blumenkrantz
<michael.blumenkrantz@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 <zmike@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 <derekf@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 - raster@rasterman.com
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic