summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-05-25 18:14:29 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-05-25 21:32:03 -0300
commitde9be13d458f2739a536e5863aa8caddd3f7f715 (patch)
tree7e28d9dba5336f02ad148af679e7208377fae9f0 /src/tests
parent0eacdc03da738bebe03ac22fe377836751877345 (diff)
eina: Add promise parameter to then calllbacks
Added promise parameter to then callbacks so callbacks can steal ownership of the value from the promise.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/ecore/ecore_test_promise.c14
-rw-r--r--src/tests/eina/eina_test_promise.c13
2 files changed, 13 insertions, 14 deletions
diff --git a/src/tests/ecore/ecore_test_promise.c b/src/tests/ecore/ecore_test_promise.c
index 5a54281a33..bf2a16076a 100644
--- a/src/tests/ecore/ecore_test_promise.c
+++ b/src/tests/ecore/ecore_test_promise.c
@@ -11,7 +11,7 @@ void promised_thread(const void* data EINA_UNUSED, Eina_Promise_Owner* promise,
11 eina_promise_owner_value_set(promise, NULL, NULL); 11 eina_promise_owner_value_set(promise, NULL, NULL);
12} 12}
13 13
14void promise_callback(void* data EINA_UNUSED, void* value EINA_UNUSED) 14void promise_callback(void* data EINA_UNUSED, void* value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED)
15{ 15{
16 ecore_main_loop_quit(); 16 ecore_main_loop_quit();
17} 17}
@@ -36,9 +36,9 @@ void promise_error_thread(const void* data EINA_UNUSED, Eina_Promise_Owner* prom
36 eina_promise_owner_error_set(promise, EINA_ERROR_OUT_OF_MEMORY); 36 eina_promise_owner_error_set(promise, EINA_ERROR_OUT_OF_MEMORY);
37} 37}
38 38
39void promise_error_callback(void* data EINA_UNUSED, Eina_Error const* error) 39void promise_error_callback(void* data EINA_UNUSED, Eina_Error error, Eina_Promise* promise EINA_UNUSED)
40{ 40{
41 ck_assert(*error == EINA_ERROR_OUT_OF_MEMORY); 41 ck_assert(error == EINA_ERROR_OUT_OF_MEMORY);
42 ecore_main_loop_quit(); 42 ecore_main_loop_quit();
43} 43}
44 44
@@ -74,7 +74,7 @@ START_TEST(ecore_test_promise_all)
74} 74}
75END_TEST 75END_TEST
76 76
77void promise_callback2(void* data, void* value EINA_UNUSED) 77void promise_callback2(void* data, void* value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED)
78{ 78{
79 if(++(*(int*)data) == 2) 79 if(++(*(int*)data) == 2)
80 ecore_main_loop_quit(); 80 ecore_main_loop_quit();
@@ -201,7 +201,7 @@ void promised_block_thread(const void* data EINA_UNUSED, Eina_Promise_Owner* pro
201} 201}
202 202
203static void 203static void
204_ecore_test_promise_normal_lifetime_cb(void* data EINA_UNUSED, void* value EINA_UNUSED) 204_ecore_test_promise_normal_lifetime_cb(void* data EINA_UNUSED, void* value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED)
205{ 205{
206 ecore_main_loop_quit(); 206 ecore_main_loop_quit();
207} 207}
@@ -254,7 +254,7 @@ START_TEST(ecore_test_promise_normal_lifetime_all)
254END_TEST 254END_TEST
255 255
256static void 256static void
257_ecore_test_promise_immediate_set_lifetime_cb(void* data EINA_UNUSED, void* value EINA_UNUSED) 257_ecore_test_promise_immediate_set_lifetime_cb(void* data EINA_UNUSED, void* value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED)
258{ 258{
259 ecore_main_loop_quit(); 259 ecore_main_loop_quit();
260} 260}
@@ -327,7 +327,7 @@ static void _cancel_callback(const void* data, Eina_Promise_Owner* promise EINA_
327 eina_lock_release(&v->lock); 327 eina_lock_release(&v->lock);
328} 328}
329 329
330static void _cancel_promise_callback(void* data EINA_UNUSED, Eina_Error const* value) 330static void _cancel_promise_callback(void* data EINA_UNUSED, Eina_Error value, Eina_Promise* promise EINA_UNUSED)
331{ 331{
332 ck_assert(!!value); 332 ck_assert(!!value);
333 ecore_main_loop_quit(); 333 ecore_main_loop_quit();
diff --git a/src/tests/eina/eina_test_promise.c b/src/tests/eina/eina_test_promise.c
index 2932e1c792..cc7aa88ea2 100644
--- a/src/tests/eina/eina_test_promise.c
+++ b/src/tests/eina/eina_test_promise.c
@@ -32,7 +32,7 @@
32#include "eina_suite.h" 32#include "eina_suite.h"
33 33
34static void 34static void
35_eina_test_promise_cb(void* data, void* value EINA_UNUSED) 35_eina_test_promise_cb(void* data, void* value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED)
36{ 36{
37 *(Eina_Bool*)data = EINA_TRUE; 37 *(Eina_Bool*)data = EINA_TRUE;
38} 38}
@@ -122,7 +122,7 @@ START_TEST(eina_test_promise_immediate_set_lifetime_all)
122} 122}
123END_TEST 123END_TEST
124 124
125static void _eina_test_promise_value_all_cb(void* data, void* value) 125static void _eina_test_promise_value_all_cb(void* data, void* value, Eina_Promise* promise EINA_UNUSED)
126{ 126{
127 Eina_Iterator** iterator = value; 127 Eina_Iterator** iterator = value;
128 int *i, *j; 128 int *i, *j;
@@ -178,9 +178,8 @@ static void cancel_callback(void* data, Eina_Promise_Owner* promise EINA_UNUSED)
178 *(Eina_Bool*)data = EINA_TRUE; 178 *(Eina_Bool*)data = EINA_TRUE;
179} 179}
180 180
181static void _cancel_promise_callback(void* data EINA_UNUSED, Eina_Error const* value) 181static void _cancel_promise_callback(void* data EINA_UNUSED, Eina_Error error, Eina_Promise* promise EINA_UNUSED)
182{ 182{
183 ck_assert(!!value);
184 *(Eina_Bool*)data = EINA_TRUE; 183 *(Eina_Bool*)data = EINA_TRUE;
185} 184}
186 185
@@ -207,7 +206,7 @@ START_TEST(eina_test_promise_cancel_promise)
207} 206}
208END_TEST 207END_TEST
209 208
210void progress_callback(void* data, void* value) 209void progress_callback(void* data, void* value, Eina_Promise* promise EINA_UNUSED)
211{ 210{
212 int* i = value; 211 int* i = value;
213 ck_assert(*i == 1); 212 ck_assert(*i == 1);
@@ -285,13 +284,13 @@ START_TEST(eina_test_promise_progress_notify2)
285END_TEST 284END_TEST
286 285
287static void 286static void
288_eina_promise_progress_notify_fulfilled(void* data, void* value EINA_UNUSED) 287_eina_promise_progress_notify_fulfilled(void* data, void* value EINA_UNUSED, Eina_Promise* promise EINA_UNUSED)
289{ 288{
290 *(Eina_Bool*)data = EINA_TRUE; 289 *(Eina_Bool*)data = EINA_TRUE;
291} 290}
292 291
293static void 292static void
294_eina_promise_progress_notify_error(void* data EINA_UNUSED, Eina_Error const* error EINA_UNUSED) 293_eina_promise_progress_notify_error(void* data EINA_UNUSED, Eina_Error error EINA_UNUSED, Eina_Promise* promise EINA_UNUSED)
295{ 294{
296 ck_assert(EINA_FALSE); 295 ck_assert(EINA_FALSE);
297} 296}