aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousasilva@gmail.com>2016-11-01 21:09:04 -0200
committerVitor Sousa <vitorsousasilva@gmail.com>2016-11-01 21:09:04 -0200
commit1320ad78587ab6fa67537758af90b00e1bc6ede6 (patch)
tree9783cd7dd6193833bffccfeb7ca08ca5116b6b58
parentecore-wl2: Unify surface creation code (diff)
downloadefl-devs/vitorsousa/failing_future_all.tar.gz
ecore: add test for efl_future_then after value_setdevs/vitorsousa/failing_future_all
-rw-r--r--src/tests/ecore/ecore_test_promise.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/tests/ecore/ecore_test_promise.c b/src/tests/ecore/ecore_test_promise.c
index ffd2300486..c7d5386388 100644
--- a/src/tests/ecore/ecore_test_promise.c
+++ b/src/tests/ecore/ecore_test_promise.c
@@ -1048,6 +1048,61 @@ START_TEST(efl_test_promise_all)
}
END_TEST
+START_TEST(efl_test_promise_all_after_value_set)
+{
+ Efl_Promise *p1, *p2, *p3;
+ Efl_Future *all = NULL, *f1, *f2, *f3;
+ Future_Ok donea = { EINA_FALSE, EINA_FALSE, EINA_FALSE };
+// Future_Ok donep1 = { EINA_FALSE, EINA_FALSE, EINA_FALSE };
+// Future_Ok donep2 = { EINA_FALSE, EINA_FALSE, EINA_FALSE };
+// Future_Ok donep3 = { EINA_FALSE, EINA_FALSE, EINA_FALSE };
+
+ ecore_init();
+
+ p1 = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
+ p2 = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
+ p3 = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
+ fail_if(!p1 || !p2 || !p3);
+
+ f1 = efl_ref(efl_promise_future_get(p1));
+ f2 = efl_ref(efl_promise_future_get(p2));
+ f3 = efl_ref(efl_promise_future_get(p3));
+
+ efl_promise_value_set(p1, &value[0], NULL);
+ efl_promise_value_set(p2, &value[1], NULL);
+ efl_promise_value_set(p3, &value[2], NULL);
+
+// fail_if(!efl_future_then(f1, _then, _cancel, _progress, &donep1));
+// fail_if(!donep1.then || donep1.cancel || donep1.progress);
+//
+// fail_if(!efl_future_then(f2, _then, _cancel, _progress, &donep2));
+// fail_if(!donep2.then || donep2.cancel || donep2.progress);
+//
+// fail_if(!efl_future_then(f3, _then, _cancel, _progress, &donep3));
+// fail_if(!donep3.then || donep3.cancel || donep3.progress);
+
+ efl_future_use(&all, efl_future_all(f1, f2, f3));
+
+ fail_if(!all);
+
+ fail_if(!efl_future_then(all, _then_all, _cancel, _progress, &donea));
+
+ fail_if(!donea.then || donea.cancel || donea.progress);
+
+ fail_if(all);
+
+ efl_unref(f1);
+ efl_unref(f2);
+ efl_unref(f3);
+
+ efl_del(p1);
+ efl_del(p2);
+ efl_del(p3);
+
+ ecore_shutdown();
+}
+END_TEST
+
static void
_then_race(void *data, const Efl_Event *ev)
{
@@ -1180,6 +1235,7 @@ void ecore_test_ecore_promise(TCase *tc)
tcase_add_test(tc, efl_test_promise_future_optional_success);
tcase_add_test(tc, efl_test_promise_future_optional_cancel);
tcase_add_test(tc, efl_test_promise_all);
+ tcase_add_test(tc, efl_test_promise_all_after_value_set);
tcase_add_test(tc, efl_test_promise_race);
tcase_add_test(tc, efl_test_future_link);
tcase_add_test(tc, efl_test_recursive_mess);