aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-09-03 19:36:44 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-09-03 19:36:44 -0300
commitff18dbee7356f3147b4b3ad6ce33bfc8b3ad9eed (patch)
tree4fd8ba8ebf1e116b8c3ac7f0135e276e9a87212f
parentElementary: Fixed efl_ui_list model_set/unset, future_cancel and add/remove m... (diff)
downloadefl-devs/felipealmeida/wip-selection.tar.gz
ecore: WIP composite selection modeldevs/felipealmeida/wip-selection
-rw-r--r--src/Makefile_Ecore.am4
-rw-r--r--src/Makefile_Efl.am2
-rw-r--r--src/lib/ecore/Ecore_Eo.h2
-rw-r--r--src/lib/ecore/efl_model_accessor_view.c104
-rw-r--r--src/lib/ecore/efl_model_accessor_view_private.h5
-rw-r--r--src/lib/ecore/efl_model_composite_boolean.c21
-rw-r--r--src/lib/ecore/efl_model_composite_boolean.eo15
-rw-r--r--src/lib/ecore/efl_model_composite_selection.c144
-rw-r--r--src/lib/ecore/efl_model_composite_selection.eo16
-rw-r--r--src/lib/ecore/efl_model_composite_selection_children.eo7
-rw-r--r--src/tests/efl/efl_test_model_composite.c (renamed from src/tests/efl/efl_test_model_composite_boolean.c)120
-rw-r--r--src/tests/efl/efl_test_model_container.c2
12 files changed, 421 insertions, 21 deletions
diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am
index c5be098bf7..0ba8c95320 100644
--- a/src/Makefile_Ecore.am
+++ b/src/Makefile_Ecore.am
@@ -30,6 +30,8 @@ ecore_eolian_files = \
lib/ecore/efl_model_container_item.eo \
lib/ecore/efl_model_composite_boolean.eo \
lib/ecore/efl_model_composite_boolean_children.eo \
+ lib/ecore/efl_model_composite_selection.eo \
+ lib/ecore/efl_model_composite_selection_children.eo \
$(ecore_eolian_files_legacy)
ecore_eolian_c = $(ecore_eolian_files:%.eo=%.eo.c)
@@ -90,6 +92,8 @@ lib/ecore/efl_model_container.c \
lib/ecore/efl_model_container_item.c \
lib/ecore/efl_model_container_private.h \
lib/ecore/efl_model_composite_boolean.c \
+lib/ecore/efl_model_composite_selection.c \
+lib/ecore/efl_model_accessor_view.c \
lib/ecore/ecore_pipe.c \
lib/ecore/ecore_poller.c \
lib/ecore/ecore_time.c \
diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am
index d615e27595..58b2c091cc 100644
--- a/src/Makefile_Efl.am
+++ b/src/Makefile_Efl.am
@@ -187,7 +187,7 @@ TESTS += tests/efl/efl_suite
tests_efl_efl_suite_SOURCES = \
tests/efl/efl_suite.c \
tests/efl/efl_test_model_container.c \
-tests/efl/efl_test_model_composite_boolean.c \
+tests/efl/efl_test_model_composite.c \
tests/efl/efl_suite.h
tests_efl_efl_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
diff --git a/src/lib/ecore/Ecore_Eo.h b/src/lib/ecore/Ecore_Eo.h
index 502f6419ec..aadd2ba136 100644
--- a/src/lib/ecore/Ecore_Eo.h
+++ b/src/lib/ecore/Ecore_Eo.h
@@ -115,6 +115,8 @@ EAPI Efl_Future *efl_future_iterator_race(Eina_Iterator *it);
#include "efl_model_container_item.eo.h"
#include "efl_model_composite_boolean.eo.h"
#include "efl_model_composite_boolean_children.eo.h"
+#include "efl_model_composite_selection.eo.h"
+#include "efl_model_composite_selection_children.eo.h"
/**
* @}
diff --git a/src/lib/ecore/efl_model_accessor_view.c b/src/lib/ecore/efl_model_accessor_view.c
new file mode 100644
index 0000000000..6b62b1ddac
--- /dev/null
+++ b/src/lib/ecore/efl_model_accessor_view.c
@@ -0,0 +1,104 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "Eina.h"
+#include "Eo.h"
+
+#include "efl_model_accessor_view_private.h"
+
+typedef struct _Efl_Model_Accessor
+{
+ Eina_Accessor vtable;
+ Eina_Accessor *real_accessor;
+ void* pdata;
+ Efl_Model_Accessor_View_Constructor_Cb cb;
+} Efl_Model_Accessor;
+
+static Eina_Bool
+_efl_model_acessor_get_at(Efl_Model_Accessor *acc, unsigned int idx, void **data)
+{
+ void* eo;
+ Eo *p, *new_eo;
+
+ if(eina_accessor_data_get(acc->real_accessor, idx, &eo))
+ {
+ p = eo;
+ new_eo = acc->cb(acc->pdata, p);
+ *data = new_eo;
+ return EINA_TRUE;
+ }
+ else
+ return EINA_FALSE;
+}
+
+static void *
+_efl_model_acessor_get_container(Efl_Model_Accessor *acc)
+{
+ return eina_accessor_container_get(acc->real_accessor);
+}
+
+static void
+_efl_model_acessor_free(Efl_Model_Accessor *acc)
+{
+ if (acc->real_accessor)
+ {
+ eina_accessor_free(acc->real_accessor);
+ acc->real_accessor = NULL;
+ }
+
+ free(acc);
+}
+
+static Eina_Bool
+_efl_model_acessor_lock(Efl_Model_Accessor *acc)
+{
+ return eina_accessor_lock(acc->real_accessor);
+}
+
+static Eina_Bool
+_efl_model_acessor_unlock(Efl_Model_Accessor *acc)
+{
+ return eina_accessor_unlock(acc->real_accessor);
+}
+
+static Efl_Model_Accessor *
+_efl_model_acessor_clone(Efl_Model_Accessor *acc EINA_UNUSED)
+{
+ return NULL;
+}
+
+static void
+_efl_model_accessor_setup(Efl_Model_Accessor *acc,
+ Eina_Accessor* real_accessor,
+ Efl_Model_Accessor_View_Constructor_Cb ctor,
+ void* pdata)
+{
+ acc->vtable.version = EINA_ACCESSOR_VERSION;
+ acc->vtable.get_at = FUNC_ACCESSOR_GET_AT(_efl_model_acessor_get_at);
+ acc->vtable.get_container = FUNC_ACCESSOR_GET_CONTAINER(_efl_model_acessor_get_container);
+ acc->vtable.free = FUNC_ACCESSOR_FREE(_efl_model_acessor_free);
+
+ acc->vtable.lock = FUNC_ACCESSOR_LOCK(_efl_model_acessor_lock);
+ acc->vtable.unlock = FUNC_ACCESSOR_LOCK(_efl_model_acessor_unlock);
+
+ acc->vtable.clone = FUNC_ACCESSOR_CLONE(_efl_model_acessor_clone);
+
+ EINA_MAGIC_SET(&acc->vtable, EINA_MAGIC_ACCESSOR);
+
+ acc->real_accessor = real_accessor;
+ acc->cb = ctor;
+ acc->pdata = pdata;
+}
+
+Eina_Accessor* efl_model_accessor_view_new(Eina_Accessor* accessor,
+ Efl_Model_Accessor_View_Constructor_Cb ctor,
+ void* data)
+{
+ Efl_Model_Accessor* acc = calloc(1, sizeof(Efl_Model_Accessor));
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+ _efl_model_accessor_setup(acc, accessor, ctor, data);
+ return &acc->vtable;
+}
+
+
diff --git a/src/lib/ecore/efl_model_accessor_view_private.h b/src/lib/ecore/efl_model_accessor_view_private.h
new file mode 100644
index 0000000000..c44f2ec3cb
--- /dev/null
+++ b/src/lib/ecore/efl_model_accessor_view_private.h
@@ -0,0 +1,5 @@
+
+typedef Eo*(*Efl_Model_Accessor_View_Constructor_Cb)(void* data, Eo* child);
+
+Eina_Accessor* efl_model_accessor_view_new(Eina_Accessor* accessor,
+ Efl_Model_Accessor_View_Constructor_Cb constructor, void* data);
diff --git a/src/lib/ecore/efl_model_composite_boolean.c b/src/lib/ecore/efl_model_composite_boolean.c
index 7ec344d05c..b9b83b989a 100644
--- a/src/lib/ecore/efl_model_composite_boolean.c
+++ b/src/lib/ecore/efl_model_composite_boolean.c
@@ -151,33 +151,46 @@ static Efl_Future *
_efl_model_composite_boolean_children_efl_model_property_get(Eo *obj EINA_UNUSED,
Efl_Model_Composite_Boolean_Children_Data *pd, const char *property)
{
+ fprintf(stderr, "%s %s:%d %s\n", __func__, __FILE__, __LINE__, property); fflush(stderr);
Efl_Model_Hash_Value *hv = eina_hash_find(pd->parent_pd->values, property);
if (hv)
{
+ fprintf(stderr, "%s %s:%d %s\n", __func__, __FILE__, __LINE__, property); fflush(stderr);
Efl_Promise *promise = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
Efl_Future *rfuture = efl_promise_future_get(promise);
+ fprintf(stderr, "%s %s:%d %s\n", __func__, __FILE__, __LINE__, property); fflush(stderr);
Eina_Value *eina_value = eina_value_new(EINA_VALUE_TYPE_UCHAR);
if (hv->bits_count <= pd->index)
{
- unsigned char f = hv->default_value;
- eina_value_set(eina_value, f);
+ fprintf(stderr, "%s %s:%d %s\n", __func__, __FILE__, __LINE__, property); fflush(stderr);
+ unsigned char f = hv->default_value;
+ eina_value_set(eina_value, f);
}
else
{
+ fprintf(stderr, "%s %s:%d %s\n", __func__, __FILE__, __LINE__, property); fflush(stderr);
eina_value_set(eina_value, _bit_get(hv->buffer, pd->index));
}
+ fprintf(stderr, "%s %s:%d %s\n", __func__, __FILE__, __LINE__, property); fflush(stderr);
efl_promise_value_set(promise, eina_value, (Eina_Free_Cb)eina_value_free);
+ fprintf(stderr, "%s %s:%d %s\n", __func__, __FILE__, __LINE__, property); fflush(stderr);
return rfuture;
}
else if (pd->composite_child)
+ {
+ fprintf(stderr, "%s %s:%d %s\n", __func__, __FILE__, __LINE__, property); fflush(stderr);
return efl_model_property_get(pd->composite_child, property);
+ }
else
{
+ fprintf(stderr, "%s %s:%d %s\n", __func__, __FILE__, __LINE__, property); fflush(stderr);
Efl_Promise *promise = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
Efl_Future *rfuture = efl_promise_future_get(promise);
+ fprintf(stderr, "%s %s:%d %s\n", __func__, __FILE__, __LINE__, property); fflush(stderr);
efl_promise_failed_set(promise, EFL_MODEL_ERROR_NOT_FOUND);
+ fprintf(stderr, "%s %s:%d %s\n", __func__, __FILE__, __LINE__, property); fflush(stderr);
return rfuture;
}
}
@@ -494,7 +507,7 @@ _efl_model_composite_boolean_efl_object_destructor(Eo *obj, Efl_Model_Composite_
}
static void
-_efl_model_composite_boolean_composite_model_set(Eo *obj EINA_UNUSED,
+_efl_model_composite_boolean_efl_ui_view_model_set(Eo *obj EINA_UNUSED,
Efl_Model_Composite_Boolean_Data *pd, Efl_Model *model)
{
if (pd->composite_model)
@@ -506,7 +519,7 @@ _efl_model_composite_boolean_composite_model_set(Eo *obj EINA_UNUSED,
}
static Efl_Model *
-_efl_model_composite_boolean_composite_model_get(Eo *obj EINA_UNUSED, Efl_Model_Composite_Boolean_Data *pd)
+_efl_model_composite_boolean_efl_ui_view_model_get(Eo *obj EINA_UNUSED, Efl_Model_Composite_Boolean_Data *pd)
{
return pd->composite_model;
}
diff --git a/src/lib/ecore/efl_model_composite_boolean.eo b/src/lib/ecore/efl_model_composite_boolean.eo
index cdca17e998..bb7eacbb11 100644
--- a/src/lib/ecore/efl_model_composite_boolean.eo
+++ b/src/lib/ecore/efl_model_composite_boolean.eo
@@ -1,17 +1,7 @@
-class Efl.Model.Composite.Boolean (Efl.Object, Efl.Model)
+class Efl.Model.Composite.Boolean (Efl.Object, Efl.Model, Efl.Ui.View)
{
[[Efl model composite boolean class]]
methods {
- @property composite_model {
- [[Composite model]]
- set {
- }
- get {
- }
- values {
- model: Efl.Model; [[Efl model]]
- }
- }
property_add {
[[Adds property]]
params {
@@ -29,9 +19,10 @@ class Efl.Model.Composite.Boolean (Efl.Object, Efl.Model)
Efl.Model.children_count_get;
Efl.Model.child_add;
Efl.Model.child_del;
+ Efl.Ui.View.model { set; get; }
}
constructors {
- .composite_model;
+ Efl.Ui.View.model;
.property_add @optional;
}
}
diff --git a/src/lib/ecore/efl_model_composite_selection.c b/src/lib/ecore/efl_model_composite_selection.c
new file mode 100644
index 0000000000..86e2fcf40e
--- /dev/null
+++ b/src/lib/ecore/efl_model_composite_selection.c
@@ -0,0 +1,144 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "Eina.h"
+#include "Efl.h"
+#include <Ecore.h>
+#include "Eo.h"
+
+#include "efl_model_composite_selection.eo.h"
+#include "efl_model_accessor_view_private.h"
+
+typedef struct _Efl_Model_Composite_Selection_Data
+{
+ Efl_Model_Composite_Selection* obj;
+ struct {
+ Efl_Model* selected_child;
+ } exclusive_data;
+ Eina_Bool is_exclusive;
+
+} Efl_Model_Composite_Selection_Data;
+
+typedef struct _Efl_Model_Composite_Selection_Children_Data
+{
+ Efl_Model_Composite_Selection_Data* pd;
+} Efl_Model_Composite_Selection_Children_Data;
+
+static Eo*
+_efl_model_composite_selection_efl_object_constructor(Eo *obj,
+ Efl_Model_Composite_Selection_Data *pd EINA_UNUSED)
+{
+ efl_constructor(efl_super(obj, EFL_MODEL_COMPOSITE_SELECTION_CLASS));
+ efl_model_composite_boolean_property_add(obj, "selected", EINA_FALSE);
+ return obj;
+}
+
+/***************************/
+
+static void _select_slice_then(void* data, Eo_Event const* event)
+{
+
+}
+
+/***************************/
+
+static Efl_Future*
+_efl_model_composite_selection_select(Eo *obj,
+ Efl_Model_Composite_Selection_Data *pd, int idx)
+{
+ if(pd->is_exclusive)
+ {
+
+ }
+ else
+ {
+
+ }
+}
+
+static Efl_Future *
+_efl_model_composite_selection_children_efl_model_property_set(Eo *obj EINA_UNUSED,
+ Efl_Model_Composite_Selection_Children_Data *pd, const char *property, const Eina_Value *value)
+{
+
+ fprintf(stderr, "%s %s:%d %s\n", __func__, __FILE__, __LINE__, property); fflush(stderr);
+ if(!strcmp("selected", property))
+ {
+ unsigned long v = EINA_FALSE;
+ if(eina_value_type_get(value) != EINA_VALUE_TYPE_ULONG)
+ {
+ Eina_Value to;
+ eina_value_setup(&to, EINA_VALUE_TYPE_ULONG);
+ if(eina_value_convert(value, &to))
+ eina_value_get(&to, &v);
+ eina_value_flush(&to);
+ }
+
+
+ if(v && pd->pd->is_exclusive)
+ {
+ Efl_Promise *promise = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
+ Efl_Future *rfuture = efl_promise_future_get(promise);
+ // unset current selected
+ // set this child as current
+ // bookkeep this child as current selection
+ // return with future for this asynchronous task
+ }
+ }
+
+ return efl_model_property_set(efl_super(obj, EFL_MODEL_COMPOSITE_SELECTION_CHILDREN_CLASS),
+ property, value);
+}
+
+static Eo* _construct_children(void* pdata, Eo* child)
+{
+ Efl_Model_Composite_Selection_Data* pd = pdata;
+ Eo* new_child = efl_add(EFL_MODEL_COMPOSITE_SELECTION_CHILDREN_CLASS, NULL);
+ Efl_Model_Composite_Selection_Children_Data* data = efl_data_scope_get
+ (new_child, EFL_MODEL_COMPOSITE_SELECTION_CHILDREN_CLASS);
+ data->pd = pd;
+ efl_composite_attach(new_child, child);
+ return new_child;
+}
+
+static void _composited_children_slice_get_then(void* data, Efl_Event const* event)
+{
+ Efl_Promise* promise = data;
+ Efl_Future_Event_Success* success = event->info;
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+ efl_promise_value_set(promise,
+ efl_model_accessor_view_new(success->value, &_construct_children,
+ NULL),
+ (Eina_Free_Cb)&eina_accessor_free);
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+}
+static void _composited_children_slice_get_fail(void* data, Efl_Event const* event)
+{
+ Efl_Promise* promise = data;
+ Efl_Future_Event_Failure* failure = event->info;
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+ efl_promise_failed_set(promise, failure->error);
+}
+
+static Efl_Future *
+_efl_model_composite_selection_efl_model_children_slice_get(Eo *obj, Efl_Model_Composite_Selection_Data *pd, unsigned int start, unsigned int count)
+{
+ Efl_Promise *promise = efl_add(EFL_PROMISE_CLASS, ecore_main_loop_get());
+ Efl_Future *rfuture = efl_promise_future_get(promise);
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+
+ Efl_Future* composited_future = efl_model_children_slice_get
+ (efl_super(obj, EFL_MODEL_COMPOSITE_SELECTION_CLASS),
+ start, count);
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+ efl_future_then(composited_future, &_composited_children_slice_get_then,
+ &_composited_children_slice_get_fail, NULL, promise);
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+
+ return rfuture;
+}
+
+#include "efl_model_composite_selection.eo.c"
+#include "efl_model_composite_selection_children.eo.c"
+
diff --git a/src/lib/ecore/efl_model_composite_selection.eo b/src/lib/ecore/efl_model_composite_selection.eo
new file mode 100644
index 0000000000..cfa9e388d8
--- /dev/null
+++ b/src/lib/ecore/efl_model_composite_selection.eo
@@ -0,0 +1,16 @@
+class Efl.Model.Composite.Selection (Efl.Model.Composite.Boolean)
+{
+ [[Efl model composite selection class]]
+ methods {
+ select {
+ params {
+ idx: int;
+ }
+ return: future<eina.value>;
+ }
+ }
+ implements {
+ Efl.Object.constructor;
+ Efl.Model.children_slice_get;
+ }
+}
diff --git a/src/lib/ecore/efl_model_composite_selection_children.eo b/src/lib/ecore/efl_model_composite_selection_children.eo
new file mode 100644
index 0000000000..2ea5c950ef
--- /dev/null
+++ b/src/lib/ecore/efl_model_composite_selection_children.eo
@@ -0,0 +1,7 @@
+class Efl.Model.Composite.Selection.Children (Efl.Object, Efl.Model)
+{
+ [[Efl model composite selection children class]]
+ implements {
+ Efl.Model.property_set;
+ }
+}
diff --git a/src/tests/efl/efl_test_model_composite_boolean.c b/src/tests/efl/efl_test_model_composite.c
index 2b94fa7aa0..4c6eef99c4 100644
--- a/src/tests/efl/efl_test_model_composite_boolean.c
+++ b/src/tests/efl/efl_test_model_composite.c
@@ -37,8 +37,15 @@ typedef struct _Test_Child_Data
unsigned int idx;
} Test_Child_Data;
+typedef struct _Selection_Test_Child_Data
+{
+ Test_Data *tdata;
+ unsigned int idx;
+} Selection_Test_Child_Data;
+
const int child_number = 3;
const int base_ints[] = { 41, 42, 43 };
+const Eina_Bool base_selections[] = { EINA_FALSE, EINA_FALSE, EINA_TRUE };
static void
_future_error_then(void *data EINA_UNUSED, Efl_Event const* event EINA_UNUSED)
@@ -79,6 +86,38 @@ _property_get_then(void *data, Efl_Event const *event)
}
static void
+_selection_property_get_then(void *data, Efl_Event const *event)
+{
+ Selection_Test_Child_Data *t = data;
+ Eina_Accessor *value_itt = (Eina_Accessor*)((Efl_Future_Event_Success*)event->info)->value;
+ int v_int = 0;
+ Eina_Bool v_bool = EINA_FALSE;
+
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+
+#define EFL_TEST_value_get_and_compare(it, i, var, cmp) \
+ do { \
+ Eina_Value *vvv = NULL; \
+ if (!eina_accessor_data_get(it, i, (void **)&vvv) || !vvv || \
+ !eina_value_get(vvv, &var) || var != cmp) \
+ { \
+ fprintf(stderr, "Could not get value!\n"); fflush(stderr); \
+ ck_abort_msg("Could not get value"); \
+ return; \
+ } \
+ } while(0)
+
+ EFL_TEST_value_get_and_compare(value_itt, 0, v_int, base_ints[t->idx]);
+ EFL_TEST_value_get_and_compare(value_itt, 1, v_bool, base_selections[t->idx]);
+
+ t->tdata->child_count++;
+ if (t->tdata->child_count == 3)
+ t->tdata->success_flag = EINA_TRUE;
+
+#undef EFL_TEST_value_get_and_compare
+}
+
+static void
_children_slice_get_then(void *data, Efl_Event const* event)
{
Eina_Accessor *children = (Eina_Accessor *)((Efl_Future_Event_Success*)event->info)->value;
@@ -86,7 +125,6 @@ _children_slice_get_then(void *data, Efl_Event const* event)
Test_Child_Data *t;
unsigned int i = 0;
- fprintf(stderr, "OPAAAAAAa\n");
EINA_ACCESSOR_FOREACH(children, i, child)
{
Efl_Future *futures[3] = {NULL,};
@@ -105,6 +143,37 @@ _children_slice_get_then(void *data, Efl_Event const* event)
}
}
+static void
+_selection_children_slice_get_then(void *data, Efl_Event const* event)
+{
+ Eina_Accessor *children = (Eina_Accessor *)((Efl_Future_Event_Success*)event->info)->value;
+ Efl_Model *child;
+ Test_Child_Data *t;
+ unsigned int i = 0;
+
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+
+ EINA_ACCESSOR_FOREACH(children, i, child)
+ {
+ Efl_Future *futures[3] = {NULL,};
+ Efl_Future *future_all = NULL;
+
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+ futures[0] = efl_model_property_get(child, "test_p_int");
+ futures[1] = efl_model_property_get(child, "selected");
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+
+ future_all = efl_future_all(futures[0], futures[1]);
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+
+ t = calloc(1, sizeof(Selection_Test_Child_Data));
+ t->tdata = data;
+ t->idx = i;
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+ efl_future_then(future_all, _selection_property_get_then, _future_error_then, NULL, t);
+ }
+}
+
START_TEST(efl_test_model_composite_boolean)
{
Efl_Model_Item *base_model, *child;
@@ -131,7 +200,7 @@ START_TEST(efl_test_model_composite_boolean)
}
model = efl_add(EFL_MODEL_COMPOSITE_BOOLEAN_CLASS, NULL,
- efl_model_composite_boolean_composite_model_set(efl_added, base_model),
+ efl_ui_view_model_set(efl_added, base_model),
efl_model_composite_boolean_property_add(efl_added, "test_p_true", EINA_TRUE),
efl_model_composite_boolean_property_add(efl_added, "test_p_false", EINA_FALSE));
ck_assert(!!model);
@@ -148,8 +217,53 @@ START_TEST(efl_test_model_composite_boolean)
}
END_TEST
+START_TEST(efl_test_model_composite_selection)
+{
+ Efl_Model_Item *base_model, *child;
+ int i;
+ Eina_Value v;
+ Efl_Model_Composite_Selection *model;
+ Test_Data *tdata;
+ Efl_Future *future;
+
+ fail_if(!ecore_init(), "ERROR: Cannot init Ecore!\n");
+ fail_if(!efl_object_init(), "ERROR: Cannot init EO!\n");
+
+ eina_value_setup(&v, EINA_VALUE_TYPE_INT);
+
+ base_model = efl_add(EFL_MODEL_ITEM_CLASS, NULL);
+ ck_assert(!!base_model);
+
+ for (i = 0; i < child_number; ++i)
+ {
+ child = efl_model_child_add(base_model);
+ ck_assert(!!child);
+ ck_assert(eina_value_set(&v, base_ints[i]));
+ efl_model_property_set(child, "test_p_int", &v);
+ }
+
+ model = efl_add(EFL_MODEL_COMPOSITE_SELECTION_CLASS, NULL,
+ efl_ui_view_model_set(efl_added, base_model));
+ ck_assert(!!model);
+ efl_model_composite_selection_select(model, 3);
+
+ tdata = calloc(1, sizeof(Test_Data));
+ future = efl_model_children_slice_get(model, 0, 0);
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+ efl_future_then(future, _selection_children_slice_get_then, _future_error_then, NULL, tdata);
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+
+ ecore_main_loop_iterate();
+
+ ck_assert(tdata->success_flag);
+
+ ecore_shutdown();
+}
+END_TEST
+
void
efl_test_case_model_composite_boolean(TCase *tc)
{
- tcase_add_test(tc, efl_test_model_composite_boolean);
+ /* tcase_add_test(tc, efl_test_model_composite_boolean); */
+ tcase_add_test(tc, efl_test_model_composite_selection);
}
diff --git a/src/tests/efl/efl_test_model_container.c b/src/tests/efl/efl_test_model_container.c
index 5710ef2337..63e79d31e7 100644
--- a/src/tests/efl/efl_test_model_container.c
+++ b/src/tests/efl/efl_test_model_container.c
@@ -167,5 +167,5 @@ END_TEST
void
efl_test_case_model_container(TCase *tc)
{
- tcase_add_test(tc, efl_test_model_container_values);
+ /* tcase_add_test(tc, efl_test_model_container_values); */
}