summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-03-11 15:48:29 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-03-11 15:48:29 -0300
commit44772c9c2da80b411cda95828e6a2e4b827a121d (patch)
tree5f9c8af978601660677aa68af4d662196436ce3a
parentbbb208abb30c24b490dfe5e3d69cd81934a6ae11 (diff)
downloadefl-devs/felipealmeida/mono_model.tar.gz
efl-mono: More modeldevs/felipealmeida/mono_model
-rw-r--r--src/bindings/mono/efl_mono/GenericModel.cs30
-rw-r--r--src/bindings/mono/efl_mono/UserModel.cs83
-rw-r--r--src/bindings/mono/eina_mono/eina_promises.cs10
-rw-r--r--src/bindings/mono/eina_mono/eina_value.cs4
-rw-r--r--src/bindings/mono/eo_mono/iwrapper.cs11
-rw-r--r--src/lib/ecore/efl_loop.c6
-rw-r--r--src/lib/ecore/efl_loop_consumer.c1
-rw-r--r--src/lib/ecore/efl_mono_model_internal.c80
-rw-r--r--src/lib/ecore/efl_mono_model_internal.eo2
-rw-r--r--src/lib/ecore/efl_mono_model_internal_child.eo2
-rw-r--r--src/lib/efl/interfaces/efl_model.eo2
-rw-r--r--src/lib/eina/eina_log.c2
-rw-r--r--src/lib/eina/eina_promise.c2
-rw-r--r--src/lib/eina/eina_value.c5
-rw-r--r--src/tests/efl_mono/Model.cs31
15 files changed, 210 insertions, 61 deletions
diff --git a/src/bindings/mono/efl_mono/GenericModel.cs b/src/bindings/mono/efl_mono/GenericModel.cs
index 214755cefb..773c61a5d0 100644
--- a/src/bindings/mono/efl_mono/GenericModel.cs
+++ b/src/bindings/mono/efl_mono/GenericModel.cs
@@ -3,6 +3,7 @@ using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
+using Eina;
namespace Efl {
@@ -52,6 +53,12 @@ public class GenericModel<T> : Efl.Object, Efl.Model, IDisposable
{
return model.GetChildrenSlice(start, count);
}
+ public void Add(T o)
+ {
+ Efl.Object obj = this.AddChild();
+ Efl.Model child = Efl.ModelConcrete.static_cast(obj);
+ ModelHelper.SetProperties(o, child);
+ }
public Efl.Object AddChild()
{
return model.AddChild();
@@ -60,6 +67,29 @@ public class GenericModel<T> : Efl.Object, Efl.Model, IDisposable
{
model.DelChild(child);
}
+ async public System.Threading.Tasks.Task<T> GetAtAsync(uint index)
+ {
+ Console.WriteLine("awaiting getchildren");
+ using (Eina.Value v = await GetChildrenSliceAsync(index, 1))
+ {
+ Console.WriteLine("awaited getchildren");
+ if (v.GetValueType().IsContainer())
+ {
+ Console.WriteLine("awaited getchildren is container");
+ var o = (Efl.Object)v[0];
+ var child = Efl.ModelConcrete.static_cast(o);
+ T obj = (T)Activator.CreateInstance(typeof(T), new System.Object[] {});
+ ModelHelper.GetProperties(obj, child);
+ return obj;
+ }
+ else
+ {
+ Console.WriteLine("awaited getchildren NOT container");
+ // error
+ throw new System.Exception("");
+ }
+ }
+ }
public System.Threading.Tasks.Task<Eina.Value> SetPropertyAsync( System.String property, Eina.Value value, System.Threading.CancellationToken token=default(System.Threading.CancellationToken))
{
return model.SetPropertyAsync(property, value, token);
diff --git a/src/bindings/mono/efl_mono/UserModel.cs b/src/bindings/mono/efl_mono/UserModel.cs
index 4555607470..c7584d7b28 100644
--- a/src/bindings/mono/efl_mono/UserModel.cs
+++ b/src/bindings/mono/efl_mono/UserModel.cs
@@ -6,6 +6,65 @@ using System.ComponentModel;
namespace Efl {
+internal class ModelHelper
+{
+ static internal void SetProperties<T>(T o, Efl.Model child)
+ {
+ var properties = typeof(T).GetProperties();
+ foreach(var prop in properties)
+ {
+ Eina.Value v;
+ if (prop.PropertyType == typeof(int))
+ {
+ v = new Eina.Value(Eina.ValueType.Int32);
+ v.Set((int)prop.GetValue(o));
+ }
+ else if (prop.PropertyType == typeof(string))
+ {
+ v = new Eina.Value(Eina.ValueType.String);
+ v.Set((string)prop.GetValue(o));
+ }
+ else
+ throw new Exception("Type unknown " + prop.PropertyType.Name);
+ Console.WriteLine ("Setting property with value {0}", v.ToString());
+ child.SetProperty(prop.Name, v);
+ //v.Dispose();
+ }
+ }
+
+ static internal void GetProperties<T>(T o, Efl.Model child)
+ {
+ var properties = typeof(T).GetProperties();
+ foreach(var prop in properties)
+ {
+ Console.WriteLine("Reading property of name {0}", prop.Name);
+ using (var v = child.GetProperty(prop.Name))
+ {
+ Console.WriteLine("Read property");
+ if (prop.PropertyType == typeof(int))
+ {
+ int x;
+ v.Get(out x);
+ Console.WriteLine("Type is int, value is {0}", x);
+ prop.SetValue(o, x);
+ }
+ else if (prop.PropertyType == typeof(string))
+ {
+ string x;
+ v.Get(out x);
+ Console.WriteLine("Type is string, value is {0}", x);
+ prop.SetValue(o, x);
+ }
+ else
+ {
+ Console.WriteLine("Type is unknown");
+ throw new Exception("Type unknown " + prop.PropertyType.Name);
+ }
+ }
+ }
+ }
+}
+
public class UserModel<T> : Efl.MonoModelInternal, IDisposable
{
///<summary>Pointer to the native class description.</summary>
@@ -36,30 +95,14 @@ public class UserModel<T> : Efl.MonoModelInternal, IDisposable
public void Add (T o)
{
Efl.Object obj = this.AddChild();
- if (obj == null)
- Console.WriteLine("Object from AddChild is null");
+ // if (obj == null)
+ // Console.WriteLine("Object from AddChild is null");
//Debug.Assert(obj != null);
+ Console.WriteLine ("static casting"); Console.Out.Flush();
Efl.Model child = Efl.ModelConcrete.static_cast(obj);
//Debug.Assert(child != null);
- var properties = typeof(T).GetProperties();
- foreach(var prop in properties)
- {
- Eina.Value v;
- if (prop.PropertyType == typeof(int))
- {
- v = new Eina.Value(Eina.ValueType.Int32);
- v.Set((int)prop.GetValue(o));
- }
- else if (prop.PropertyType == typeof(string))
- {
- v = new Eina.Value(Eina.ValueType.String);
- v.Set((string)prop.GetValue(o));
- }
- else
- throw new Exception("Type unknown " + prop.PropertyType.Name);
- child.SetProperty(prop.Name, v);
- }
+ ModelHelper.SetProperties(o, child);
}
}
diff --git a/src/bindings/mono/eina_mono/eina_promises.cs b/src/bindings/mono/eina_mono/eina_promises.cs
index 8be5f9d6cb..0ef12dffa8 100644
--- a/src/bindings/mono/eina_mono/eina_promises.cs
+++ b/src/bindings/mono/eina_mono/eina_promises.cs
@@ -197,10 +197,11 @@ public class Future
/// </summary>
public Future(IntPtr handle)
{
- Handle = ThenRaw(handle, (Eina.Value value) => {
- Handle = IntPtr.Zero;
- return value;
- });
+ Handle = handle;
+ // Handle = ThenRaw(handle, (Eina.Value value) => {
+ // Handle = IntPtr.Zero;
+ // return value;
+ // });
}
/// <summary>
@@ -265,6 +266,7 @@ public class Future
}
private static Eina.ValueNative NativeResolvedCb(IntPtr data, Eina.ValueNative value, IntPtr dead_future)
{
+ Console.WriteLine("Type is addr 0x{0:X}", value.Type.ToInt64());
GCHandle handle = GCHandle.FromIntPtr(data);
ResolvedCb cb = handle.Target as ResolvedCb;
if (cb != null)
diff --git a/src/bindings/mono/eina_mono/eina_value.cs b/src/bindings/mono/eina_mono/eina_value.cs
index ce92140c37..ab5334d301 100644
--- a/src/bindings/mono/eina_mono/eina_value.cs
+++ b/src/bindings/mono/eina_mono/eina_value.cs
@@ -776,6 +776,10 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
/// <summary>Constructor to build value from Values_Natives passed by value from C.</summary>
public Value(ValueNative value)
{
+ Console.WriteLine("Type is addr 0x{0:X}", value.Type.ToInt64());
+ var t = ValueTypeBridge.GetManaged(value.Type);
+ Console.WriteLine("Type is {0}", t);
+
IntPtr tmp = IntPtr.Zero;
try {
this.Handle = Alloc();
diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs
index 7243fad592..ac9ab222a4 100644
--- a/src/bindings/mono/eo_mono/iwrapper.cs
+++ b/src/bindings/mono/eo_mono/iwrapper.cs
@@ -416,7 +416,7 @@ public class Globals {
Eina.Log.Debug($"Calling data_scope_get with obj {obj.NativeHandle.ToInt64():x} and klass {obj.NativeClass.ToInt64():x}");
Console.WriteLine($"Calling data_scope_get with obj {obj.NativeHandle.ToInt64():x} and klass {obj.NativeClass.ToInt64():x}");
IntPtr pd = Efl.Eo.Globals.efl_data_scope_get(obj.NativeHandle, obj.NativeClass);
- if (pd != null)
+ if (pd != IntPtr.Zero)
{
GCHandle gch = GCHandle.Alloc(obj);
EolianPD epd;
@@ -467,12 +467,17 @@ public class Globals {
// Flag to be passed to the cancell callback
bool fulfilled = false;
+ Console.WriteLine("1"); Console.Out.Flush();
+
future.Then((Eina.Value received) => {
+ Console.WriteLine("2"); Console.Out.Flush();
lock (future)
{
+ Console.WriteLine("2"); Console.Out.Flush();
// Convert an failed Future to a failed Task.
if (received.GetValueType() == Eina.ValueType.Error)
{
+ Console.WriteLine("Error"); Console.Out.Flush();
Eina.Error err;
received.Get(out err);
if (err == Eina.Error.ECANCELED)
@@ -482,6 +487,7 @@ public class Globals {
}
else
{
+ Console.WriteLine("Succeeded"); Console.Out.Flush();
// Will mark the returned task below as completed.
tcs.SetResult(received);
}
@@ -489,8 +495,10 @@ public class Globals {
return received;
}
});
+ Console.WriteLine("11"); Console.Out.Flush();
// Callback to be called when the token is cancelled.
token.Register(() => {
+ Console.WriteLine("4"); Console.Out.Flush();
lock (future)
{
// Will trigger the Then callback above with an Eina.Error
@@ -498,6 +506,7 @@ public class Globals {
future.Cancel();
}
});
+ Console.WriteLine("3"); Console.Out.Flush();
return tcs.Task;
}
diff --git a/src/lib/ecore/efl_loop.c b/src/lib/ecore/efl_loop.c
index 1096c62bdb..7c37d49ba0 100644
--- a/src/lib/ecore/efl_loop.c
+++ b/src/lib/ecore/efl_loop.c
@@ -690,7 +690,10 @@ efl_loop_future_scheduler_get(const Eo *obj)
{
Efl_Loop *loop;
+ printf ("efl_loop_future_scheduler_get\n"); fflush(stdout);
+
if (!obj) return NULL;
+ printf ("efl_loop_future_scheduler_get\n"); fflush(stdout);
if (efl_isa(obj, EFL_LOOP_CLASS))
{
@@ -711,9 +714,12 @@ efl_loop_future_scheduler_get(const Eo *obj)
return efl_loop_future_scheduler_get(efl_loop_get(obj));
loop = efl_provider_find(obj, EFL_LOOP_CLASS);
+ printf ("scheduler found %p\n", loop); fflush(stdout);
if (loop)
return efl_loop_future_scheduler_get(loop);
+ printf ("no scheduler found\n"); fflush(stdout);
+
return NULL;
}
diff --git a/src/lib/ecore/efl_loop_consumer.c b/src/lib/ecore/efl_loop_consumer.c
index 2b5182e6d8..d2f5de88d3 100644
--- a/src/lib/ecore/efl_loop_consumer.c
+++ b/src/lib/ecore/efl_loop_consumer.c
@@ -40,6 +40,7 @@ static Eina_Future *
_efl_loop_consumer_future_resolved(const Eo *obj, Efl_Loop_Consumer_Data *pd EINA_UNUSED,
Eina_Value result)
{
+ printf("_efl_loop_consumer_future_resolved\n"); fflush(stdout);
return eina_future_resolved(efl_loop_future_scheduler_get(obj), result);
}
diff --git a/src/lib/ecore/efl_mono_model_internal.c b/src/lib/ecore/efl_mono_model_internal.c
index bdd6ce6045..f613422ce4 100644
--- a/src/lib/ecore/efl_mono_model_internal.c
+++ b/src/lib/ecore/efl_mono_model_internal.c
@@ -35,16 +35,18 @@ typedef struct _Efl_Mono_Model_Internal_Child_Data
Efl_Mono_Model_Internal_Data* model_pd;
size_t index;
Eina_Array *values;
+ Eo* child;
//Eina_Array *items;
} Efl_Mono_Model_Internal_Child_Data;
-static int _find_property_index (const char* name, Eina_Array* properties_info)
+static int _find_property_index (const char* name, Eina_Array* properties_name)
{
- int i, size = eina_array_count_get(properties_info);
+ int i, size = eina_array_count_get(properties_name);
fprintf(stdout, "count %d\n", size); fflush(stdout);
for (i = 0; i != size; ++i)
{
- if (!strcmp(properties_info->data[i], name))
+ printf ("Testing %s with %s\n", (char*)properties_name->data[i], name); fflush(stdout);
+ if (!strcmp(properties_name->data[i], name))
{
return i;
}
@@ -59,6 +61,7 @@ _efl_mono_model_internal_efl_object_constructor(Eo *obj, Efl_Mono_Model_Internal
obj = efl_constructor(efl_super(obj, MY_CLASS));
pd->properties_info = eina_array_new(5);
+ pd->properties_names = eina_array_new(5);
pd->items = eina_array_new(5);
if (!obj) return NULL;
@@ -81,6 +84,7 @@ _efl_mono_model_internal_add_property(Eo *obj EINA_UNUSED, Efl_Mono_Model_Intern
info->name = eina_stringshare_add(name);
info->type = type;
eina_array_push (pd->properties_info, info);
+ eina_array_push (pd->properties_names, eina_stringshare_add(info->name));
}
@@ -100,6 +104,8 @@ _efl_mono_model_internal_efl_model_child_add(Eo *obj, Efl_Mono_Model_Internal_Da
Efl_Mono_Model_Internal_Child_Data* pcd = efl_data_xref (child, EFL_MONO_MODEL_INTERNAL_CHILD_CLASS, obj);
pcd->model_pd = pd;
pcd->index = eina_array_count_get(pd->items);
+ pcd->child = child;
+ pcd->values = eina_array_new(5);
eina_array_push (pd->items, pcd);
return child;
@@ -115,47 +121,65 @@ static Eina_Future *
_efl_mono_model_internal_child_efl_model_property_set(Eo *obj, Efl_Mono_Model_Internal_Child_Data *pd, const char *property, Eina_Value *value)
{
fprintf (stdout, "property_set\n"); fflush(stdout);
- int i = _find_property_index (property, pd->model_pd->properties_info);
+ int i = _find_property_index (property, pd->model_pd->properties_names);
int j;
Eina_Value* old_value;
+ Eina_Value* new_value;
+ Eina_Value tmp_value;
- fprintf (stdout, "property_set\n"); fflush(stdout);
+ printf ("value type %p\n", value->type); fflush(stdout);
+ fprintf (stdout, "property_set %d\n", i); fflush(stdout);
if (i >= 0)
- //if (0)
{
- for (j = i - eina_array_count_get (pd->values); j; --j)
- eina_array_push (pd->values, NULL);
-
+ fprintf(stdout, __FILE__ ":%d %d %d\n", __LINE__, i, eina_array_count_get (pd->values)); fflush(stdout);
+ for (j = i - eina_array_count_get (pd->values); j >= 0; --j)
+ {
+ fprintf(stdout, __FILE__ ":%d\n", __LINE__); fflush(stdout);
+ eina_array_push (pd->values, (void*)1);
+ pd->values->data[pd->values->count-1] = NULL;
+ }
+
+ fprintf(stdout, __FILE__ ":%d %d %d\n", __LINE__, i, eina_array_count_get (pd->values)); fflush(stdout);
old_value = eina_array_data_get (pd->values, i);
+ fprintf(stdout, __FILE__ ":%d %p\n", __LINE__, old_value); fflush(stdout);
if (old_value)
eina_value_free (old_value);
- eina_array_data_set (pd->values, i, value);
+ new_value = malloc (sizeof(Eina_Value));
+ eina_value_copy (value, new_value);
+ printf ("new_value type %p\n", new_value->type); fflush(stdout);
+ eina_value_copy (value, &tmp_value);
+ printf ("tmp_value type %p\n", tmp_value.type); fflush(stdout);
+ eina_array_data_set (pd->values, i, new_value);
- /* promise = eian_promise_new (efl_loop_future_scheduler_get(obj), NULL, NULL); */
- /* future = eina_future_new (promise); */
+ fprintf(stdout, __FILE__ ":%d\n", __LINE__); fflush(stdout);
-
- Eina_Future* f = efl_loop_future_resolved(obj, *value);
- fprintf(stdout, "com resolved %p\n", f); fflush(stdout);
- assert(!!f);
- return f;
+ return efl_loop_future_resolved(obj, tmp_value);
}
else
{
+ printf ("Index not found!\n"); fflush(stdout);
// not found property
- //return efl_loop_future_rejected(obj, EAGAIN);
-
- Eina_Promise* promise = eina_promise_new (efl_loop_future_scheduler_get(obj), NULL, NULL);
- Eina_Future* future = eina_future_new (promise);
- return future;
+ return efl_loop_future_rejected(obj, EAGAIN);
}
}
static Eina_Value *
_efl_mono_model_internal_child_efl_model_property_get(const Eo *obj EINA_UNUSED, Efl_Mono_Model_Internal_Child_Data *pd EINA_UNUSED, const char *property EINA_UNUSED)
{
- return eina_value_error_new(EAGAIN);
+ printf ("trying to property get prop name %s\n", property); fflush(stdout);
+ int i = _find_property_index (property, pd->model_pd->properties_names);
+ printf ("trying to property get index %d\n", i); fflush(stdout);
+ if(eina_array_count_get (pd->values) <= i
+ || eina_array_data_get (pd->values, i) == NULL)
+ return eina_value_error_new(EAGAIN);
+ else
+ {
+ Eina_Value* src = eina_array_data_get(pd->values, i);
+ Eina_Value* clone = malloc (sizeof(Eina_Value));
+ eina_value_copy (src, clone);
+ return clone;
+ }
}
static Eina_Future *
@@ -163,11 +187,18 @@ _efl_mono_model_internal_efl_model_children_slice_get(Eo *obj, Efl_Mono_Model_In
{
unsigned int i;
Eina_Value array = EINA_VALUE_EMPTY;
+ Efl_Mono_Model_Internal_Child_Data* pcd;
eina_value_array_setup(&array, EINA_VALUE_TYPE_OBJECT, count % 8);
for (i = start; i != start + count; ++i)
- eina_value_array_append (&array, eina_array_data_get(pd->items, i));
+ {
+ pcd = eina_array_data_get(pd->items, i);
+ eina_value_array_append (&array, pcd->child);
+ }
+
+ printf("returning future resolved of type %p and subtype %p type %p\n", EINA_VALUE_TYPE_ARRAY, EINA_VALUE_TYPE_OBJECT,
+ array.type); fflush(stdout);
return efl_loop_future_resolved(obj, array);
}
@@ -183,6 +214,7 @@ _efl_mono_model_internal_child_efl_object_constructor(Eo *obj, Efl_Mono_Model_In
static void
_efl_mono_model_internal_child_efl_object_destructor(Eo *obj, Efl_Mono_Model_Internal_Child_Data *pd EINA_UNUSED)
{
+ printf("_efl_mono_model_internal_child_efl_object_destructor\n"); fflush(stdout);
efl_destructor(efl_super(obj, EFL_MONO_MODEL_INTERNAL_CHILD_CLASS));
}
diff --git a/src/lib/ecore/efl_mono_model_internal.eo b/src/lib/ecore/efl_mono_model_internal.eo
index 341f066480..ee7642baca 100644
--- a/src/lib/ecore/efl_mono_model_internal.eo
+++ b/src/lib/ecore/efl_mono_model_internal.eo
@@ -1,4 +1,4 @@
-class Efl.Mono_Model_Internal extends Efl.Object implements Efl.Model
+class Efl.Mono_Model_Internal extends Efl.Loop_Consumer implements Efl.Model
{
methods {
add_property {
diff --git a/src/lib/ecore/efl_mono_model_internal_child.eo b/src/lib/ecore/efl_mono_model_internal_child.eo
index 5802e69e4f..ec8d657ca4 100644
--- a/src/lib/ecore/efl_mono_model_internal_child.eo
+++ b/src/lib/ecore/efl_mono_model_internal_child.eo
@@ -1,4 +1,4 @@
-class Efl.Mono_Model_Internal_Child extends Efl.Object implements Efl.Model
+class Efl.Mono_Model_Internal_Child extends Efl.Loop_Consumer implements Efl.Model
{
implements {
Efl.Object.constructor;
diff --git a/src/lib/efl/interfaces/efl_model.eo b/src/lib/efl/interfaces/efl_model.eo
index 48c4809aa8..07c91c03e0 100644
--- a/src/lib/efl/interfaces/efl_model.eo
+++ b/src/lib/efl/interfaces/efl_model.eo
@@ -125,7 +125,7 @@ interface @beta Efl.Model
ignored.]]
}
/* XXX: is this right? */
- return: future<accessor<Efl.Object>>; [[Array of children]]
+ return: future<array<Efl.Object>>; [[Array of children]]
}
@property children_count {
get {
diff --git a/src/lib/eina/eina_log.c b/src/lib/eina/eina_log.c
index 52cf8f98ac..bb487af3f4 100644
--- a/src/lib/eina/eina_log.c
+++ b/src/lib/eina/eina_log.c
@@ -163,7 +163,7 @@ static unsigned int _log_domains_count = 0;
static size_t _log_domains_allocated = 0;
// Default function for printing on domains
-static Eina_Log_Print_Cb _print_cb = eina_log_print_cb_stderr;
+static Eina_Log_Print_Cb _print_cb = eina_log_print_cb_stdout;
static void *_print_cb_data = NULL;
#ifdef DEBUG
diff --git a/src/lib/eina/eina_promise.c b/src/lib/eina/eina_promise.c
index f2dc9cccac..c91ec27f74 100644
--- a/src/lib/eina/eina_promise.c
+++ b/src/lib/eina/eina_promise.c
@@ -887,6 +887,8 @@ eina_future_resolved(Eina_Future_Scheduler *scheduler, Eina_Value value)
Eina_Promise *p;
Eina_Future *f;
+ printf ("eina_promise.c value with type %p\n", value.type); fflush(stdout);
+
EINA_SAFETY_ON_NULL_GOTO(scheduler, error);
p = eina_promise_new(scheduler, _dummy_cancel, NULL);
diff --git a/src/lib/eina/eina_value.c b/src/lib/eina/eina_value.c
index dbf6f48d9c..018fcd43d8 100644
--- a/src/lib/eina/eina_value.c
+++ b/src/lib/eina/eina_value.c
@@ -2348,6 +2348,7 @@ _eina_value_type_array_flush(const Eina_Value_Type *type EINA_UNUSED, void *mem)
Eina_Value_Array *tmem = mem;
Eina_Bool ret =_eina_value_type_array_flush_elements(tmem);
+ printf (__FILE__ ":%d\n", __LINE__); fflush(stdout);
if (tmem->array) eina_inarray_free(tmem->array);
tmem->array = NULL;
tmem->subtype = NULL;
@@ -2363,6 +2364,7 @@ _eina_value_type_array_copy(const Eina_Value_Type *type EINA_UNUSED, const void
unsigned int i, count, sz;
char *ptr, *ptr_end;
+ printf (__FILE__ ":%d\n", __LINE__); fflush(stdout);
d->subtype = subtype = s->subtype;
d->step = s->step;
@@ -2371,11 +2373,13 @@ _eina_value_type_array_copy(const Eina_Value_Type *type EINA_UNUSED, const void
d->array = NULL;
return EINA_TRUE;
}
+ printf (__FILE__ ":%d\n", __LINE__); fflush(stdout);
if (!subtype->copy)
{
return EINA_FALSE;
}
+ printf (__FILE__ ":%d\n", __LINE__); fflush(stdout);
d->array = eina_inarray_new(subtype->value_size, s->step);
if (!d->array)
@@ -2401,6 +2405,7 @@ _eina_value_type_array_copy(const Eina_Value_Type *type EINA_UNUSED, const void
return EINA_TRUE;
error:
+ printf (__FILE__ ":%d error\n", __LINE__); fflush(stdout);
_eina_value_type_array_flush_elements(d);
eina_inarray_free(d->array);
return EINA_FALSE;
diff --git a/src/tests/efl_mono/Model.cs b/src/tests/efl_mono/Model.cs
index 5a5f0536a4..f7541c316f 100644
--- a/src/tests/efl_mono/Model.cs
+++ b/src/tests/efl_mono/Model.cs
@@ -1,6 +1,7 @@
#define CODE_ANALYSIS
using System;
+using System.Threading.Tasks;
using System.Diagnostics.CodeAnalysis;
namespace TestSuite {
@@ -17,36 +18,50 @@ public static class TestModel {
public static void reflection_test ()
{
- Efl.UserModel<VeggieViewModel> veggies = new Efl.UserModel<VeggieViewModel>();
+ Efl.Loop loop = Efl.App.AppMain;
+
+ Efl.UserModel<VeggieViewModel> veggies = new Efl.UserModel<VeggieViewModel>(loop);
veggies.Add (new VeggieViewModel{ Name="Tomato", Type="Fruit", Image="tomato.png"});
veggies.Add (new VeggieViewModel{ Name="Romaine Lettuce", Type="Vegetable", Image="lettuce.png"});
veggies.Add (new VeggieViewModel{ Name="Zucchini", Type="Vegetable", Image="zucchini.png"});
-
-
Console.WriteLine ("end of test");
}
- public static void easy_model_extraction ()
+ internal static async Task EasyModelExtractionAsync (Efl.Loop loop)
{
- Efl.UserModel<VeggieViewModel> veggies = new Efl.UserModel<VeggieViewModel>();
+ Efl.UserModel<VeggieViewModel> veggies = new Efl.UserModel<VeggieViewModel>(loop);
veggies.Add (new VeggieViewModel{ Name="Tomato", Type="Fruit", Image="tomato.png"});
veggies.Add (new VeggieViewModel{ Name="Romaine Lettuce", Type="Vegetable", Image="lettuce.png"});
veggies.Add (new VeggieViewModel{ Name="Zucchini", Type="Vegetable", Image="zucchini.png"});
- var model = new Efl.GenericModel<VeggieViewModel>(veggies);
+ var model = new Efl.GenericModel<VeggieViewModel>(veggies, loop);
Console.WriteLine ("size model {0}", model.GetChildrenCount());
+ VeggieViewModel r = await model.GetAtAsync(0);
+
+ Test.AssertEquals(r.Name, "Tomato");
+ VeggieViewModel r2 = await model.GetAtAsync(1);
+ Test.AssertEquals(r2.Name, "Romaine Lettuce");
+
+ Console.WriteLine ("end of test, Name of result is {0}", r.Name);
+ loop.End();
+ }
+
+ public static void easy_model_extraction ()
+ {
+ Efl.Loop loop = Efl.App.AppMain;
+ Task task = EasyModelExtractionAsync(loop);
- Console.WriteLine ("end of test");
+ loop.Begin();
}
public static void factory_test ()
{
var factory = new Efl.Ui.ItemFactory<Efl.Object>();
//factory.Foo();
- factory.Name().Bind("name");
+ factory.Name().Bind("first name");
}
}