summaryrefslogtreecommitdiff
path: root/src/tests/efl_mono/Eo.cs
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-04-05 19:53:37 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-04-05 19:56:42 -0300
commit1e22db1150049e313bcba7906fc5ffc9a745eaf0 (patch)
tree3dd72d0486e2e03d90e10e5f96554176326aa783 /src/tests/efl_mono/Eo.cs
parent4edf8036e05c8e70f54abf6513e0df165a725a18 (diff)
csharp: Make classes abstract and rework casting
Summary: Abstract Eo classes are now proper C# abstract classes. As a side effect, returning Eo instances from native code was reworked to return instances of their actual Eo classes instead of previous behavior of returning a generic Efl.Object and using static_cast. Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());` Use `var window = widget.GetParent() as Efl.Ui.Win;` Another side effect was that `efl_constructor` was removed from the list of supported `Efl.Object` overrides. It is invoked inside `efl_add_internal_start`, before the bindings makes the association of the newly created EoId with the C# instance that created it, making the managed delegate meaningless. C# users then can use regular C# constructors to initialize fields. Also changed to set the private data of C#-inherited classes before the call to constructing methods (aka constructor parameters) so C# classes can override them correctly. Fixes T7778 Fixes T7757 Reviewers: vitor.sousa, felipealmeida, segfaultxavi Reviewed By: vitor.sousa, segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7778, T7757, T7702 Differential Revision: https://phab.enlightenment.org/D8550
Diffstat (limited to 'src/tests/efl_mono/Eo.cs')
-rw-r--r--src/tests/efl_mono/Eo.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tests/efl_mono/Eo.cs b/src/tests/efl_mono/Eo.cs
index 578ad10790..f4e3f5d51f 100644
--- a/src/tests/efl_mono/Eo.cs
+++ b/src/tests/efl_mono/Eo.cs
@@ -131,7 +131,7 @@ class TestEoParent
131 131
132 Test.AssertEquals(parent, child.GetParent()); 132 Test.AssertEquals(parent, child.GetParent());
133 133
134 var parent_retrieved = Dummy.TestObject.static_cast(child.GetParent()); 134 var parent_retrieved = child.GetParent() as Dummy.TestObject;
135 Test.AssertEquals(parent, parent_retrieved); 135 Test.AssertEquals(parent, parent_retrieved);
136 } 136 }
137 137
@@ -142,7 +142,7 @@ class TestEoParent
142 142
143 Test.AssertEquals(parent, child.GetParent()); 143 Test.AssertEquals(parent, child.GetParent());
144 144
145 Dummy.Numberwrapper parent_retrieved = Dummy.Numberwrapper.static_cast(child.GetParent()); 145 Dummy.Numberwrapper parent_retrieved = child.GetParent() as Dummy.Numberwrapper;
146 Test.AssertEquals(parent, parent_retrieved); 146 Test.AssertEquals(parent, parent_retrieved);
147 } 147 }
148 148
@@ -160,7 +160,7 @@ class TestEoParent
160 160
161 Test.AssertEquals(parent, child.GetParent()); 161 Test.AssertEquals(parent, child.GetParent());
162 162
163 var parent_from_cast = Dummy.TestObject.static_cast(child.GetParent()); 163 var parent_from_cast = child.GetParent() as Derived;
164 Test.AssertEquals(parent, parent_from_cast); 164 Test.AssertEquals(parent, parent_from_cast);
165 } 165 }
166} 166}
@@ -430,7 +430,7 @@ class TestInterfaceConcrete
430 public static void test_iface_concrete_methods() 430 public static void test_iface_concrete_methods()
431 { 431 {
432 var obj = new Dummy.TestObject(); 432 var obj = new Dummy.TestObject();
433 Dummy.ITestIface iface = Dummy.ITestIfaceConcrete.static_cast(obj); 433 Dummy.ITestIface iface = obj.ReturnIface();
434 434
435 iface.IfaceProp = 1970; 435 iface.IfaceProp = 1970;
436 Test.AssertEquals(iface.IfaceProp, 1970); 436 Test.AssertEquals(iface.IfaceProp, 1970);
@@ -443,7 +443,7 @@ class TestProvider
443 { 443 {
444 // Tests only the direction C# -> C 444 // Tests only the direction C# -> C
445 var obj = new Dummy.TestObject(); 445 var obj = new Dummy.TestObject();
446 Dummy.Numberwrapper provider = Dummy.Numberwrapper.static_cast(obj.FindProvider(typeof(Dummy.Numberwrapper))); 446 Dummy.Numberwrapper provider = obj.FindProvider(typeof(Dummy.Numberwrapper)) as Dummy.Numberwrapper;
447 Test.AssertEquals(provider.GetType(), typeof(Dummy.Numberwrapper)); 447 Test.AssertEquals(provider.GetType(), typeof(Dummy.Numberwrapper));
448 Test.AssertEquals(provider.GetNumber(), 1999); 448 Test.AssertEquals(provider.GetNumber(), 1999);
449 } 449 }