From b7415803295d1824f4af72f3523408a07000fc0a Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Thu, 15 Sep 2016 21:48:01 -0700 Subject: [PATCH] ecore: migrate job and timeout tests to use efl_future. --- src/tests/ecore/ecore_test_job.c | 8 +++++--- src/tests/ecore/ecore_test_timer.c | 20 +++++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/tests/ecore/ecore_test_job.c b/src/tests/ecore/ecore_test_job.c index 1306ea4..1259e91 100644 --- a/src/tests/ecore/ecore_test_job.c +++ b/src/tests/ecore/ecore_test_job.c @@ -6,9 +6,11 @@ #include "ecore_suite.h" static void -_ecore_promise_quit(void *data, void *value) +_ecore_promise_quit(void *data, const Efl_Event *ev) { + Efl_Future_Event_Success *success = ev->info; Eina_Bool *bob = data; + void *value = success->value; fail_if(data != value); *bob = EINA_TRUE; @@ -21,8 +23,8 @@ START_TEST(ecore_test_job_promise) ecore_init(); - Eina_Promise *promise = efl_loop_job(ecore_main_loop_get(), &bob); - eina_promise_then(promise, &_ecore_promise_quit, NULL, &bob); + Efl_Object *promise = efl_loop_job(ecore_main_loop_get(), &bob); + efl_future_then(promise, &_ecore_promise_quit, NULL, NULL, &bob); ecore_main_loop_begin(); diff --git a/src/tests/ecore/ecore_test_timer.c b/src/tests/ecore/ecore_test_timer.c index 3d70375..c7547e4 100644 --- a/src/tests/ecore/ecore_test_timer.c +++ b/src/tests/ecore/ecore_test_timer.c @@ -176,10 +176,11 @@ START_TEST(ecore_test_timers) END_TEST static void -_ecore_promise_quit(void *data, void *value) +_ecore_promise_quit(void *data, const Efl_Event *ev) { + Efl_Future_Event_Success *success = ev->info; Eina_Bool *bob = data; - double *start = value; + double *start = success->value; double delta = ecore_loop_time_get() - *start; fprintf(stderr, "Ecore promise timeout took %f (should be <= 0.01)\n", delta - 0.2); @@ -191,7 +192,7 @@ _ecore_promise_quit(void *data, void *value) START_TEST(ecore_test_timeout) { - Eina_Promise *timeout = NULL; + Efl_Future *timeout = NULL; Eina_Bool bob = EINA_FALSE; double start; @@ -199,7 +200,7 @@ START_TEST(ecore_test_timeout) start = ecore_time_get(); timeout = efl_loop_timeout(ecore_main_loop_get(), 0.2, &start); - eina_promise_then(timeout, &_ecore_promise_quit, NULL, &bob); + efl_future_then(timeout, &_ecore_promise_quit, NULL, NULL, &bob); ecore_main_loop_begin(); @@ -216,17 +217,18 @@ _ecore_promise_then(void *data EINA_UNUSED, void *value EINA_UNUSED) } static void -_ecore_promise_cancel(void *data, Eina_Error error) +_ecore_promise_cancel(void *data, const Efl_Event *ev) { + Efl_Future_Event_Failure *failure = ev->info; Eina_Bool *bob = data; - fail_if(error != EINA_ERROR_PROMISE_CANCEL); + fail_if(failure->error != EINA_ERROR_FUTURE_CANCEL); *bob = EINA_TRUE; } START_TEST(ecore_test_timeout_cancel) { - Eina_Promise *timeout = NULL; + Efl_Future *timeout = NULL; Eina_Bool bob = EINA_FALSE; double start; @@ -234,8 +236,8 @@ START_TEST(ecore_test_timeout_cancel) start = ecore_time_get(); timeout = efl_loop_timeout(ecore_main_loop_get(), 0.2, &start); - eina_promise_then(timeout, &_ecore_promise_then, &_ecore_promise_cancel, &bob); - eina_promise_cancel(timeout); + efl_future_then(timeout, &_ecore_promise_then, &_ecore_promise_cancel, NULL, &bob); + efl_future_cancel(timeout); fail_if(bob != EINA_TRUE); -- 2.7.4