summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_promise.c
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousasilva@gmail.com>2016-11-01 21:09:04 -0200
committerCedric BAIL <cedric@osg.samsung.com>2016-11-03 18:03:16 -0700
commit10e4e6525067b2eeb0b054c2448b3f1c197d21aa (patch)
treeeaedd1d22f9c106ab0afc9874edff284d8b21931 /src/tests/ecore/ecore_test_promise.c
parentfcf9f55150cff6aef23779782e17f603f6c7db10 (diff)
ecore: add test for efl_future_then after value_set
Diffstat (limited to 'src/tests/ecore/ecore_test_promise.c')
-rw-r--r--src/tests/ecore/ecore_test_promise.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/tests/ecore/ecore_test_promise.c b/src/tests/ecore/ecore_test_promise.c
index ffd2300486..7b402e44cb 100644
--- a/src/tests/ecore/ecore_test_promise.c
+++ b/src/tests/ecore/ecore_test_promise.c
@@ -1048,6 +1048,49 @@ 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
1057 ecore_init();
1058
1059 p1 = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
1060 p2 = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
1061 p3 = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
1062 fail_if(!p1 || !p2 || !p3);
1063
1064 f1 = efl_ref(efl_promise_future_get(p1));
1065 f2 = efl_ref(efl_promise_future_get(p2));
1066 f3 = efl_ref(efl_promise_future_get(p3));
1067
1068 efl_promise_value_set(p1, &value[0], NULL);
1069 efl_promise_value_set(p2, &value[1], NULL);
1070 efl_promise_value_set(p3, &value[2], NULL);
1071
1072 efl_future_use(&all, efl_future_all(f1, f2, f3));
1073
1074 fail_if(!all);
1075
1076 fail_if(!efl_future_then(all, _then_all, _cancel, _progress, &donea));
1077
1078 fail_if(!donea.then || donea.cancel || donea.progress);
1079
1080 fail_if(all);
1081
1082 efl_unref(f1);
1083 efl_unref(f2);
1084 efl_unref(f3);
1085
1086 efl_del(p1);
1087 efl_del(p2);
1088 efl_del(p3);
1089
1090 ecore_shutdown();
1091}
1092END_TEST
1093
1051static void 1094static void
1052_then_race(void *data, const Efl_Event *ev) 1095_then_race(void *data, const Efl_Event *ev)
1053{ 1096{
@@ -1180,6 +1223,7 @@ void ecore_test_ecore_promise(TCase *tc)
1180 tcase_add_test(tc, efl_test_promise_future_optional_success); 1223 tcase_add_test(tc, efl_test_promise_future_optional_success);
1181 tcase_add_test(tc, efl_test_promise_future_optional_cancel); 1224 tcase_add_test(tc, efl_test_promise_future_optional_cancel);
1182 tcase_add_test(tc, efl_test_promise_all); 1225 tcase_add_test(tc, efl_test_promise_all);
1226 tcase_add_test(tc, efl_test_promise_all_after_value_set);
1183 tcase_add_test(tc, efl_test_promise_race); 1227 tcase_add_test(tc, efl_test_promise_race);
1184 tcase_add_test(tc, efl_test_future_link); 1228 tcase_add_test(tc, efl_test_future_link);
1185 tcase_add_test(tc, efl_test_recursive_mess); 1229 tcase_add_test(tc, efl_test_recursive_mess);