diff options
author | Mike Blumenkrantz <zmike@samsung.com> | 2019-10-25 12:50:48 -0400 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2019-10-29 16:09:45 +0100 |
commit | cb23d14d11c0a751792143014a0f855d3cf957f6 (patch) | |
tree | 1713723774d77a6f106e81e1aca6746ac8af6bda | |
parent | 1800f060c88d1665b762dfa1a041ce70a4e130e4 (diff) | |
download | efl-cb23d14d11c0a751792143014a0f855d3cf957f6.tar.gz |
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.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D10530
-rw-r--r-- | src/tests/ecore/ecore_test_timer.c | 24 |
1 files changed, 23 insertions, 1 deletions
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 |