efl-mono: Add proper test for interface inheritance
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>
Tue, 15 Jan 2019 00:07:49 +0000 (09:07 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 24 Jan 2019 05:20:18 +0000 (14:20 +0900)
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 [new file with mode: 0644]
src/tests/efl_mono/dummy_inherit_helper.eo [new file with mode: 0644]
src/tests/efl_mono/dummy_inherit_iface.eo [new file with mode: 0644]
src/tests/efl_mono/libefl_mono_native_test.c
src/tests/efl_mono/meson.build

diff --git a/src/tests/efl_mono/Inheritance.cs b/src/tests/efl_mono/Inheritance.cs
new file mode 100644 (file)
index 0000000..30ca391
--- /dev/null
@@ -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 (file)
index 0000000..101c759
--- /dev/null
@@ -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 (file)
index 0000000..6333a86
--- /dev/null
@@ -0,0 +1,10 @@
+interface Dummy.Inherit_Iface {
+   methods {
+      stringshare_test {
+         params {
+            @in v: stringshare;
+         }
+         return: stringshare @owned;
+      }
+   }
+}
index fc4e3cb..d0109db 100644 (file)
@@ -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"
 
index 2554199..b01e274 100644 (file)
@@ -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',