aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/efl_mono
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-03-21 14:38:45 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-03-21 14:48:33 -0300
commit0881d1524b6d3996a29b68820690f97821116585 (patch)
treec3fa39f72ad50b7f6ac0a0eb8652ba539af1c5a3 /src/tests/efl_mono
parentcsharp: Export correct headers and files (diff)
downloadefl-0881d1524b6d3996a29b68820690f97821116585.tar.gz
efl-csharp: Add back I prefix for interfaces.
Summary: Conforming to C# coding conventions. For properties, now we only generate a wrapper if its name does not clash with the name of the class that would be implementing it. Fixes https://phab.enlightenment.org/T7751 Reviewers: vitor.sousa, felipealmeida, segfaultxavi Reviewed By: vitor.sousa, segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: https://phab.enlightenment.org/T7751 Differential Revision: https://phab.enlightenment.org/D8397
Diffstat (limited to 'src/tests/efl_mono')
-rw-r--r--src/tests/efl_mono/Eo.cs49
-rw-r--r--src/tests/efl_mono/Inheritance.cs2
-rw-r--r--src/tests/efl_mono/TestUtils.cs10
-rw-r--r--src/tests/efl_mono/dummy_test_object.eo11
-rw-r--r--src/tests/efl_mono/libefl_mono_native_test.c12
5 files changed, 78 insertions, 6 deletions
diff --git a/src/tests/efl_mono/Eo.cs b/src/tests/efl_mono/Eo.cs
index 95f9b7e1d8..578ad10790 100644
--- a/src/tests/efl_mono/Eo.cs
+++ b/src/tests/efl_mono/Eo.cs
@@ -1,5 +1,6 @@
using System;
using System.Linq;
+using System.Collections.Generic;
namespace TestSuite
{
@@ -327,7 +328,7 @@ class TestCsharpProperties
public static void test_iface_property()
{
int val = -33;
- Dummy.TestIface iface = new Dummy.TestObject();
+ Dummy.ITestIface iface = new Dummy.TestObject();
iface.IfaceProp = val;
Test.AssertEquals(val, iface.IfaceProp);
}
@@ -429,7 +430,7 @@ class TestInterfaceConcrete
public static void test_iface_concrete_methods()
{
var obj = new Dummy.TestObject();
- Dummy.TestIface iface = Dummy.TestIfaceConcrete.static_cast(obj);
+ Dummy.ITestIface iface = Dummy.ITestIfaceConcrete.static_cast(obj);
iface.IfaceProp = 1970;
Test.AssertEquals(iface.IfaceProp, 1970);
@@ -447,11 +448,49 @@ class TestProvider
Test.AssertEquals(provider.GetNumber(), 1999);
}
+ private class ProviderHolder : Dummy.TestObject
+ {
+ private Dummy.TestObject provider;
+ public string ProviderName
+ {
+ get
+ {
+ return "MyProvider";
+ }
+ }
+
+ public ProviderHolder() : base(null)
+ {
+ this.provider = new Dummy.TestObject(this);
+ this.provider.Name = this.ProviderName;
+ this.provider.IfaceProp = 1997;
+ }
+
+ public override Efl.Object FindProvider(System.Type type)
+ {
+ Console.WriteLine("Called FindProvider");
+ if (type == typeof(Dummy.ITestIface))
+ {
+ return this.provider;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
public static void test_find_provider_iface()
{
- var obj = new Dummy.TestObject();
- Dummy.TestIface provider = Dummy.TestIfaceConcrete.static_cast(obj.FindProvider(typeof(Dummy.TestIface)));
- Test.AssertEquals(provider.GetIfaceProp(), 1997);
+ var obj = new ProviderHolder();
+
+ var provider = obj.CallFindProvider(typeof(Efl.Object));
+ Test.AssertNull(provider, msg : "Unkonw provider must be null");
+
+ provider = obj.CallFindProviderForIface();
+ Test.AssertNotNull(provider, msg : "Provider of ITestIFace must not be null");
+ Test.AssertEquals(provider.Name, obj.ProviderName, "Provider name does not match expected");
+
}
}
diff --git a/src/tests/efl_mono/Inheritance.cs b/src/tests/efl_mono/Inheritance.cs
index 344c6da71f..befdd3a7b4 100644
--- a/src/tests/efl_mono/Inheritance.cs
+++ b/src/tests/efl_mono/Inheritance.cs
@@ -20,7 +20,7 @@ class TestInheritance
}
}
- internal class Inherit2 : Dummy.TestObject, Dummy.InheritIface
+ internal class Inherit2 : Dummy.TestObject, Dummy.IInheritIface
{
override public void IntOut (int x, out int y)
{
diff --git a/src/tests/efl_mono/TestUtils.cs b/src/tests/efl_mono/TestUtils.cs
index 615a8f3c6d..e7daf0559d 100644
--- a/src/tests/efl_mono/TestUtils.cs
+++ b/src/tests/efl_mono/TestUtils.cs
@@ -186,6 +186,16 @@ public static class Test
if (reference != null)
throw new AssertionException($"Assertion failed: {file}:{line} ({member}) {msg}");
}
+
+ /// <summary> Asserts if the given reference is not null.</summary>
+ public static void AssertNotNull(object reference, String msg = "Reference is null",
+ [CallerLineNumber] int line = 0,
+ [CallerFilePath] string file = null,
+ [CallerMemberName] string member = null)
+ {
+ if (reference == null)
+ throw new AssertionException($"Assertion failed: {file}:{line} ({member}) {msg}");
+ }
}
diff --git a/src/tests/efl_mono/dummy_test_object.eo b/src/tests/efl_mono/dummy_test_object.eo
index ed63eaee64..5475c81c3c 100644
--- a/src/tests/efl_mono/dummy_test_object.eo
+++ b/src/tests/efl_mono/dummy_test_object.eo
@@ -1388,6 +1388,17 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
get_setter_only {
return: int;
}
+
+ call_find_provider {
+ params {
+ @in type: const(Efl.Class);
+ }
+ return: Efl.Object;
+ }
+
+ call_find_provider_for_iface {
+ return: Efl.Object;
+ }
}
implements {
class.constructor;
diff --git a/src/tests/efl_mono/libefl_mono_native_test.c b/src/tests/efl_mono/libefl_mono_native_test.c
index 7e3bffe111..7b4dd1a77f 100644
--- a/src/tests/efl_mono/libefl_mono_native_test.c
+++ b/src/tests/efl_mono/libefl_mono_native_test.c
@@ -3929,6 +3929,18 @@ Eo * _dummy_test_object_efl_object_provider_find(EINA_UNUSED const Eo *obj, Dumm
return efl_provider_find(efl_super(obj, DUMMY_TEST_OBJECT_CLASS), klass);
}
+Efl_Object *_dummy_test_object_call_find_provider(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, const Efl_Class *type)
+{
+ printf("CALLING FIND PROVIDER FROM C");
+ return efl_provider_find(obj, type);
+}
+
+Efl_Object *_dummy_test_object_call_find_provider_for_iface(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
+{
+ printf("CALLING FIND PROVIDER FROM C");
+ return efl_provider_find(obj, DUMMY_TEST_IFACE_INTERFACE);
+}
+
/// Dummy.Child
static Efl_Object *