summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_promise2.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-08-26 19:59:39 -0300
committerGuilherme Iscaro <iscaro@profusion.mobi>2017-09-04 10:24:00 -0300
commit22cee38239912d87467844ded59589c9fed319d4 (patch)
tree178e559e7030a261dfaac3a2409af93be09c5219 /src/tests/ecore/ecore_test_promise2.c
parent8e80d3d2dc162312070d043e622747b17d4e1763 (diff)
Efl_Loop: add job, timeout and idle based on Eina_Future.
Since some clash with old version, then add Eina_FutureXXX to their name, later we'll sed.
Diffstat (limited to '')
-rw-r--r--src/tests/ecore/ecore_test_promise2.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/tests/ecore/ecore_test_promise2.c b/src/tests/ecore/ecore_test_promise2.c
index ea8d0d272e..c23c5d1c74 100644
--- a/src/tests/ecore/ecore_test_promise2.c
+++ b/src/tests/ecore/ecore_test_promise2.c
@@ -472,6 +472,67 @@ _race_end_cb(void *data, const Eina_Value v, const Eina_Future *dead EINA_UNUSED
472 return v; 472 return v;
473} 473}
474 474
475static Eina_Value
476_promise_empty_done(void *data, const Eina_Value value, const Eina_Future *dead_future EINA_UNUSED)
477{
478 Eina_Bool *pdone = data;
479
480 if (!value.type) *pdone = EINA_TRUE;
481
482 ecore_main_loop_quit();
483
484 return value;
485}
486
487START_TEST(efl_test_timeout)
488{
489 Eina_Future *f;
490 Eina_Bool done = EINA_FALSE;
491
492 fail_if(!ecore_init());
493 f = eina_future_then(efl_loop_Eina_FutureXXX_timeout(ecore_main_loop_get(), 0.0001),
494 _promise_empty_done, &done);
495 fail_if(!f);
496 ecore_main_loop_begin();
497 ecore_shutdown();
498
499 fail_unless(done);
500}
501END_TEST
502
503START_TEST(efl_test_job)
504{
505 Eina_Future *f;
506 Eina_Bool done = EINA_FALSE;
507
508 fail_if(!ecore_init());
509 f = eina_future_then(efl_loop_Eina_FutureXXX_job(ecore_main_loop_get()),
510 _promise_empty_done, &done);
511 fail_if(!f);
512 ecore_main_loop_begin();
513 ecore_shutdown();
514
515 fail_unless(done);
516}
517END_TEST
518
519START_TEST(efl_test_idle)
520{
521 Eina_Future *f;
522 Eina_Bool done = EINA_FALSE;
523
524 fail_if(!ecore_init());
525 f = eina_future_then(efl_loop_Eina_FutureXXX_idle(ecore_main_loop_get()),
526 _promise_empty_done, &done);
527 fail_if(!f);
528 ecore_main_loop_begin();
529 ecore_shutdown();
530
531 fail_unless(done);
532}
533END_TEST
534
535
475START_TEST(efl_test_promise_future_success) 536START_TEST(efl_test_promise_future_success)
476{ 537{
477 Eina_Future *f; 538 Eina_Future *f;
@@ -1258,6 +1319,9 @@ END_TEST
1258 1319
1259void ecore_test_ecore_promise2(TCase *tc) 1320void ecore_test_ecore_promise2(TCase *tc)
1260{ 1321{
1322 tcase_add_test(tc, efl_test_timeout);
1323 tcase_add_test(tc, efl_test_job);
1324 tcase_add_test(tc, efl_test_idle);
1261 tcase_add_test(tc, efl_test_promise_future_success); 1325 tcase_add_test(tc, efl_test_promise_future_success);
1262 tcase_add_test(tc, efl_test_promise_future_failure); 1326 tcase_add_test(tc, efl_test_promise_future_failure);
1263 tcase_add_test(tc, efl_test_promise_future_chain_no_error); 1327 tcase_add_test(tc, efl_test_promise_future_chain_no_error);