summaryrefslogtreecommitdiff
path: root/src/tests
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
parentf36d8b9bb1792730bc96c2cf07126361ccfe4ebe (diff)
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 T7751 Reviewers: vitor.sousa, felipealmeida, segfaultxavi Reviewed By: vitor.sousa, segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7751 Differential Revision: https://phab.enlightenment.org/D8397
Diffstat (limited to 'src/tests')
-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 @@
1using System; 1using System;
2using System.Linq; 2using System.Linq;
3using System.Collections.Generic;
3 4
4namespace TestSuite 5namespace TestSuite
5{ 6{
@@ -327,7 +328,7 @@ class TestCsharpProperties
327 public static void test_iface_property() 328 public static void test_iface_property()
328 { 329 {
329 int val = -33; 330 int val = -33;
330 Dummy.TestIface iface = new Dummy.TestObject(); 331 Dummy.ITestIface iface = new Dummy.TestObject();
331 iface.IfaceProp = val; 332 iface.IfaceProp = val;
332 Test.AssertEquals(val, iface.IfaceProp); 333 Test.AssertEquals(val, iface.IfaceProp);
333 } 334 }
@@ -429,7 +430,7 @@ class TestInterfaceConcrete
429 public static void test_iface_concrete_methods() 430 public static void test_iface_concrete_methods()
430 { 431 {
431 var obj = new Dummy.TestObject(); 432 var obj = new Dummy.TestObject();
432 Dummy.TestIface iface = Dummy.TestIfaceConcrete.static_cast(obj); 433 Dummy.ITestIface iface = Dummy.ITestIfaceConcrete.static_cast(obj);
433 434
434 iface.IfaceProp = 1970; 435 iface.IfaceProp = 1970;
435 Test.AssertEquals(iface.IfaceProp, 1970); 436 Test.AssertEquals(iface.IfaceProp, 1970);
@@ -447,11 +448,49 @@ class TestProvider
447 Test.AssertEquals(provider.GetNumber(), 1999); 448 Test.AssertEquals(provider.GetNumber(), 1999);
448 } 449 }
449 450
451 private class ProviderHolder : Dummy.TestObject
452 {
453 private Dummy.TestObject provider;
454 public string ProviderName
455 {
456 get
457 {
458 return "MyProvider";
459 }
460 }
461
462 public ProviderHolder() : base(null)
463 {
464 this.provider = new Dummy.TestObject(this);
465 this.provider.Name = this.ProviderName;
466 this.provider.IfaceProp = 1997;
467 }
468
469 public override Efl.Object FindProvider(System.Type type)
470 {
471 Console.WriteLine("Called FindProvider");
472 if (type == typeof(Dummy.ITestIface))
473 {
474 return this.provider;
475 }
476 else
477 {
478 return null;
479 }
480 }
481 }
482
450 public static void test_find_provider_iface() 483 public static void test_find_provider_iface()
451 { 484 {
452 var obj = new Dummy.TestObject(); 485 var obj = new ProviderHolder();
453 Dummy.TestIface provider = Dummy.TestIfaceConcrete.static_cast(obj.FindProvider(typeof(Dummy.TestIface))); 486
454 Test.AssertEquals(provider.GetIfaceProp(), 1997); 487 var provider = obj.CallFindProvider(typeof(Efl.Object));
488 Test.AssertNull(provider, msg : "Unkonw provider must be null");
489
490 provider = obj.CallFindProviderForIface();
491 Test.AssertNotNull(provider, msg : "Provider of ITestIFace must not be null");
492 Test.AssertEquals(provider.Name, obj.ProviderName, "Provider name does not match expected");
493
455 } 494 }
456} 495}
457 496
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
20 } 20 }
21 } 21 }
22 22
23 internal class Inherit2 : Dummy.TestObject, Dummy.InheritIface 23 internal class Inherit2 : Dummy.TestObject, Dummy.IInheritIface
24 { 24 {
25 override public void IntOut (int x, out int y) 25 override public void IntOut (int x, out int y)
26 { 26 {
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
186 if (reference != null) 186 if (reference != null)
187 throw new AssertionException($"Assertion failed: {file}:{line} ({member}) {msg}"); 187 throw new AssertionException($"Assertion failed: {file}:{line} ({member}) {msg}");
188 } 188 }
189
190 /// <summary> Asserts if the given reference is not null.</summary>
191 public static void AssertNotNull(object reference, String msg = "Reference is null",
192 [CallerLineNumber] int line = 0,
193 [CallerFilePath] string file = null,
194 [CallerMemberName] string member = null)
195 {
196 if (reference == null)
197 throw new AssertionException($"Assertion failed: {file}:{line} ({member}) {msg}");
198 }
189} 199}
190 200
191 201
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 {
1388 get_setter_only { 1388 get_setter_only {
1389 return: int; 1389 return: int;
1390 } 1390 }
1391
1392 call_find_provider {
1393 params {
1394 @in type: const(Efl.Class);
1395 }
1396 return: Efl.Object;
1397 }
1398
1399 call_find_provider_for_iface {
1400 return: Efl.Object;
1401 }
1391 } 1402 }
1392 implements { 1403 implements {
1393 class.constructor; 1404 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
3929 return efl_provider_find(efl_super(obj, DUMMY_TEST_OBJECT_CLASS), klass); 3929 return efl_provider_find(efl_super(obj, DUMMY_TEST_OBJECT_CLASS), klass);
3930} 3930}
3931 3931
3932Efl_Object *_dummy_test_object_call_find_provider(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, const Efl_Class *type)
3933{
3934 printf("CALLING FIND PROVIDER FROM C");
3935 return efl_provider_find(obj, type);
3936}
3937
3938Efl_Object *_dummy_test_object_call_find_provider_for_iface(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
3939{
3940 printf("CALLING FIND PROVIDER FROM C");
3941 return efl_provider_find(obj, DUMMY_TEST_IFACE_INTERFACE);
3942}
3943
3932/// Dummy.Child 3944/// Dummy.Child
3933 3945
3934static Efl_Object * 3946static Efl_Object *