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
This commit is contained in:
Mike Blumenkrantz 2018-04-09 13:36:59 +02:00 committed by Stefan Schmidt
parent 3858186376
commit 96da1551c5
2 changed files with 32 additions and 22 deletions

View File

@ -117,27 +117,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_idle_exiter)
}
EFL_END_TEST
EFL_START_TEST(ecore_test_ecore_main_loop_timer)
{
Eina_Bool did = EINA_FALSE;
Ecore_Timer *timer;
double start, end, elapsed;
timer = ecore_timer_add(0.1, _quit_cb, &did);
fail_if(timer == NULL);
start = ecore_time_get();
ecore_main_loop_begin();
end = ecore_time_get();
elapsed = end - start;
fail_if(did == EINA_FALSE);
fail_if(elapsed < 0.05);
fail_if(elapsed > 0.15); /* .05 second "error margin" */
}
EFL_END_TEST
// Disabled tests: inner main loops are not supposed to work!
#if 0
@ -796,7 +775,6 @@ void ecore_test_ecore(TCase *tc)
tcase_add_test(tc, ecore_test_ecore_main_loop_idle_enterer);
tcase_add_test(tc, ecore_test_ecore_main_loop_idle_before_enterer);
tcase_add_test(tc, ecore_test_ecore_main_loop_idle_exiter);
tcase_add_test(tc, ecore_test_ecore_main_loop_timer);
tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler);
tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_valid_flags);
tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_activate_modify);

View File

@ -265,6 +265,37 @@ EFL_START_TEST(ecore_test_timer_valid_callbackfunc)
}
EFL_END_TEST
static Eina_Bool
_quit_cb(void *data)
{
Eina_Bool *val = data;
if (val) *val = EINA_TRUE;
ecore_main_loop_quit();
return EINA_FALSE;
}
EFL_START_TEST(ecore_test_ecore_main_loop_timer)
{
Eina_Bool did = EINA_FALSE;
Ecore_Timer *timer;
double start, end, elapsed;
timer = ecore_timer_add(0.1, _quit_cb, &did);
fail_if(timer == NULL);
start = ecore_time_get();
ecore_main_loop_begin();
end = ecore_time_get();
elapsed = end - start;
fail_if(did == EINA_FALSE);
fail_if(elapsed < 0.05);
fail_if(elapsed > 0.15); /* .05 second "error margin" */
}
EFL_END_TEST
void ecore_test_timer(TCase *tc)
{
tcase_add_test(tc, ecore_test_timers);
@ -273,4 +304,5 @@ void ecore_test_timer(TCase *tc)
*/
tcase_add_test(tc, ecore_test_timer_inside_call);
tcase_add_test(tc, ecore_test_timer_valid_callbackfunc);
tcase_add_test(tc, ecore_test_ecore_main_loop_timer);
}