summaryrefslogtreecommitdiff
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
parentf3240f630b56f3e991506013952bc5fb54a94be6 (diff)
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)
1048} 1048}
1049END_TEST 1049END_TEST
1050 1050
1051START_TEST(efl_test_promise_all_after_value_set)
1052{
1053 Efl_Promise *p1, *p2, *p3;
1054 Efl_Future *all = NULL, *f1, *f2, *f3;
1055 Future_Ok donea = { EINA_FALSE, EINA_FALSE, EINA_FALSE };
1056// Future_Ok donep1 = { EINA_FALSE, EINA_FALSE, EINA_FALSE };
1057// Future_Ok donep2 = { EINA_FALSE, EINA_FALSE, EINA_FALSE };
1058// Future_Ok donep3 = { EINA_FALSE, EINA_FALSE, EINA_FALSE };
1059
1060 ecore_init();
1061
1062 p1 = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
1063 p2 = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
1064 p3 = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
1065 fail_if(!p1 || !p2 || !p3);
1066
1067 f1 = efl_ref(efl_promise_future_get(p1));
1068 f2 = efl_ref(efl_promise_future_get(p2));
1069 f3 = efl_ref(efl_promise_future_get(p3));
1070
1071 efl_promise_value_set(p1, &value[0], NULL);
1072 efl_promise_value_set(p2, &value[1], NULL);
1073 efl_promise_value_set(p3, &value[2], NULL);
1074
1075// fail_if(!efl_future_then(f1, _then, _cancel, _progress, &donep1));
1076// fail_if(!donep1.then || donep1.cancel || donep1.progress);
1077//
1078// fail_if(!efl_future_then(f2, _then, _cancel, _progress, &donep2));
1079// fail_if(!donep2.then || donep2.cancel || donep2.progress);
1080//
1081// fail_if(!efl_future_then(f3, _then, _cancel, _progress, &donep3));
1082// fail_if(!donep3.then || donep3.cancel || donep3.progress);
1083
1084 efl_future_use(&all, efl_future_all(f1, f2, f3));
1085
1086 fail_if(!all);
1087
1088 fail_if(!efl_future_then(all, _then_all, _cancel, _progress, &donea));
1089
1090 fail_if(!donea.then || donea.cancel || donea.progress);
1091
1092 fail_if(all);
1093
1094 efl_unref(f1);
1095 efl_unref(f2);
1096 efl_unref(f3);
1097
1098 efl_del(p1);
1099 efl_del(p2);
1100 efl_del(p3);
1101
1102 ecore_shutdown();
1103}
1104END_TEST
1105
1051static void 1106static void
1052_then_race(void *data, const Efl_Event *ev) 1107_then_race(void *data, const Efl_Event *ev)
1053{ 1108{
@@ -1180,6 +1235,7 @@ void ecore_test_ecore_promise(TCase *tc)
1180 tcase_add_test(tc, efl_test_promise_future_optional_success); 1235 tcase_add_test(tc, efl_test_promise_future_optional_success);
1181 tcase_add_test(tc, efl_test_promise_future_optional_cancel); 1236 tcase_add_test(tc, efl_test_promise_future_optional_cancel);
1182 tcase_add_test(tc, efl_test_promise_all); 1237 tcase_add_test(tc, efl_test_promise_all);
1238 tcase_add_test(tc, efl_test_promise_all_after_value_set);
1183 tcase_add_test(tc, efl_test_promise_race); 1239 tcase_add_test(tc, efl_test_promise_race);
1184 tcase_add_test(tc, efl_test_future_link); 1240 tcase_add_test(tc, efl_test_future_link);
1185 tcase_add_test(tc, efl_test_recursive_mess); 1241 tcase_add_test(tc, efl_test_recursive_mess);