summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-04-09 13:36:59 +0200
committerStefan Schmidt <stefan@osg.samsung.com>2018-04-10 11:28:01 +0200
commit96da1551c5dc7234b2c32fb7c2310ea994e5399b (patch)
treedae5306bfb2ec6528a71c59b4783cf1c0a38bf5f
parent3858186376da10a801677e26cc1573c95dd1c48b (diff)
tests: move ecore_test_ecore_main_loop_timer into timers test file
Summary: Depends on D5892 Reviewers: stefan_schmidt Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5893
-rw-r--r--src/tests/ecore/ecore_test_ecore.c22
-rw-r--r--src/tests/ecore/ecore_test_timer.c32
2 files changed, 32 insertions, 22 deletions
diff --git a/src/tests/ecore/ecore_test_ecore.c b/src/tests/ecore/ecore_test_ecore.c
index f429c5b2c9..3f68225956 100644
--- a/src/tests/ecore/ecore_test_ecore.c
+++ b/src/tests/ecore/ecore_test_ecore.c
@@ -117,27 +117,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_idle_exiter)
117} 117}
118EFL_END_TEST 118EFL_END_TEST
119 119
120EFL_START_TEST(ecore_test_ecore_main_loop_timer)
121{
122 Eina_Bool did = EINA_FALSE;
123 Ecore_Timer *timer;
124 double start, end, elapsed;
125
126
127 timer = ecore_timer_add(0.1, _quit_cb, &did);
128 fail_if(timer == NULL);
129
130 start = ecore_time_get();
131 ecore_main_loop_begin();
132 end = ecore_time_get();
133 elapsed = end - start;
134
135 fail_if(did == EINA_FALSE);
136 fail_if(elapsed < 0.05);
137 fail_if(elapsed > 0.15); /* .05 second "error margin" */
138
139}
140EFL_END_TEST
141 120
142// Disabled tests: inner main loops are not supposed to work! 121// Disabled tests: inner main loops are not supposed to work!
143#if 0 122#if 0
@@ -796,7 +775,6 @@ void ecore_test_ecore(TCase *tc)
796 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_enterer); 775 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_enterer);
797 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_before_enterer); 776 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_before_enterer);
798 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_exiter); 777 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_exiter);
799 tcase_add_test(tc, ecore_test_ecore_main_loop_timer);
800 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler); 778 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler);
801 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_valid_flags); 779 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_valid_flags);
802 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_activate_modify); 780 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_activate_modify);
diff --git a/src/tests/ecore/ecore_test_timer.c b/src/tests/ecore/ecore_test_timer.c
index c325716e3b..0df1e064f8 100644
--- a/src/tests/ecore/ecore_test_timer.c
+++ b/src/tests/ecore/ecore_test_timer.c
@@ -265,6 +265,37 @@ EFL_START_TEST(ecore_test_timer_valid_callbackfunc)
265} 265}
266EFL_END_TEST 266EFL_END_TEST
267 267
268static Eina_Bool
269_quit_cb(void *data)
270{
271 Eina_Bool *val = data;
272 if (val) *val = EINA_TRUE;
273 ecore_main_loop_quit();
274 return EINA_FALSE;
275}
276
277EFL_START_TEST(ecore_test_ecore_main_loop_timer)
278{
279 Eina_Bool did = EINA_FALSE;
280 Ecore_Timer *timer;
281 double start, end, elapsed;
282
283
284 timer = ecore_timer_add(0.1, _quit_cb, &did);
285 fail_if(timer == NULL);
286
287 start = ecore_time_get();
288 ecore_main_loop_begin();
289 end = ecore_time_get();
290 elapsed = end - start;
291
292 fail_if(did == EINA_FALSE);
293 fail_if(elapsed < 0.05);
294 fail_if(elapsed > 0.15); /* .05 second "error margin" */
295
296}
297EFL_END_TEST
298
268void ecore_test_timer(TCase *tc) 299void ecore_test_timer(TCase *tc)
269{ 300{
270 tcase_add_test(tc, ecore_test_timers); 301 tcase_add_test(tc, ecore_test_timers);
@@ -273,4 +304,5 @@ void ecore_test_timer(TCase *tc)
273 */ 304 */
274 tcase_add_test(tc, ecore_test_timer_inside_call); 305 tcase_add_test(tc, ecore_test_timer_inside_call);
275 tcase_add_test(tc, ecore_test_timer_valid_callbackfunc); 306 tcase_add_test(tc, ecore_test_timer_valid_callbackfunc);
307 tcase_add_test(tc, ecore_test_ecore_main_loop_timer);
276} 308}