tests/ecore: remove tolerance threshold from ecore_timer_reset test case
authorMike Blumenkrantz <zmike@samsung.com>
Fri, 20 Jul 2018 15:46:41 +0000 (11:46 -0400)
committerSangHyeon Jade Lee <sh10233.lee@samsung.com>
Wed, 1 Aug 2018 04:26:10 +0000 (13:26 +0900)
unit tests should test one thing only: testing timer accuracy and the
effectiveness of resetting a timer in the same test leads to timing issues,
so remove the timing component from the test

ref T6878

Differential Revision: https://phab.enlightenment.org/D6653

src/tests/ecore/ecore_test_timer.c

index b7661d0..7b41b8b 100644 (file)
@@ -173,7 +173,6 @@ EFL_END_TEST
 typedef struct _Test_Inside_Call
 {
    Ecore_Timer *t;
-   double start;
    int it;
 } Test_Inside_Call;
 
@@ -182,9 +181,7 @@ _timeri_cb(void *data)
 {
    Test_Inside_Call *c = data;
 
-   fail_if(fabs((ecore_time_get() - c->start) - 0.011) > 0.01);
    ecore_timer_reset(c->t);
-   c->start = ecore_time_get();
 
    c->it--;
 
@@ -194,14 +191,21 @@ _timeri_cb(void *data)
    return EINA_FALSE;
 }
 
+static Eina_Bool
+timeout_timer_cb()
+{
+   ck_abort();
+   return EINA_FALSE;
+}
+
 EFL_START_TEST(ecore_test_timer_inside_call)
 {
    Test_Inside_Call *c;
 
    c = malloc(sizeof(Test_Inside_Call));
-   c->start = ecore_time_get();
    c->it = 5;
    c->t = ecore_timer_add(0.01, _timeri_cb, c);
+   ecore_timer_add(1.0, timeout_timer_cb, NULL);
 
    fail_if(!c->t, "Error add timer\n");