summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2018-05-18 23:43:09 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2018-05-23 18:59:26 -0300
commit54f1e56b34e5b8b67161b70b582e54be1fbf5c74 (patch)
treee2873270d4ef751bb5bd07932fcb6f898ef4c121 /src/tests
parentcfafd01bbe27bab90117e1a8d97fdace55b47944 (diff)
efl_mono: Generate support for accessors in .eos
Summary: Depends on D6190 Reviewers: felipealmeida, vitor.sousa Reviewed By: vitor.sousa Subscribers: cedric, #committers, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6191
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/efl_mono/Eo.cs22
-rw-r--r--src/tests/efl_mono/libefl_mono_native_test.c15
-rw-r--r--src/tests/efl_mono/test_testing.eo8
3 files changed, 45 insertions, 0 deletions
diff --git a/src/tests/efl_mono/Eo.cs b/src/tests/efl_mono/Eo.cs
index db89fb8c4f..997876b52f 100644
--- a/src/tests/efl_mono/Eo.cs
+++ b/src/tests/efl_mono/Eo.cs
@@ -1,4 +1,5 @@
1using System; 1using System;
2using System.Linq;
2 3
3namespace TestSuite 4namespace TestSuite
4{ 5{
@@ -224,4 +225,25 @@ class TestTypedefs
224 } 225 }
225} 226}
226 227
228class TestEoAccessors
229{
230 public static void basic_eo_accessors()
231 {
232 test.ITesting obj = new test.Testing();
233 eina.List<int> lst = new eina.List<int>();
234 lst.Append(4);
235 lst.Append(3);
236 lst.Append(2);
237 lst.Append(5);
238 eina.Accessor<int> acc = obj.CloneAccessor(lst.GetAccessor());
239
240 var zipped = acc.Zip(lst, (first, second) => new Tuple<int, int>(first, second));
241
242 foreach(Tuple<int, int> pair in zipped)
243 {
244 Test.AssertEquals(pair.Item1, pair.Item2);
245 }
246 }
247}
248
227} 249}
diff --git a/src/tests/efl_mono/libefl_mono_native_test.c b/src/tests/efl_mono/libefl_mono_native_test.c
index 085188bcde..346ef2cb2c 100644
--- a/src/tests/efl_mono/libefl_mono_native_test.c
+++ b/src/tests/efl_mono/libefl_mono_native_test.c
@@ -52,6 +52,7 @@ typedef struct Test_Testing_Data
52 Eo *part1; 52 Eo *part1;
53 Eo *part2; 53 Eo *part2;
54 Eina_Promise *promise; 54 Eina_Promise *promise;
55 Eina_List *list_for_accessor;
55} Test_Testing_Data; 56} Test_Testing_Data;
56 57
57typedef struct Test_Numberwrapper_Data 58typedef struct Test_Numberwrapper_Data
@@ -3841,6 +3842,20 @@ void _test_testing_reject_promise(Eo *obj, Test_Testing_Data *pd, Eina_Error err
3841 eina_promise_reject(pd->promise, err); 3842 eina_promise_reject(pd->promise, err);
3842} 3843}
3843 3844
3845Eina_Accessor *_test_testing_clone_accessor(Eo *obj, Test_Testing_Data *pd, Eina_Accessor *acc)
3846{
3847 if (pd->list_for_accessor)
3848 eina_list_free(pd->list_for_accessor);
3849
3850 unsigned int i;
3851 int *data;
3852 EINA_ACCESSOR_FOREACH(acc, i, data)
3853 {
3854 pd->list_for_accessor = eina_list_append(pd->list_for_accessor, data);
3855 }
3856
3857 return eina_list_accessor_new(pd->list_for_accessor);
3858}
3844 3859
3845#include "test_testing.eo.c" 3860#include "test_testing.eo.c"
3846#include "test_numberwrapper.eo.c" 3861#include "test_numberwrapper.eo.c"
diff --git a/src/tests/efl_mono/test_testing.eo b/src/tests/efl_mono/test_testing.eo
index d19024f435..3b43168c43 100644
--- a/src/tests/efl_mono/test_testing.eo
+++ b/src/tests/efl_mono/test_testing.eo
@@ -1633,6 +1633,14 @@ class Test.Testing (Efl.Object, Efl.Part) {
1633 @in error: Eina.Error; 1633 @in error: Eina.Error;
1634 } 1634 }
1635 } 1635 }
1636
1637 /* Accessors */
1638 clone_accessor {
1639 params {
1640 @in acc: accessor<ptr(int)>;
1641 }
1642 return: accessor<ptr(int)> @owned;
1643 }
1636 } 1644 }
1637 implements { 1645 implements {
1638 class.constructor; 1646 class.constructor;