summaryrefslogtreecommitdiff
path: root/src/tests/ecore
diff options
context:
space:
mode:
authorHosang Kim <hosang12.kim@samsung.com>2018-08-02 09:14:15 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-08-02 09:14:15 -0400
commita92274f81184cd06b398a0930110f2a4bee49e76 (patch)
tree3c56cc868338410adb8864d83431220f933e8250 /src/tests/ecore
parent9666f288ae606f181f676ad1768864d830d29ee3 (diff)
ecore: fix that timers are not called in the order they were registered.
Summary: Timers are not called in the order they were registered. Because when current timer is deleted, getting next timer is called twice. Test Plan: <error> Timer1 expired after 0.001 seconds. Timer3 expired after 0.001 seconds. Timer5 expired after 0.001 seconds. Timer7 expired after 0.001 seconds. Timer2 expired after 0.001 seconds. Timer6 expired after 0.001 seconds. Timer4 expired after 0.001 seconds. Timer8 expired after 0.001 seconds. <correct> Timer1 expired after 0.001 seconds. Timer2 expired after 0.001 seconds. Timer3 expired after 0.001 seconds. Timer4 expired after 0.001 seconds. Timer5 expired after 0.001 seconds. Timer6 expired after 0.001 seconds. Timer7 expired after 0.001 seconds. Timer8 expired after 0.001 seconds.| {F3268233} Reviewers: Hermet, Jaehyun_Cho, zmike, SanghyeonLee Reviewed By: zmike Subscribers: cedric, #committers, zmike Tags: #efl_tests Differential Revision: https://phab.enlightenment.org/D6700
Diffstat (limited to 'src/tests/ecore')
-rw-r--r--src/tests/ecore/ecore_test_timer.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/tests/ecore/ecore_test_timer.c b/src/tests/ecore/ecore_test_timer.c
index 7b41b8bc1b..222c4151c5 100644
--- a/src/tests/ecore/ecore_test_timer.c
+++ b/src/tests/ecore/ecore_test_timer.c
@@ -252,10 +252,47 @@ EFL_START_TEST(ecore_test_ecore_main_loop_timer)
252} 252}
253EFL_END_TEST 253EFL_END_TEST
254 254
255static int count = 0;
256
257static Eina_Bool
258_timer_cb(void *data)
259{
260 count++;
261 int num = (intptr_t) data;
262 fail_if (num != count, "Error timer is called out of order");
263 if (count == 8) ecore_main_loop_quit();
264 return ECORE_CALLBACK_CANCEL;
265}
266
267EFL_START_TEST(ecore_test_timer_in_order)
268{
269 Ecore_Timer *timer;
270 timer = ecore_timer_add(0.001, _timer_cb, (void *) 1);
271 fail_if(timer == NULL);
272 timer = ecore_timer_add(0.001, _timer_cb, (void *) 2);
273 fail_if(timer == NULL);
274 timer = ecore_timer_add(0.001, _timer_cb, (void *) 3);
275 fail_if(timer == NULL);
276 timer = ecore_timer_add(0.001, _timer_cb, (void *) 4);
277 fail_if(timer == NULL);
278 timer = ecore_timer_add(0.001, _timer_cb, (void *) 5);
279 fail_if(timer == NULL);
280 timer = ecore_timer_add(0.001, _timer_cb, (void *) 6);
281 fail_if(timer == NULL);
282 timer = ecore_timer_add(0.001, _timer_cb, (void *) 7);
283 fail_if(timer == NULL);
284 timer = ecore_timer_add(0.001, _timer_cb, (void *) 8);
285 fail_if(timer == NULL);
286
287 ecore_main_loop_begin();
288}
289EFL_END_TEST
290
255void ecore_test_timer(TCase *tc) 291void ecore_test_timer(TCase *tc)
256{ 292{
257 tcase_add_test(tc, ecore_test_timers); 293 tcase_add_test(tc, ecore_test_timers);
258 tcase_add_test(tc, ecore_test_timer_inside_call); 294 tcase_add_test(tc, ecore_test_timer_inside_call);
259 tcase_add_test(tc, ecore_test_timer_valid_callbackfunc); 295 tcase_add_test(tc, ecore_test_timer_valid_callbackfunc);
260 tcase_add_test(tc, ecore_test_ecore_main_loop_timer); 296 tcase_add_test(tc, ecore_test_ecore_main_loop_timer);
297 tcase_add_test(tc, ecore_test_timer_in_order);
261} 298}