felipealmeida pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=92aab7830cbc3e8697d56440972835b6d8c67aba

commit 92aab7830cbc3e8697d56440972835b6d8c67aba
Author: Felipe Magno de Almeida <fel...@expertisesolutions.com.br>
Date:   Tue Jan 15 09:07:49 2019 +0900

    efl-mono: Add proper test for interface inheritance
    
    Reviewers: segfaultxavi, bu5hm4n, woohyun, Jaehyun_Cho, lauromoura
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D7634
---
 src/tests/efl_mono/Inheritance.cs            | 53 ++++++++++++++++++++++++++++
 src/tests/efl_mono/dummy_inherit_helper.eo   | 17 +++++++++
 src/tests/efl_mono/dummy_inherit_iface.eo    | 10 ++++++
 src/tests/efl_mono/libefl_mono_native_test.c | 24 +++++++++++++
 src/tests/efl_mono/meson.build               |  5 +--
 5 files changed, 107 insertions(+), 2 deletions(-)

diff --git a/src/tests/efl_mono/Inheritance.cs 
b/src/tests/efl_mono/Inheritance.cs
new file mode 100644
index 0000000000..30ca391e87
--- /dev/null
+++ b/src/tests/efl_mono/Inheritance.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+
+using EinaTestData;
+using static EinaTestData.BaseData;
+
+namespace TestSuite
+{
+
+class TestInheritance
+{
+    internal class Inherit1 : Dummy.TestObject
+    {
+        override public void IntOut (int x, out int y)
+        {
+            y = 10*x;
+        }
+    }
+
+    internal class Inherit2 : Dummy.TestObject, Dummy.InheritIface
+    {
+        override public void IntOut (int x, out int y)
+        {
+            y = 10*x;
+        }
+
+        public string StringshareTest (string i)
+        {
+            return "Hello World";
+        }
+    }
+    
+    public static void test_inherit_from_regular_class()
+    {
+        var obj = new Inherit1();
+        int i = Dummy.InheritHelper.ReceiveDummyAndCallIntOut(obj);
+        Test.AssertEquals (50, i);
+    }
+
+    public static void test_inherit_from_iface()
+    {
+        var obj = new Inherit2();
+        int i = Dummy.InheritHelper.ReceiveDummyAndCallIntOut(obj);
+        string s = Dummy.InheritHelper.ReceiveDummyAndCallInStringshare(obj);
+        Test.AssertEquals (50, i);
+        Test.AssertEquals ("Hello World", s);
+    }
+}
+
+}
diff --git a/src/tests/efl_mono/dummy_inherit_helper.eo 
b/src/tests/efl_mono/dummy_inherit_helper.eo
new file mode 100644
index 0000000000..101c759390
--- /dev/null
+++ b/src/tests/efl_mono/dummy_inherit_helper.eo
@@ -0,0 +1,17 @@
+class Dummy.Inherit_Helper extends Efl.Object
+{
+  methods {
+    receive_dummy_and_call_int_out @class {
+      params {
+        @in x: Dummy.Test_Object;
+      }
+      return: int;
+    }
+    receive_dummy_and_call_in_stringshare @class {
+      params {
+        @in x: Dummy.Inherit_Iface;
+      }
+      return: stringshare;
+    }
+  }
+}
diff --git a/src/tests/efl_mono/dummy_inherit_iface.eo 
b/src/tests/efl_mono/dummy_inherit_iface.eo
new file mode 100644
index 0000000000..6333a86f42
--- /dev/null
+++ b/src/tests/efl_mono/dummy_inherit_iface.eo
@@ -0,0 +1,10 @@
+interface Dummy.Inherit_Iface {
+   methods {
+      stringshare_test {
+         params {
+            @in v: stringshare;
+         }
+         return: stringshare @owned;
+      }
+   }
+}
diff --git a/src/tests/efl_mono/libefl_mono_native_test.c 
b/src/tests/efl_mono/libefl_mono_native_test.c
index fc4e3cbae6..d0109dbad2 100644
--- a/src/tests/efl_mono/libefl_mono_native_test.c
+++ b/src/tests/efl_mono/libefl_mono_native_test.c
@@ -39,6 +39,8 @@
 #include "dummy_child.eo.h"
 #include "dummy_test_iface.eo.h"
 #include "dummy_another_iface.eo.h"
+#include "dummy_inherit_iface.eo.h"
+#include "dummy_inherit_helper.eo.h"
 
 #include <interfaces/efl_part.eo.h>
 
@@ -71,6 +73,13 @@ typedef struct Dummy_Child_Data
 {
 } Dummy_Child_Data;
 
+typedef struct Dummy_Inherit_Helper_Data
+{
+} Dummy_Inherit_Helper_Data;
+
+typedef struct Dummy_Inherit_Iface_Data
+{
+} Dummy_Inherit_Iface_Data;
 
 static
 void *_new_int(int v)
@@ -3928,9 +3937,24 @@ _dummy_child_class_destructor(Efl_Class *klass)
     (void)klass;
 }
 
+// Inherit
+int _dummy_inherit_helper_receive_dummy_and_call_int_out(Eo *obj EINA_UNUSED, 
void *pd EINA_UNUSED, Dummy_Test_Object *x)
+{
+  int v = 8;
+  dummy_test_object_int_out (x, 5, &v);
+  return v;
+}
+
+const char* _dummy_inherit_helper_receive_dummy_and_call_in_stringshare(Eo 
*obj EINA_UNUSED, void *pd EINA_UNUSED, Dummy_Test_Object *x)
+{
+  return dummy_inherit_iface_stringshare_test (x, eina_stringshare_add("hello 
world"));
+}
+
 #include "dummy_test_object.eo.c"
 #include "dummy_numberwrapper.eo.c"
 #include "dummy_child.eo.c"
 #include "dummy_test_iface.eo.c"
 #include "dummy_another_iface.eo.c"
+#include "dummy_inherit_helper.eo.c"
+#include "dummy_inherit_iface.eo.c"
 
diff --git a/src/tests/efl_mono/meson.build b/src/tests/efl_mono/meson.build
index 25541996e1..b01e2747af 100644
--- a/src/tests/efl_mono/meson.build
+++ b/src/tests/efl_mono/meson.build
@@ -1,4 +1,4 @@
-eo_files = ['dummy_child.eo', 'dummy_numberwrapper.eo', 
'dummy_test_object.eo', 'dummy_test_iface.eo', 'dummy_another_iface.eo']
+eo_files = ['dummy_child.eo', 'dummy_numberwrapper.eo', 
'dummy_test_object.eo', 'dummy_test_iface.eo', 'dummy_another_iface.eo', 
'dummy_inherit_helper.eo', 'dummy_inherit_iface.eo']
 
 eo_file_targets = []
 
@@ -57,7 +57,8 @@ efl_mono_src = [
      'Strings.cs',
      'Structs.cs',
      'Value.cs',
-     'ValueEolian.cs'
+     'ValueEolian.cs',
+     'Inheritance.cs',
 ]
 
 efl_mono_suite = executable('efl-mono-suite',

-- 


Reply via email to