summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_promise.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-12-16 11:28:50 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-12-16 14:10:58 -0800
commitc1811de61f7edbc27955f13938bff49ed7e06970 (patch)
tree2ee66d5fa4247f834f42761344a6b54822d4414d /src/tests/ecore/ecore_test_promise.c
parentca1762be21f3913deedb094fe4186d1af8136632 (diff)
ecore: fix test to generate one main loop iteration to see promise fulfilled.
Diffstat (limited to 'src/tests/ecore/ecore_test_promise.c')
-rw-r--r--src/tests/ecore/ecore_test_promise.c52
1 files changed, 43 insertions, 9 deletions
diff --git a/src/tests/ecore/ecore_test_promise.c b/src/tests/ecore/ecore_test_promise.c
index 0d7bcc7..fada926 100644
--- a/src/tests/ecore/ecore_test_promise.c
+++ b/src/tests/ecore/ecore_test_promise.c
@@ -82,6 +82,8 @@ START_TEST(efl_test_promise_future_success)
82 efl_promise_progress_set(p, &progress); 82 efl_promise_progress_set(p, &progress);
83 efl_promise_value_set(p, &value, NULL); 83 efl_promise_value_set(p, &value, NULL);
84 84
85 ecore_main_loop_iterate();
86
85 fail_if(!fo.then || fo.cancel || !fo.progress); 87 fail_if(!fo.then || fo.cancel || !fo.progress);
86 fail_if(!deadf || deadp); 88 fail_if(!deadf || deadp);
87 89
@@ -119,6 +121,8 @@ START_TEST(efl_test_promise_future_success_before_get)
119 121
120 fail_if(!efl_future_then(f, _then, _cancel, _progress, &fo)); 122 fail_if(!efl_future_then(f, _then, _cancel, _progress, &fo));
121 123
124 ecore_main_loop_iterate();
125
122 fail_if(f); 126 fail_if(f);
123 fail_if(!fo.then || fo.cancel || fo.progress); 127 fail_if(!fo.then || fo.cancel || fo.progress);
124 fail_if(!deadf || deadp); 128 fail_if(!deadf || deadp);
@@ -161,6 +165,8 @@ START_TEST(efl_test_promise_future_cancel)
161 165
162 efl_promise_value_set(p, &value, NULL); 166 efl_promise_value_set(p, &value, NULL);
163 167
168 ecore_main_loop_iterate();
169
164 fail_if(fo.then || !fo.cancel || !fo.progress); 170 fail_if(fo.then || !fo.cancel || !fo.progress);
165 fail_if(!deadf || deadp); 171 fail_if(!deadf || deadp);
166 fail_if(!none); 172 fail_if(!none);
@@ -199,6 +205,8 @@ START_TEST(efl_test_promise_before_future_success)
199 205
200 fail_if(!efl_future_then(f, _then, _cancel, _progress, &fo)); 206 fail_if(!efl_future_then(f, _then, _cancel, _progress, &fo));
201 207
208 ecore_main_loop_iterate();
209
202 fail_if(deadp || !deadf); 210 fail_if(deadp || !deadf);
203 fail_if(!fo.then || fo.cancel || fo.progress); 211 fail_if(!fo.then || fo.cancel || fo.progress);
204 212
@@ -240,6 +248,8 @@ START_TEST(efl_test_promise_before_future_cancel)
240 248
241 efl_promise_value_set(p, &value, NULL); 249 efl_promise_value_set(p, &value, NULL);
242 250
251 ecore_main_loop_iterate();
252
243 fail_if(fo.then || !fo.cancel || fo.progress); 253 fail_if(fo.then || !fo.cancel || fo.progress);
244 fail_if(!none); 254 fail_if(!none);
245 255
@@ -321,6 +331,8 @@ START_TEST(efl_test_promise_future_chain_success)
321 efl_promise_progress_set(p, &progress); 331 efl_promise_progress_set(p, &progress);
322 efl_promise_value_set(p, &value, NULL); 332 efl_promise_value_set(p, &value, NULL);
323 333
334 ecore_main_loop_iterate();
335
324 fail_if(!fo1.then || fo1.cancel || !fo1.progress); 336 fail_if(!fo1.then || fo1.cancel || !fo1.progress);
325 fail_if(!fo2.then || fo2.cancel || !fo2.progress); 337 fail_if(!fo2.then || fo2.cancel || !fo2.progress);
326 fail_if(!deadf1 || !deadf2 || deadp); 338 fail_if(!deadf1 || !deadf2 || deadp);
@@ -369,6 +381,8 @@ START_TEST(efl_test_promise_future_chain_cancel)
369 381
370 efl_promise_value_set(p, &value, NULL); 382 efl_promise_value_set(p, &value, NULL);
371 383
384 ecore_main_loop_iterate();
385
372 fail_if(fo1.then || !fo1.cancel || !fo1.progress); 386 fail_if(fo1.then || !fo1.cancel || !fo1.progress);
373 fail_if(fo2.then || !fo2.cancel || !fo2.progress); 387 fail_if(fo2.then || !fo2.cancel || !fo2.progress);
374 fail_if(!deadf1 || !deadf2 || deadp); 388 fail_if(!deadf1 || !deadf2 || deadp);
@@ -414,6 +428,8 @@ START_TEST(efl_test_promise_future_multi_success)
414 efl_promise_progress_set(p, &progress); 428 efl_promise_progress_set(p, &progress);
415 efl_promise_value_set(p, &value, NULL); 429 efl_promise_value_set(p, &value, NULL);
416 430
431 ecore_main_loop_iterate();
432
417 fail_if(!fo1.then || fo1.cancel || !fo1.progress); 433 fail_if(!fo1.then || fo1.cancel || !fo1.progress);
418 fail_if(!fo2.then || fo2.cancel || !fo2.progress); 434 fail_if(!fo2.then || fo2.cancel || !fo2.progress);
419 fail_if(!deadf || deadp); 435 fail_if(!deadf || deadp);
@@ -458,6 +474,8 @@ START_TEST(efl_test_promise_future_multi_cancel)
458 474
459 efl_promise_value_set(p, &value, NULL); 475 efl_promise_value_set(p, &value, NULL);
460 476
477 ecore_main_loop_iterate();
478
461 fail_if(fo1.then || !fo1.cancel || !fo1.progress); 479 fail_if(fo1.then || !fo1.cancel || !fo1.progress);
462 fail_if(fo2.then || !fo2.cancel || !fo2.progress); 480 fail_if(fo2.then || !fo2.cancel || !fo2.progress);
463 fail_if(!deadf || deadp); 481 fail_if(!deadf || deadp);
@@ -501,6 +519,8 @@ START_TEST(efl_test_promise_before_future_multi_success)
501 fail_if(!efl_future_then(f, _then, _cancel, _progress, &fo2)); 519 fail_if(!efl_future_then(f, _then, _cancel, _progress, &fo2));
502 efl_unref(f); 520 efl_unref(f);
503 521
522 ecore_main_loop_iterate();
523
504 fail_if(deadp || !deadf); 524 fail_if(deadp || !deadf);
505 fail_if(!fo1.then || fo1.cancel || fo1.progress); 525 fail_if(!fo1.then || fo1.cancel || fo1.progress);
506 fail_if(!fo2.then || fo2.cancel || fo2.progress); 526 fail_if(!fo2.then || fo2.cancel || fo2.progress);
@@ -550,6 +570,8 @@ START_TEST(efl_test_promise_before_future_multi_cancel)
550 570
551 efl_promise_value_set(p, &value, NULL); 571 efl_promise_value_set(p, &value, NULL);
552 572
573 ecore_main_loop_iterate();
574
553 fail_if(fo1.then || !fo1.cancel || fo1.progress); 575 fail_if(fo1.then || !fo1.cancel || fo1.progress);
554 fail_if(fo2.then || !fo2.cancel || fo2.progress); 576 fail_if(fo2.then || !fo2.cancel || fo2.progress);
555 fail_if(fo3.then || fo3.cancel || fo3.progress); 577 fail_if(fo3.then || fo3.cancel || fo3.progress);
@@ -699,12 +721,17 @@ START_TEST(efl_test_promise_all)
699 fail_if(!all); 721 fail_if(!all);
700 722
701 efl_promise_value_set(p1, &value[0], NULL); 723 efl_promise_value_set(p1, &value[0], NULL);
724
725 ecore_main_loop_iterate();
726
702 fail_if(!donep1.then || donep1.cancel || donep1.progress); 727 fail_if(!donep1.then || donep1.cancel || donep1.progress);
703 fail_if(donea.then || donea.cancel || donea.progress); 728 fail_if(donea.then || donea.cancel || donea.progress);
704 729
705 efl_promise_value_set(p2, &value[1], NULL); 730 efl_promise_value_set(p2, &value[1], NULL);
706 efl_promise_value_set(p3, &value[2], NULL); 731 efl_promise_value_set(p3, &value[2], NULL);
707 732
733 ecore_main_loop_iterate();
734
708 fail_if(!donea.then || donea.cancel || donea.progress); 735 fail_if(!donea.then || donea.cancel || donea.progress);
709 fail_if(all); 736 fail_if(all);
710 737
@@ -743,6 +770,8 @@ START_TEST(efl_test_promise_all_after_value_set)
743 770
744 fail_if(!efl_future_then(all, _then_all, _cancel, _progress, &donea)); 771 fail_if(!efl_future_then(all, _then_all, _cancel, _progress, &donea));
745 772
773 ecore_main_loop_iterate();
774
746 fail_if(!donea.then || donea.cancel || donea.progress); 775 fail_if(!donea.then || donea.cancel || donea.progress);
747 776
748 fail_if(all); 777 fail_if(all);
@@ -791,6 +820,9 @@ START_TEST(efl_test_promise_race)
791 fail_if(!race); 820 fail_if(!race);
792 821
793 efl_promise_value_set(p2, &value[0], NULL); 822 efl_promise_value_set(p2, &value[0], NULL);
823
824 ecore_main_loop_iterate();
825
794 fail_if(donep1.then || !donep1.cancel || donep1.progress); 826 fail_if(donep1.then || !donep1.cancel || donep1.progress);
795 fail_if(!donea.then || donea.cancel || donea.progress); 827 fail_if(!donea.then || donea.cancel || donea.progress);
796 828
@@ -842,20 +874,22 @@ _then_cleanup(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
842 874
843START_TEST(efl_test_recursive_mess) 875START_TEST(efl_test_recursive_mess)
844{ 876{
845 Efl_Promise *p; 877 Efl_Promise *p;
846 Future_Ok done = { EINA_FALSE, EINA_FALSE, EINA_FALSE }; 878 Future_Ok done = { EINA_FALSE, EINA_FALSE, EINA_FALSE };
847 879
848 ecore_init(); 880 ecore_init();
849 881
850 p = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get()); 882 p = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
851 efl_future_use(&recursive_future, efl_promise_future_get(p)); 883 efl_future_use(&recursive_future, efl_promise_future_get(p));
852 efl_future_then(recursive_future, _then_cleanup, _cancel, NULL, &done); 884 efl_future_then(recursive_future, _then_cleanup, _cancel, NULL, &done);
853 885
854 efl_promise_value_set(p, &value[0], NULL); 886 efl_promise_value_set(p, &value[0], NULL);
855 887
856 efl_del(p); 888 ecore_main_loop_iterate();
889
890 efl_del(p);
857 891
858 ecore_shutdown(); 892 ecore_shutdown();
859} 893}
860END_TEST 894END_TEST
861 895