bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=cb23d14d11c0a751792143014a0f855d3cf957f6
commit cb23d14d11c0a751792143014a0f855d3cf957f6 Author: Mike Blumenkrantz <zm...@samsung.com> Date: Fri Oct 25 12:50:48 2019 -0400 tests/ecore: make timer behavior test even more strict we need to also verify that timers will process out of order solely based on their timestamps and ignoring whether they are "recently-added" additionally verify the behavior of timer interval changing and re-instantiating ref T8434 Reviewed-by: Cedric BAIL <cedric.b...@free.fr> Differential Revision: https://phab.enlightenment.org/D10530 --- src/tests/ecore/ecore_test_timer.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/tests/ecore/ecore_test_timer.c b/src/tests/ecore/ecore_test_timer.c index f394aaef56..06a648578b 100644 --- a/src/tests/ecore/ecore_test_timer.c +++ b/src/tests/ecore/ecore_test_timer.c @@ -290,7 +290,9 @@ EFL_END_TEST EFL_START_TEST(ecore_test_timer_iteration) { + Ecore_Timer *timer; count = 0; + /* verify that timers expire after exactly one loop iteration */ ecore_timer_add(0, _timer_cb, (void *) 1); ecore_main_loop_iterate(); /* timers should not expire for one loop iteration */ @@ -298,6 +300,8 @@ EFL_START_TEST(ecore_test_timer_iteration) ecore_main_loop_iterate(); /* timers should expire after one loop iteration */ ck_assert_int_eq(count, 1); + + /* verify multiple timer expiration in single mainloop iteration */ ecore_timer_add(0, _timer_cb, (void *) 2); ecore_timer_add(0, _timer_cb, (void *) 3); ecore_main_loop_iterate(); @@ -305,10 +309,28 @@ EFL_START_TEST(ecore_test_timer_iteration) ck_assert_int_eq(count, 1); ecore_timer_add(0, _timer_cb, (void *) 4); ecore_main_loop_iterate(); - /* all pending and instantiated timers should expire after one loop iteration */ + /* all pending and instantiated timers should expire after exactly one loop iteration */ ck_assert_int_eq(count, 3); ecore_main_loop_iterate(); + /* this should not interfere with successive timer processing */ + ck_assert_int_eq(count, 4); + + /* verify out-of-order timer processing solely based on timer times */ + timer = ecore_timer_add(1, _timer_cb, (void *) 6); + ecore_main_loop_iterate(); ck_assert_int_eq(count, 4); + ecore_timer_add(0, _timer_cb, (void *) 5); + ecore_main_loop_iterate(); + ck_assert_int_eq(count, 4); + /* timer should expire after exactly 2 iterations */ + ecore_main_loop_iterate(); + ck_assert_int_eq(count, 5); + ecore_timer_interval_set(timer, 0); + ecore_timer_reset(timer); + /* timer should expire after exactly 2 iterations since it becomes un-instantiated now */ + ecore_main_loop_iterate(); + ecore_main_loop_iterate(); + ck_assert_int_eq(count, 6); } EFL_END_TEST --