aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-01-15 01:27:09 -0200
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-01-15 15:55:09 -0200
commit025df7824571e3913064fa0dcdec5f45e1d8028c (patch)
treeb45438411a46dd1ddd6d6735379731e0a71d9f45
parentefl-mono: Fix autotools make check (diff)
downloadefl-devs/vitorsousa/inout_rw_slice_amended.tar.gz
efl-mono: Test on inout RwSlice.devs/vitorsousa/inout_rw_slice_amended
-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..9b4fa88b02 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]{0xA, 0xA, 0xA, 0xA};
+ var expected_seq = new byte[4]{0xA, 0xB, 0xC, 0xD};
+ 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..fc4e3cbae6 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++)
+ slice->bytes[i] += (uint8_t)i;
+ 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);