summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-07-12 18:50:41 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-08-16 17:04:59 -0300
commite84fe219a6146c14795d7ec8798f415b95b1956b (patch)
treeec8e0ad057642c5417d0239c118b777cc441d2ff
parent92186556036f727d6caf742e558880ad3eec19e3 (diff)
Make generated tests skip protected methods.
Also fixed Accessor and Stringshare type translations
-rw-r--r--src/scripts/testgen/ekeys.py20
-rw-r--r--src/scripts/testgen/suitegen.py12
2 files changed, 24 insertions, 8 deletions
diff --git a/src/scripts/testgen/ekeys.py b/src/scripts/testgen/ekeys.py
index 6865ac8e12..64b6a20081 100644
--- a/src/scripts/testgen/ekeys.py
+++ b/src/scripts/testgen/ekeys.py
@@ -18,7 +18,7 @@ class EKeys:
18 self.dicttypes = {} 18 self.dicttypes = {}
19 self.keywords = [] 19 self.keywords = []
20 self.verbs = [] 20 self.verbs = []
21 self.blacklist = ['efl_constructor'] 21 self.blacklist = ["efl_constructor"]
22 self.keyloads = ["init", "shutdown", "custom"] 22 self.keyloads = ["init", "shutdown", "custom"]
23 self.implementsbl = ["construtor", "destructor", "finalize"] 23 self.implementsbl = ["construtor", "destructor", "finalize"]
24 self.funclist = Function_List_Type.CLASS_IMPLEMENTS 24 self.funclist = Function_List_Type.CLASS_IMPLEMENTS
@@ -76,7 +76,7 @@ class EMonoKeys(EKeys):
76 "promise": "int", 76 "promise": "int",
77 "future": "int", 77 "future": "int",
78 "iterator": "Eina.Iterator", 78 "iterator": "Eina.Iterator",
79 "accessor": "int", 79 "accessor": "Eina.Accessor",
80 "strbuf": "Eina.Strbuf", 80 "strbuf": "Eina.Strbuf",
81 "Efl.Class": "System.Type", 81 "Efl.Class": "System.Type",
82 } 82 }
@@ -220,13 +220,19 @@ class EMonoKeys(EKeys):
220 eotype.name, name_helpers.type_managed_name(eotype) 220 eotype.name, name_helpers.type_managed_name(eotype)
221 ) 221 )
222 if new_type != "int" and eotype.base_type: 222 if new_type != "int" and eotype.base_type:
223 new_type = "{}<{}>".format( 223 # Stringshare is a special case where its C# type differs if inside or outside
224 new_type, 224 # a container:
225 self.dicttypes.get( 225 # - Non-contained stringshares are directly converted to strings.
226 # - Contained stringshares are kept as the container parameter as a tag to
227 # marshal the value correctly whem adding/removing items from the container.
228 if eotype.base_type.name == "stringshare":
229 base_type = "Eina.Stringshare"
230 else:
231 base_type = self.dicttypes.get(
226 eotype.base_type.name, 232 eotype.base_type.name,
227 name_helpers.type_managed_name(eotype.base_type), 233 name_helpers.type_managed_name(eotype.base_type),
228 ), 234 )
229 ) 235 new_type = "{}<{}>".format(new_type, base_type)
230 236
231 return new_type 237 return new_type
232 238
diff --git a/src/scripts/testgen/suitegen.py b/src/scripts/testgen/suitegen.py
index cdae677052..7047104dae 100644
--- a/src/scripts/testgen/suitegen.py
+++ b/src/scripts/testgen/suitegen.py
@@ -42,11 +42,13 @@ class FuncItem(ComItem):
42 self.has_getter = ( 42 self.has_getter = (
43 comp.type in (Eolian_Function_Type.PROP_GET, Eolian_Function_Type.PROPERTY) 43 comp.type in (Eolian_Function_Type.PROP_GET, Eolian_Function_Type.PROPERTY)
44 and comp.full_c_getter_name not in keys.blacklist 44 and comp.full_c_getter_name not in keys.blacklist
45 and comp.getter_scope == Eolian_Object_Scope.PUBLIC
45 and not os.path.isfile("{}_get".format(os.path.join(path, comp.name))) 46 and not os.path.isfile("{}_get".format(os.path.join(path, comp.name)))
46 ) 47 )
47 self.has_setter = ( 48 self.has_setter = (
48 comp.type in (Eolian_Function_Type.PROP_SET, Eolian_Function_Type.PROPERTY) 49 comp.type in (Eolian_Function_Type.PROP_SET, Eolian_Function_Type.PROPERTY)
49 and comp.full_c_setter_name not in keys.blacklist 50 and comp.full_c_setter_name not in keys.blacklist
51 and comp.setter_scope == Eolian_Object_Scope.PUBLIC
50 and not os.path.isfile("{}_set".format(os.path.join(path, comp.name))) 52 and not os.path.isfile("{}_set".format(os.path.join(path, comp.name)))
51 ) 53 )
52 54
@@ -106,7 +108,15 @@ class ClassItem(ComItem):
106 if os.path.isfile(os.path.join(self.path, f.name)): 108 if os.path.isfile(os.path.join(self.path, f.name)):
107 return False 109 return False
108 110
109 if f.method_scope != Eolian_Object_Scope.PUBLIC: 111 if f.type == Eolian_Function_Type.PROPERTY:
112 if f.getter_scope != Eolian_Object_Scope.PUBLIC:
113 scope = f.setter_scope
114 else:
115 scope = f.getter_scope
116 else:
117 scope = f.scope_get(f.type)
118
119 if scope != Eolian_Object_Scope.PUBLIC:
110 return False 120 return False
111 121
112 return True 122 return True