summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-03-11 15:46:12 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-03-11 16:08:04 -0300
commitf29ceef5002f7ab2a0f400adbed20299737bce20 (patch)
tree2324619326073a6a55f286723802553743feb3f9 /src/tests
parent2a003420f83134331c8b404df1905cba538cfad6 (diff)
efl-csharp: Respect beta for classes and other stuff.
Summary: In order to work around an issue with Efl.App, which is stable but inherits from Efl.Core.Command_Line, @beta interfaces/mixins in the inheritance chain are simply skipped. Also changed the class used int test for inheritance from C# Efl.Loop is stable but internally it uses a @beta class as argument to its Register() method in the constructor. When instantiating a user-defined C# subclass, the binding calls the C# override in the NativeInherit class and the marshalling fails as no code is generated for the beta class. Also moved Efl.Part test to a beta class. Efl.Part is still beta. Regarding parts, they are skipped if its class is @beta too. Also rejected all elm_* files in elm public eo files. They should get back in as they are converted to Efl.Ui.* api. An exception is elm_interface_scrollable.eo, as efl_ui_panel depends on it. Fixes T7730 Test Plan: Run tests Reviewers: vitor.sousa, segfaultxavi, felipealmeida, cedric, bu5hm4n, zmike Reviewed By: vitor.sousa Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7730 Differential Revision: https://phab.enlightenment.org/D8268
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/efl_mono/Eo.cs6
-rw-r--r--src/tests/efl_mono/Parts.cs9
-rw-r--r--src/tests/efl_mono/dummy_part_holder.eo13
-rw-r--r--src/tests/efl_mono/dummy_test_object.eo8
-rw-r--r--src/tests/efl_mono/libefl_mono_native_test.c56
-rw-r--r--src/tests/efl_mono/meson.build2
6 files changed, 60 insertions, 34 deletions
diff --git a/src/tests/efl_mono/Eo.cs b/src/tests/efl_mono/Eo.cs
index 08c5e2dc4c..9329fbae12 100644
--- a/src/tests/efl_mono/Eo.cs
+++ b/src/tests/efl_mono/Eo.cs
@@ -95,16 +95,16 @@ class TestEo
95} 95}
96 96
97 97
98class MyLoop : Efl.Loop 98class MyObject : Efl.Object
99{ 99{
100 public MyLoop() : base(null) { } 100 public MyObject() : base(null) { }
101} 101}
102 102
103class TestEoInherit 103class TestEoInherit
104{ 104{
105 public static void instantiate_inherited() 105 public static void instantiate_inherited()
106 { 106 {
107 Efl.Loop loop = new MyLoop(); 107 Efl.Object loop = new MyObject();
108 Test.Assert(loop.NativeHandle != System.IntPtr.Zero); 108 Test.Assert(loop.NativeHandle != System.IntPtr.Zero);
109 } 109 }
110} 110}
diff --git a/src/tests/efl_mono/Parts.cs b/src/tests/efl_mono/Parts.cs
index 5afed1fdd6..50527c1c63 100644
--- a/src/tests/efl_mono/Parts.cs
+++ b/src/tests/efl_mono/Parts.cs
@@ -7,17 +7,18 @@ using System.Diagnostics.CodeAnalysis;
7 7
8namespace TestSuite { 8namespace TestSuite {
9 9
10#if EFL_BETA
10 11
11[SuppressMessage("Gendarme.Rules.Portability", "DoNotHardcodePathsRule")] 12[SuppressMessage("Gendarme.Rules.Portability", "DoNotHardcodePathsRule")]
12public static class TestParts 13public static class TestParts
13{ 14{
14 public static void basic_part_test() 15 public static void basic_part_test()
15 { 16 {
16 var t = new Dummy.TestObject(); 17 var t = new Dummy.PartHolder();
17 do_part_test(t); 18 do_part_test(t);
18 } 19 }
19 20
20 private class Child : Dummy.TestObject 21 private class Child : Dummy.PartHolder
21 { 22 {
22 public Child() : base(null) {} 23 public Child() : base(null) {}
23 } 24 }
@@ -27,7 +28,7 @@ public static class TestParts
27 do_part_test(t); 28 do_part_test(t);
28 } 29 }
29 30
30 private static void do_part_test(Dummy.TestObject t) 31 private static void do_part_test(Dummy.PartHolder t)
31 { 32 {
32 var p1 = t.PartOne; 33 var p1 = t.PartOne;
33 var p2 = t.PartTwo; 34 var p2 = t.PartTwo;
@@ -38,4 +39,6 @@ public static class TestParts
38 } 39 }
39} 40}
40 41
42#endif
43
41} 44}
diff --git a/src/tests/efl_mono/dummy_part_holder.eo b/src/tests/efl_mono/dummy_part_holder.eo
new file mode 100644
index 0000000000..2dc5ad79f2
--- /dev/null
+++ b/src/tests/efl_mono/dummy_part_holder.eo
@@ -0,0 +1,13 @@
1import eina_types;
2
3class @beta Dummy.Part_Holder extends Dummy.Test_Object implements Efl.Part {
4
5 parts {
6 part_one: Dummy.Test_Object; [[ Part number one. ]]
7 part_two: Dummy.Test_Object; [[ Part number two. ]]
8 }
9 implements {
10 Efl.Part.part_get;
11 Efl.Object.constructor;
12 }
13}
diff --git a/src/tests/efl_mono/dummy_test_object.eo b/src/tests/efl_mono/dummy_test_object.eo
index 517c783fe1..d0311e96ac 100644
--- a/src/tests/efl_mono/dummy_test_object.eo
+++ b/src/tests/efl_mono/dummy_test_object.eo
@@ -101,12 +101,7 @@ function Dummy.FormatCb {
101 } 101 }
102}; 102};
103 103
104class Dummy.Test_Object extends Efl.Object implements Efl.Part, Dummy.Test_Iface, Dummy.Another_Iface { 104class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface, Dummy.Another_Iface {
105
106 parts {
107 part_one: Dummy.Test_Object; [[ Part number one. ]]
108 part_two: Dummy.Test_Object; [[ Part number two. ]]
109 }
110 methods { 105 methods {
111 return_object { 106 return_object {
112 return: Dummy.Test_Object; 107 return: Dummy.Test_Object;
@@ -1395,7 +1390,6 @@ class Dummy.Test_Object extends Efl.Object implements Efl.Part, Dummy.Test_Iface
1395 class.constructor; 1390 class.constructor;
1396 class.destructor; 1391 class.destructor;
1397 Efl.Object.constructor; 1392 Efl.Object.constructor;
1398 Efl.Part.part_get;
1399 Efl.Object.provider_find; 1393 Efl.Object.provider_find;
1400 Dummy.Test_Iface.emit_test_conflicted; 1394 Dummy.Test_Iface.emit_test_conflicted;
1401 Dummy.Test_Iface.emit_nonconflicted; 1395 Dummy.Test_Iface.emit_nonconflicted;
diff --git a/src/tests/efl_mono/libefl_mono_native_test.c b/src/tests/efl_mono/libefl_mono_native_test.c
index e4c7d72e50..8968e46801 100644
--- a/src/tests/efl_mono/libefl_mono_native_test.c
+++ b/src/tests/efl_mono/libefl_mono_native_test.c
@@ -52,6 +52,7 @@
52#include "dummy_another_iface.eo.h" 52#include "dummy_another_iface.eo.h"
53#include "dummy_inherit_iface.eo.h" 53#include "dummy_inherit_iface.eo.h"
54#include "dummy_inherit_helper.eo.h" 54#include "dummy_inherit_helper.eo.h"
55#include "dummy_part_holder.eo.h"
55 56
56#include <interfaces/efl_part.eo.h> 57#include <interfaces/efl_part.eo.h>
57 58
@@ -67,8 +68,6 @@ typedef struct Dummy_Test_Object_Data
67 Eina_Value *stored_value; 68 Eina_Value *stored_value;
68 Dummy_StructSimple stored_struct; 69 Dummy_StructSimple stored_struct;
69 int stored_int; 70 int stored_int;
70 Eo *part_one;
71 Eo *part_two;
72 Eina_Promise *promise; 71 Eina_Promise *promise;
73 Eina_List *list_for_accessor; 72 Eina_List *list_for_accessor;
74 int setter_only; 73 int setter_only;
@@ -91,6 +90,12 @@ typedef struct Dummy_Child_Data
91 Eina_Bool optional_beta_ctor_was_called; 90 Eina_Bool optional_beta_ctor_was_called;
92} Dummy_Child_Data; 91} Dummy_Child_Data;
93 92
93typedef struct Dummy_Part_Holder_Data
94{
95 Eo *part_one;
96 Eo *part_two;
97} Dummy_Part_Holder_Data;
98
94typedef struct Dummy_Inherit_Helper_Data 99typedef struct Dummy_Inherit_Helper_Data
95{ 100{
96} Dummy_Inherit_Helper_Data; 101} Dummy_Inherit_Helper_Data;
@@ -145,14 +150,6 @@ static Efl_Object*
145_dummy_test_object_efl_object_constructor(Eo *obj, Dummy_Test_Object_Data *pd) 150_dummy_test_object_efl_object_constructor(Eo *obj, Dummy_Test_Object_Data *pd)
146{ 151{
147 efl_constructor(efl_super(obj, DUMMY_TEST_OBJECT_CLASS)); 152 efl_constructor(efl_super(obj, DUMMY_TEST_OBJECT_CLASS));
148
149 // To avoid an infinite loop calling the same constructor
150 if (!efl_parent_get(obj))
151 {
152 pd->part_one = efl_add(DUMMY_TEST_OBJECT_CLASS, obj, efl_name_set(efl_added, "part_one"));
153 pd->part_two = efl_add(DUMMY_TEST_OBJECT_CLASS, obj, efl_name_set(efl_added, "part_two"));
154 }
155
156 pd->provider = efl_add(DUMMY_NUMBERWRAPPER_CLASS, obj); 153 pd->provider = efl_add(DUMMY_NUMBERWRAPPER_CLASS, obj);
157 dummy_numberwrapper_number_set(pd->provider, 1999); 154 dummy_numberwrapper_number_set(pd->provider, 1999);
158 155
@@ -3792,16 +3789,6 @@ void _dummy_test_object_emit_event_with_list(Eo *obj, EINA_UNUSED Dummy_Test_Obj
3792 efl_event_callback_legacy_call(obj, DUMMY_TEST_OBJECT_EVENT_EVT_WITH_LIST, data); 3789 efl_event_callback_legacy_call(obj, DUMMY_TEST_OBJECT_EVENT_EVT_WITH_LIST, data);
3793} 3790}
3794 3791
3795Efl_Object *_dummy_test_object_efl_part_part_get(EINA_UNUSED const Eo *obj, Dummy_Test_Object_Data *pd, const char *name)
3796{
3797 if (!strcmp(name, "part_one"))
3798 return pd->part_one;
3799 else if (!strcmp(name, "part_two"))
3800 return pd->part_two;
3801 else
3802 return NULL;
3803}
3804
3805void _dummy_test_object_append_to_strbuf(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Strbuf *buf, const char *str) 3792void _dummy_test_object_append_to_strbuf(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Strbuf *buf, const char *str)
3806{ 3793{
3807 eina_strbuf_append(buf, str); 3794 eina_strbuf_append(buf, str);
@@ -4024,6 +4011,34 @@ const char* _dummy_inherit_helper_receive_dummy_and_call_in_stringshare(Dummy_Te
4024 return dummy_inherit_iface_stringshare_test (x, eina_stringshare_add("hello world")); 4011 return dummy_inherit_iface_stringshare_test (x, eina_stringshare_add("hello world"));
4025} 4012}
4026 4013
4014// Part holder
4015static Efl_Object*
4016_dummy_part_holder_efl_object_constructor(Eo *obj, Dummy_Part_Holder_Data *pd)
4017{
4018 efl_constructor(efl_super(obj, DUMMY_PART_HOLDER_CLASS));
4019
4020 // To avoid an infinite loop calling the same constructor
4021 if (!efl_parent_get(obj))
4022 {
4023 pd->part_one = efl_add(DUMMY_TEST_OBJECT_CLASS, obj, efl_name_set(efl_added, "part_one"));
4024 pd->part_two = efl_add(DUMMY_TEST_OBJECT_CLASS, obj, efl_name_set(efl_added, "part_two"));
4025 }
4026
4027 return obj;
4028}
4029
4030Efl_Object *_dummy_part_holder_efl_part_part_get(EINA_UNUSED const Eo *obj, Dummy_Part_Holder_Data *pd, const char *name)
4031{
4032 if (!strcmp(name, "part_one"))
4033 return pd->part_one;
4034 else if (!strcmp(name, "part_two"))
4035 return pd->part_two;
4036 else
4037 return NULL;
4038}
4039
4040
4041
4027#include "dummy_test_object.eo.c" 4042#include "dummy_test_object.eo.c"
4028#include "dummy_numberwrapper.eo.c" 4043#include "dummy_numberwrapper.eo.c"
4029#include "dummy_child.eo.c" 4044#include "dummy_child.eo.c"
@@ -4031,4 +4046,5 @@ const char* _dummy_inherit_helper_receive_dummy_and_call_in_stringshare(Dummy_Te
4031#include "dummy_another_iface.eo.c" 4046#include "dummy_another_iface.eo.c"
4032#include "dummy_inherit_helper.eo.c" 4047#include "dummy_inherit_helper.eo.c"
4033#include "dummy_inherit_iface.eo.c" 4048#include "dummy_inherit_iface.eo.c"
4049#include "dummy_part_holder.eo.c"
4034 4050
diff --git a/src/tests/efl_mono/meson.build b/src/tests/efl_mono/meson.build
index 52c6e3152e..f9fcbcf88c 100644
--- a/src/tests/efl_mono/meson.build
+++ b/src/tests/efl_mono/meson.build
@@ -1,4 +1,4 @@
1eo_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'] 1eo_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', 'dummy_part_holder.eo']
2 2
3eo_file_targets = [] 3eo_file_targets = []
4 4