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)
downloadefl-devs/lauromoura/inout_rw_slice.tar.gz
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
Test.Assert(slc.GetBytes().SequenceEqual(base_seq));
}
+ public static void test_eina_rw_slice_inout()
+ {
+ var t = new Dummy.TestObject();
+ var rw_seq = new byte[4]{0xf, 0xf, 0xf, 0xf};
+ var expected_seq = new byte[4]{0x1, 0x2, 0x3, 0x4};
+ var pinnedRWData = GCHandle.Alloc(rw_seq, GCHandleType.Pinned);
+ IntPtr ptr = pinnedRWData.AddrOfPinnedObject();
+ var slc = new Eina.RwSlice(ptr, (UIntPtr)4);
+ Test.Assert(t.EinaRwSliceInout(ref slc));
+ Test.Assert(slc.Mem != IntPtr.Zero);
+ Test.Assert(slc.Length == rw_seq.Length);
+ Test.Assert(slc.GetBytes().SequenceEqual(expected_seq));
+ }
+
/*
public static void test_eina_slice_return()
{
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
return: bool;
}
+ eina_rw_slice_inout {
+ params {
+ @inout slice: Eina.Rw_Slice;
+ }
+ return: bool;
+ }
+
/*
eina_slice_return {
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
return EINA_TRUE;
}
+Eina_Bool _dummy_test_object_eina_rw_slice_inout(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Rw_Slice *slice)
+{
+ if (!slice) return EINA_FALSE;
+ for (size_t i = 0; i < slice->len; i++)
+ memset(slice->mem + i, (char)i, 1);
+ return EINA_TRUE;
+}
+
Eina_Slice _dummy_test_object_eina_slice_return(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
{
Eina_Slice slc = EINA_SLICE_ARRAY(base_seq);