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
This commit is contained in:
parent
64a2ef0260
commit
92aab7830c
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
interface Dummy.Inherit_Iface {
|
||||
methods {
|
||||
stringshare_test {
|
||||
params {
|
||||
@in v: stringshare;
|
||||
}
|
||||
return: stringshare @owned;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue