summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_timer.c
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2016-09-15 21:48:01 -0700
committerCedric Bail <cedric@osg.samsung.com>2016-09-15 21:49:08 -0700
commitb7415803295d1824f4af72f3523408a07000fc0a (patch)
treee38b535ad637bb9f6110845727328904274832a8 /src/tests/ecore/ecore_test_timer.c
parentde0a54f0b9e44d06879ac9e3535ee6b958f15956 (diff)
ecore: migrate job and timeout tests to use efl_future.
Diffstat (limited to '')
-rw-r--r--src/tests/ecore/ecore_test_timer.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/tests/ecore/ecore_test_timer.c b/src/tests/ecore/ecore_test_timer.c
index 3d70375d57..c7547e4288 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)
176END_TEST 176END_TEST
177 177
178static void 178static void
179_ecore_promise_quit(void *data, void *value) 179_ecore_promise_quit(void *data, const Efl_Event *ev)
180{ 180{
181 Efl_Future_Event_Success *success = ev->info;
181 Eina_Bool *bob = data; 182 Eina_Bool *bob = data;
182 double *start = value; 183 double *start = success->value;
183 double delta = ecore_loop_time_get() - *start; 184 double delta = ecore_loop_time_get() - *start;
184 185
185 fprintf(stderr, "Ecore promise timeout took %f (should be <= 0.01)\n", delta - 0.2); 186 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)
191 192
192START_TEST(ecore_test_timeout) 193START_TEST(ecore_test_timeout)
193{ 194{
194 Eina_Promise *timeout = NULL; 195 Efl_Future *timeout = NULL;
195 Eina_Bool bob = EINA_FALSE; 196 Eina_Bool bob = EINA_FALSE;
196 double start; 197 double start;
197 198
@@ -199,7 +200,7 @@ START_TEST(ecore_test_timeout)
199 200
200 start = ecore_time_get(); 201 start = ecore_time_get();
201 timeout = efl_loop_timeout(ecore_main_loop_get(), 0.2, &start); 202 timeout = efl_loop_timeout(ecore_main_loop_get(), 0.2, &start);
202 eina_promise_then(timeout, &_ecore_promise_quit, NULL, &bob); 203 efl_future_then(timeout, &_ecore_promise_quit, NULL, NULL, &bob);
203 204
204 ecore_main_loop_begin(); 205 ecore_main_loop_begin();
205 206
@@ -216,17 +217,18 @@ _ecore_promise_then(void *data EINA_UNUSED, void *value EINA_UNUSED)
216} 217}
217 218
218static void 219static void
219_ecore_promise_cancel(void *data, Eina_Error error) 220_ecore_promise_cancel(void *data, const Efl_Event *ev)
220{ 221{
222 Efl_Future_Event_Failure *failure = ev->info;
221 Eina_Bool *bob = data; 223 Eina_Bool *bob = data;
222 224
223 fail_if(error != EINA_ERROR_PROMISE_CANCEL); 225 fail_if(failure->error != EINA_ERROR_FUTURE_CANCEL);
224 *bob = EINA_TRUE; 226 *bob = EINA_TRUE;
225} 227}
226 228
227START_TEST(ecore_test_timeout_cancel) 229START_TEST(ecore_test_timeout_cancel)
228{ 230{
229 Eina_Promise *timeout = NULL; 231 Efl_Future *timeout = NULL;
230 Eina_Bool bob = EINA_FALSE; 232 Eina_Bool bob = EINA_FALSE;
231 double start; 233 double start;
232 234
@@ -234,8 +236,8 @@ START_TEST(ecore_test_timeout_cancel)
234 236
235 start = ecore_time_get(); 237 start = ecore_time_get();
236 timeout = efl_loop_timeout(ecore_main_loop_get(), 0.2, &start); 238 timeout = efl_loop_timeout(ecore_main_loop_get(), 0.2, &start);
237 eina_promise_then(timeout, &_ecore_promise_then, &_ecore_promise_cancel, &bob); 239 efl_future_then(timeout, &_ecore_promise_then, &_ecore_promise_cancel, NULL, &bob);
238 eina_promise_cancel(timeout); 240 efl_future_cancel(timeout);
239 241
240 fail_if(bob != EINA_TRUE); 242 fail_if(bob != EINA_TRUE);
241 243