cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=70849969b8aaecd121aa56ce6f70f31c2ed06c77

commit 70849969b8aaecd121aa56ce6f70f31c2ed06c77
Author: Cedric BAIL <[email protected]>
Date:   Fri Jan 24 11:03:23 2020 -0800

    efl: add test for efl_model_children_index_get.
    
    Reviewed-by: Marcel Hollerbach <[email protected]>
    Differential Revision: https://phab.enlightenment.org/D11186
---
 src/tests/efl/efl_test_composite_model.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

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)
    return eina_value_error_init(error);
 }
 
+static unsigned int request[3] = { 3, 1, 5 };
+
+static Eina_Value
+_children_random_index(Eo *model EINA_UNUSED, void *data EINA_UNUSED, const 
Eina_Value v)
+{
+   unsigned int i, len;
+   Efl_Model *child;
+
+   EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
+     {
+        unsigned int index;
+
+        index = efl_composite_model_index_get(child);
+        ck_assert_int_eq(index, request[i]);
+     }
+
+   return v;
+}
+
 EFL_START_TEST(efl_test_boolean_model)
 {
    Efl_Generic_Model *base_model, *child;
@@ -198,6 +217,14 @@ EFL_START_TEST(efl_test_boolean_model)
    future = efl_future_then(model, future, .error = _assert_on_error, .free = 
_cleanup);
 
    ecore_main_loop_begin();
+
+   future = efl_model_children_index_get(model, 
EINA_C_ARRAY_ITERATOR_NEW(request));
+   future = efl_future_then(model, future,
+                            .success = _children_random_index,
+                            .success_type = EINA_VALUE_TYPE_ARRAY);
+   future = efl_future_then(model, future, .error = _assert_on_error, .free = 
_cleanup);
+
+   ecore_main_loop_begin();
 }
 EFL_END_TEST
 

-- 


Reply via email to