summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_promise.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-11-03 17:58:58 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-11-03 18:03:16 -0700
commita614303fb6507ed827a05beb6002815dc19f4b25 (patch)
treea836d988c468aab8d54d6af3f68c640ff7083bdc /src/tests/ecore/ecore_test_promise.c
parent10e4e6525067b2eeb0b054c2448b3f1c197d21aa (diff)
ecore: add check to make sure that the order of future_get and value_set can be switched.
Diffstat (limited to 'src/tests/ecore/ecore_test_promise.c')
-rw-r--r--src/tests/ecore/ecore_test_promise.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/tests/ecore/ecore_test_promise.c b/src/tests/ecore/ecore_test_promise.c
index 7b402e44cb..4a527e3438 100644
--- a/src/tests/ecore/ecore_test_promise.c
+++ b/src/tests/ecore/ecore_test_promise.c
@@ -463,6 +463,45 @@ START_TEST(efl_test_promise_future_success)
463} 463}
464END_TEST 464END_TEST
465 465
466// Test value set before future_get
467START_TEST(efl_test_promise_future_success_before_get)
468{
469 Efl_Promise *p;
470 Efl_Future *f;
471 Future_Ok fo = { EINA_FALSE, EINA_FALSE, EINA_FALSE };
472 Eina_Bool deadf = EINA_FALSE, deadp = EINA_FALSE;
473 int progress = 7;
474 int value = 42;
475
476 ecore_init();
477
478 p = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
479 fail_if(!p);
480
481 efl_promise_value_set(p, &value, NULL);
482
483 efl_future_use(&f, efl_promise_future_get(p));
484 fail_if(!f);
485
486 efl_event_callback_add(f, EFL_EVENT_DEL, _death, &deadf);
487 efl_event_callback_add(p, EFL_EVENT_DEL, _death, &deadp);
488
489 fail_if(deadp || deadf);
490
491 fail_if(!efl_future_then(f, _then, _cancel, _progress, &fo));
492
493 fail_if(f);
494 fail_if(!fo.then || fo.cancel || fo.progress);
495 fail_if(!deadf || deadp);
496
497 efl_del(p);
498
499 fail_if(!deadp);
500
501 ecore_shutdown();
502}
503END_TEST
504
466START_TEST(efl_test_promise_future_cancel) 505START_TEST(efl_test_promise_future_cancel)
467{ 506{
468 Efl_Promise *p; 507 Efl_Promise *p;
@@ -1224,6 +1263,7 @@ void ecore_test_ecore_promise(TCase *tc)
1224 tcase_add_test(tc, efl_test_promise_future_optional_cancel); 1263 tcase_add_test(tc, efl_test_promise_future_optional_cancel);
1225 tcase_add_test(tc, efl_test_promise_all); 1264 tcase_add_test(tc, efl_test_promise_all);
1226 tcase_add_test(tc, efl_test_promise_all_after_value_set); 1265 tcase_add_test(tc, efl_test_promise_all_after_value_set);
1266 tcase_add_test(tc, efl_test_promise_future_success_before_get);
1227 tcase_add_test(tc, efl_test_promise_race); 1267 tcase_add_test(tc, efl_test_promise_race);
1228 tcase_add_test(tc, efl_test_future_link); 1268 tcase_add_test(tc, efl_test_future_link);
1229 tcase_add_test(tc, efl_test_recursive_mess); 1269 tcase_add_test(tc, efl_test_recursive_mess);