summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-01-15 01:27:09 -0200
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-01-15 01:27:40 -0200
commitf21100e2cd6a6d43b5bbecdceb8d577496d4e2be (patch)
treec95ef5614de383fe624d91248fdff4bd97e79dcb
parent130fe0bf7829d1bd8caae4df084c2975ff246a64 (diff)
efl-mono: Test on inout RwSlice.devs/lauromoura/inout_rw_slice
-rw-r--r--src/tests/efl_mono/Eina.cs14
-rw-r--r--src/tests/efl_mono/dummy_test_object.eo7
-rw-r--r--src/tests/efl_mono/libefl_mono_native_test.c8
3 files changed, 29 insertions, 0 deletions
diff --git a/src/tests/efl_mono/Eina.cs b/src/tests/efl_mono/Eina.cs
index db42b23d7f..f8d8b848be 100644
--- a/src/tests/efl_mono/Eina.cs
+++ b/src/tests/efl_mono/Eina.cs
@@ -380,6 +380,20 @@ class TestEinaSlice
380 Test.Assert(slc.GetBytes().SequenceEqual(base_seq)); 380 Test.Assert(slc.GetBytes().SequenceEqual(base_seq));
381 } 381 }
382 382
383 public static void test_eina_rw_slice_inout()
384 {
385 var t = new Dummy.TestObject();
386 var rw_seq = new byte[4]{0xf, 0xf, 0xf, 0xf};
387 var expected_seq = new byte[4]{0x1, 0x2, 0x3, 0x4};
388 var pinnedRWData = GCHandle.Alloc(rw_seq, GCHandleType.Pinned);
389 IntPtr ptr = pinnedRWData.AddrOfPinnedObject();
390 var slc = new Eina.RwSlice(ptr, (UIntPtr)4);
391 Test.Assert(t.EinaRwSliceInout(ref slc));
392 Test.Assert(slc.Mem != IntPtr.Zero);
393 Test.Assert(slc.Length == rw_seq.Length);
394 Test.Assert(slc.GetBytes().SequenceEqual(expected_seq));
395 }
396
383 /* 397 /*
384 public static void test_eina_slice_return() 398 public static void test_eina_slice_return()
385 { 399 {
diff --git a/src/tests/efl_mono/dummy_test_object.eo b/src/tests/efl_mono/dummy_test_object.eo
index 4a6ea5fcc6..e6c42f64c8 100644
--- a/src/tests/efl_mono/dummy_test_object.eo
+++ b/src/tests/efl_mono/dummy_test_object.eo
@@ -266,6 +266,13 @@ class Dummy.Test_Object extends Efl.Object implements Efl.Part, Dummy.Test_Iface
266 return: bool; 266 return: bool;
267 } 267 }
268 268
269 eina_rw_slice_inout {
270 params {
271 @inout slice: Eina.Rw_Slice;
272 }
273 return: bool;
274 }
275
269 /* 276 /*
270 eina_slice_return { 277 eina_slice_return {
271 return: Eina.Slice; 278 return: Eina.Slice;
diff --git a/src/tests/efl_mono/libefl_mono_native_test.c b/src/tests/efl_mono/libefl_mono_native_test.c
index 576690bb86..450aa210a1 100644
--- a/src/tests/efl_mono/libefl_mono_native_test.c
+++ b/src/tests/efl_mono/libefl_mono_native_test.c
@@ -331,6 +331,14 @@ Eina_Bool _dummy_test_object_eina_rw_slice_out(EINA_UNUSED Eo *obj, EINA_UNUSED
331 return EINA_TRUE; 331 return EINA_TRUE;
332} 332}
333 333
334Eina_Bool _dummy_test_object_eina_rw_slice_inout(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Rw_Slice *slice)
335{
336 if (!slice) return EINA_FALSE;
337 for (size_t i = 0; i < slice->len; i++)
338 memset(slice->mem + i, (char)i, 1);
339 return EINA_TRUE;
340}
341
334Eina_Slice _dummy_test_object_eina_slice_return(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd) 342Eina_Slice _dummy_test_object_eina_slice_return(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
335{ 343{
336 Eina_Slice slc = EINA_SLICE_ARRAY(base_seq); 344 Eina_Slice slc = EINA_SLICE_ARRAY(base_seq);