summaryrefslogtreecommitdiff
path: root/src/tests/ecore/efl_app_test_loop.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-02-01 15:11:04 -0500
committerDerek Foreman <derek.foreman.samsung@gmail.com>2019-02-01 15:13:36 -0600
commit21bdcf42650a4f4bbe6f634d2133c6a6f50fba3c (patch)
treeef651d44a75f000a1811be5a437c26de6fe24186 /src/tests/ecore/efl_app_test_loop.c
parent08b7974fa19170bbba862fbe1f217e1988e8ebfa (diff)
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
Diffstat (limited to '')
-rw-r--r--src/tests/ecore/efl_app_test_loop.c45
1 files changed, 45 insertions, 0 deletions
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)
39} 39}
40EFL_END_TEST 40EFL_END_TEST
41 41
42static void
43efl_app_test_efl_loop_concentric_fail(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
44{
45 ck_abort_msg("test timeout");
46}
47
48static void
49loop_idle(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
50{
51 static int num = 0;
52
53 if (num++ == 5) efl_loop_quit(efl_main_loop_get(), eina_value_int_init(0));
54}
55
56static void
57loop_timer_tick(void *data, const Efl_Event *ev EINA_UNUSED)
58{
59 efl_loop_iterate(data);
60}
61
62EFL_START_TEST(efl_app_test_efl_loop_concentric)
63{
64 Eo *loop, *loop2, *timer, *timer2;
65 int exitcode;
66
67 loop = efl_main_loop_get();
68 efl_event_callback_add(loop, EFL_LOOP_EVENT_IDLE, loop_idle, NULL);
69 loop2 = efl_add(EFL_LOOP_CLASS, loop);
70 timer = efl_add(EFL_LOOP_TIMER_CLASS, loop2,
71 efl_loop_timer_interval_set(efl_added, 0.01),
72 efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TICK, loop_timer_tick, loop)
73 );
74 timer2 = efl_add(EFL_LOOP_TIMER_CLASS, loop,
75 efl_loop_timer_interval_set(efl_added, 0.5),
76 efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TICK, efl_app_test_efl_loop_concentric_fail, NULL)
77 );
78 exitcode = efl_loop_exit_code_process(efl_loop_begin(loop));
79 ck_assert_int_eq(exitcode, 0);
80 efl_del(timer2);
81 efl_del(timer);
82 efl_del(loop2);
83}
84EFL_END_TEST
85
42void efl_app_test_efl_loop(TCase *tc) 86void efl_app_test_efl_loop(TCase *tc)
43{ 87{
44 tcase_add_test(tc, efl_app_test_efl_loop_register); 88 tcase_add_test(tc, efl_app_test_efl_loop_register);
89 tcase_add_test(tc, efl_app_test_efl_loop_concentric);
45} 90}