summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2020-01-24 11:03:23 -0800
committerCedric BAIL <cedric.bail@free.fr>2020-01-31 10:11:40 -0800
commit70849969b8aaecd121aa56ce6f70f31c2ed06c77 (patch)
treea1d660ac55db182bc806957679f4c2b4d95e2a9b
parent2e41a13166789670602bc005a7e6a9f0815ecd77 (diff)
efl: add test for efl_model_children_index_get.
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11186
-rw-r--r--src/tests/efl/efl_test_composite_model.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/tests/efl/efl_test_composite_model.c b/src/tests/efl/efl_test_composite_model.c
index 8d05b6d447..d91b243519 100644
--- a/src/tests/efl/efl_test_composite_model.c
+++ b/src/tests/efl/efl_test_composite_model.c
@@ -154,6 +154,25 @@ _assert_on_error(Eo *o EINA_UNUSED, void *data EINA_UNUSED, Eina_Error error)
154 return eina_value_error_init(error); 154 return eina_value_error_init(error);
155} 155}
156 156
157static unsigned int request[3] = { 3, 1, 5 };
158
159static Eina_Value
160_children_random_index(Eo *model EINA_UNUSED, void *data EINA_UNUSED, const Eina_Value v)
161{
162 unsigned int i, len;
163 Efl_Model *child;
164
165 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
166 {
167 unsigned int index;
168
169 index = efl_composite_model_index_get(child);
170 ck_assert_int_eq(index, request[i]);
171 }
172
173 return v;
174}
175
157EFL_START_TEST(efl_test_boolean_model) 176EFL_START_TEST(efl_test_boolean_model)
158{ 177{
159 Efl_Generic_Model *base_model, *child; 178 Efl_Generic_Model *base_model, *child;
@@ -198,6 +217,14 @@ EFL_START_TEST(efl_test_boolean_model)
198 future = efl_future_then(model, future, .error = _assert_on_error, .free = _cleanup); 217 future = efl_future_then(model, future, .error = _assert_on_error, .free = _cleanup);
199 218
200 ecore_main_loop_begin(); 219 ecore_main_loop_begin();
220
221 future = efl_model_children_index_get(model, EINA_C_ARRAY_ITERATOR_NEW(request));
222 future = efl_future_then(model, future,
223 .success = _children_random_index,
224 .success_type = EINA_VALUE_TYPE_ARRAY);
225 future = efl_future_then(model, future, .error = _assert_on_error, .free = _cleanup);
226
227 ecore_main_loop_begin();
201} 228}
202EFL_END_TEST 229EFL_END_TEST
203 230