summaryrefslogtreecommitdiff
path: root/src/scripts
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-07-29 11:24:26 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-07-29 11:39:10 -0300
commit7927023fc7a3aeebbb570f4e5cc0be36b99218c9 (patch)
treed1e482c2c6d707a8747c336c7f662bd05edaa3e2 /src/scripts
parent0ab05a82716a8c5ed23e953987c33f57e3655be9 (diff)
pyolian: Fix tests
Summary: Update tests after some legacy cleanup from last release. Reviewers: bu5hm4n, DaveMDS, segfaultxavi Reviewed By: DaveMDS Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8817
Diffstat (limited to 'src/scripts')
-rwxr-xr-xsrc/scripts/pyolian/test_eolian.py77
1 files changed, 45 insertions, 32 deletions
diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py
index 23a618be11..b597e812b7 100755
--- a/src/scripts/pyolian/test_eolian.py
+++ b/src/scripts/pyolian/test_eolian.py
@@ -59,7 +59,7 @@ class TestEolianState(unittest.TestCase):
59 self.assertIsInstance(unit, eolian.Eolian_Unit) 59 self.assertIsInstance(unit, eolian.Eolian_Unit)
60 self.assertTrue(unit.file.endswith(('.eo', '.eot'))) 60 self.assertTrue(unit.file.endswith(('.eo', '.eot')))
61 count += 1 61 count += 1
62 self.assertGreater(count, 500) 62 self.assertGreater(count, 400)
63 63
64 unit = eolian_db.unit_by_file_get('efl_ui_win.eo') 64 unit = eolian_db.unit_by_file_get('efl_ui_win.eo')
65 self.assertIsInstance(unit, eolian.Eolian_Unit) 65 self.assertIsInstance(unit, eolian.Eolian_Unit)
@@ -167,8 +167,8 @@ class TestEolianUnit(unittest.TestCase):
167 self.assertGreater(all_count, 50) 167 self.assertGreater(all_count, 50)
168 168
169 def test_alias_listing(self): 169 def test_alias_listing(self):
170 l = list(eolian_db.aliases_by_file_get('edje_types.eot')) 170 l = list(eolian_db.aliases_by_file_get('eina_types.eot'))
171 self.assertGreater(len(l), 5) 171 self.assertGreater(len(l), 2)
172 self.assertIsInstance(l[0], eolian.Typedecl) 172 self.assertIsInstance(l[0], eolian.Typedecl)
173 173
174 all_count = 0 174 all_count = 0
@@ -211,12 +211,30 @@ class TestEolianNamespace(unittest.TestCase):
211 for ns in eolian_db.all_namespaces: 211 for ns in eolian_db.all_namespaces:
212 self.assertIsInstance(ns, eolian.Namespace) 212 self.assertIsInstance(ns, eolian.Namespace)
213 count += 1 213 count += 1
214 self.assertGreater(count, 100) 214 self.assertGreater(count, 50)
215 215
216 def test_namespace_vs_class_collision(self): 216 def test_namespace_vs_class_collision(self):
217 colliding_classes = ['Ecore.Audio',
218 'Ecore.Audio.In',
219 'Ecore.Audio.Out',
220 'Ecore.Event.Message',
221 'Ector.Buffer',
222 'Ector.Renderer',
223 'Ector.Renderer.Cairo',
224 'Ector.Renderer.GL',
225 'Ector.Renderer.Gradient',
226 'Ector.Renderer.Software',
227 'Ector.Software.Buffer',
228 'Eio.Sentry',
229 'Eldbus.Model',
230 ]
217 for ns in eolian_db.all_namespaces: 231 for ns in eolian_db.all_namespaces:
218 cls = eolian_db.class_by_name_get(ns.name) 232 cls = eolian_db.class_by_name_get(ns.name)
219 self.assertIsNone(cls) 233 # Some legacy classes are parsed and still make this fail.
234 if cls:
235 self.assertIn(cls.name, colliding_classes)
236 else:
237 self.assertIsNone(cls)
220 238
221 def test_namespace_equality(self): 239 def test_namespace_equality(self):
222 ns1 = eolian.Namespace(eolian_db, 'Efl.Io') 240 ns1 = eolian.Namespace(eolian_db, 'Efl.Io')
@@ -323,7 +341,6 @@ class TestEolianClass(unittest.TestCase):
323 self.assertEqual(list(cls.namespaces), ['Efl']) 341 self.assertEqual(list(cls.namespaces), ['Efl'])
324 self.assertEqual(cls.type, eolian.Eolian_Class_Type.REGULAR) 342 self.assertEqual(cls.type, eolian.Eolian_Class_Type.REGULAR)
325 self.assertIsInstance(cls.documentation, eolian.Documentation) 343 self.assertIsInstance(cls.documentation, eolian.Documentation)
326 self.assertEqual(cls.legacy_prefix, 'ecore_timer')
327 self.assertIsNone(cls.eo_prefix) # TODO fin a class with a value 344 self.assertIsNone(cls.eo_prefix) # TODO fin a class with a value
328 self.assertIsNone(cls.event_prefix) # TODO same as above 345 self.assertIsNone(cls.event_prefix) # TODO same as above
329 self.assertIsNone(cls.data_type) # TODO same as above 346 self.assertIsNone(cls.data_type) # TODO same as above
@@ -335,8 +352,8 @@ class TestEolianClass(unittest.TestCase):
335 self.assertEqual(cls.c_get_function_name, 'efl_loop_timer_class_get') 352 self.assertEqual(cls.c_get_function_name, 'efl_loop_timer_class_get')
336 self.assertEqual(cls.c_macro, 'EFL_LOOP_TIMER_CLASS') 353 self.assertEqual(cls.c_macro, 'EFL_LOOP_TIMER_CLASS')
337 self.assertEqual(cls.c_data_type, 'Efl_Loop_Timer_Data') 354 self.assertEqual(cls.c_data_type, 'Efl_Loop_Timer_Data')
338 self.assertEqual([f.name for f in cls.methods], ['reset','loop_reset','delay']) 355 self.assertEqual([f.name for f in cls.methods], ['timer_reset','timer_loop_reset','timer_delay'])
339 self.assertEqual([f.name for f in cls.properties], ['interval','pending']) 356 self.assertEqual([f.name for f in cls.properties], ['timer_interval','time_pending'])
340 self.assertGreater(len(list(cls.implements)), 5) 357 self.assertGreater(len(list(cls.implements)), 5)
341 self.assertIsInstance(list(cls.implements)[0], eolian.Implement) 358 self.assertIsInstance(list(cls.implements)[0], eolian.Implement)
342 359
@@ -344,9 +361,9 @@ class TestEolianClass(unittest.TestCase):
344class TestEolianFunction(unittest.TestCase): 361class TestEolianFunction(unittest.TestCase):
345 def test_function(self): 362 def test_function(self):
346 cls = eolian_db.class_by_name_get('Efl.Loop_Timer') 363 cls = eolian_db.class_by_name_get('Efl.Loop_Timer')
347 f = cls.function_by_name_get('delay') 364 f = cls.function_by_name_get('timer_delay')
348 self.assertIsInstance(f, eolian.Function) 365 self.assertIsInstance(f, eolian.Function)
349 self.assertEqual(f.name, 'delay') 366 self.assertEqual(f.name, 'timer_delay')
350 self.assertEqual(f.type, eolian.Eolian_Function_Type.METHOD) 367 self.assertEqual(f.type, eolian.Eolian_Function_Type.METHOD)
351 self.assertEqual(f.method_scope, eolian.Eolian_Object_Scope.PUBLIC) 368 self.assertEqual(f.method_scope, eolian.Eolian_Object_Scope.PUBLIC)
352 self.assertEqual(f.getter_scope, eolian.Eolian_Object_Scope.UNKNOWN) # TODO correct? 369 self.assertEqual(f.getter_scope, eolian.Eolian_Object_Scope.UNKNOWN) # TODO correct?
@@ -354,13 +371,9 @@ class TestEolianFunction(unittest.TestCase):
354 self.assertEqual(f.full_c_method_name, 'efl_loop_timer_delay') 371 self.assertEqual(f.full_c_method_name, 'efl_loop_timer_delay')
355 self.assertEqual(f.full_c_getter_name, 'efl_loop_timer_delay_get') 372 self.assertEqual(f.full_c_getter_name, 'efl_loop_timer_delay_get')
356 self.assertEqual(f.full_c_setter_name, 'efl_loop_timer_delay_set') 373 self.assertEqual(f.full_c_setter_name, 'efl_loop_timer_delay_set')
357 self.assertEqual(f.full_c_method_name_legacy, 'ecore_timer_delay')
358 self.assertEqual(f.full_c_getter_name_legacy, 'ecore_timer_delay_get')
359 self.assertEqual(f.full_c_setter_name_legacy, 'ecore_timer_delay_set')
360 self.assertIsNone(f.method_return_type) # TODO correct ? 374 self.assertIsNone(f.method_return_type) # TODO correct ?
361 self.assertIsNone(f.setter_return_type) # TODO correct ? 375 self.assertIsNone(f.setter_return_type) # TODO correct ?
362 self.assertIsNone(f.getter_return_type) # TODO correct ? 376 self.assertIsNone(f.getter_return_type) # TODO correct ?
363 self.assertFalse(f.is_legacy_only(eolian.Eolian_Function_Type.PROP_GET))
364 self.assertFalse(f.is_class) 377 self.assertFalse(f.is_class)
365 self.assertFalse(f.is_beta) 378 self.assertFalse(f.is_beta)
366 self.assertFalse(f.is_constructor(cls)) 379 self.assertFalse(f.is_constructor(cls))
@@ -375,7 +388,7 @@ class TestEolianFunction(unittest.TestCase):
375 388
376 def test_function_parameter(self): 389 def test_function_parameter(self):
377 cls = eolian_db.class_by_name_get('Efl.Loop_Timer') 390 cls = eolian_db.class_by_name_get('Efl.Loop_Timer')
378 f = cls.function_by_name_get('delay') 391 f = cls.function_by_name_get('timer_delay')
379 p = list(f.parameters)[0] 392 p = list(f.parameters)[0]
380 self.assertEqual(p.direction, eolian.Eolian_Parameter_Dir.IN) 393 self.assertEqual(p.direction, eolian.Eolian_Parameter_Dir.IN)
381 self.assertEqual(p.name, 'add') 394 self.assertEqual(p.name, 'add')
@@ -388,10 +401,10 @@ class TestEolianFunction(unittest.TestCase):
388class TestEolianImplement(unittest.TestCase): 401class TestEolianImplement(unittest.TestCase):
389 def test_implement(self): 402 def test_implement(self):
390 cls = eolian_db.class_by_name_get('Efl.Loop_Timer') 403 cls = eolian_db.class_by_name_get('Efl.Loop_Timer')
391 f = cls.function_by_name_get('delay') 404 f = cls.function_by_name_get('timer_delay')
392 im = f.implement 405 im = f.implement
393 self.assertIsInstance(im, eolian.Implement) 406 self.assertIsInstance(im, eolian.Implement)
394 self.assertEqual(im.name, 'Efl.Loop_Timer.delay') 407 self.assertEqual(im.name, 'Efl.Loop_Timer.timer_delay')
395 self.assertIsInstance(im.class_, eolian.Class) 408 self.assertIsInstance(im.class_, eolian.Class)
396 self.assertIsInstance(im.function, eolian.Function) 409 self.assertIsInstance(im.function, eolian.Function)
397 self.assertIsInstance(im.documentation_get(), eolian.Documentation) # TODO is UNRESOLVED correct ? 410 self.assertIsInstance(im.documentation_get(), eolian.Documentation) # TODO is UNRESOLVED correct ?
@@ -407,10 +420,10 @@ class TestEolianImplement(unittest.TestCase):
407class TestEolianEvent(unittest.TestCase): 420class TestEolianEvent(unittest.TestCase):
408 def test_event(self): 421 def test_event(self):
409 cls = eolian_db.class_by_name_get('Efl.Loop_Timer') 422 cls = eolian_db.class_by_name_get('Efl.Loop_Timer')
410 self.assertEqual([e.name for e in cls.events], ['tick']) 423 self.assertEqual([e.name for e in cls.events], ['timer,tick'])
411 ev = cls.event_by_name_get('tick') 424 ev = cls.event_by_name_get('timer,tick')
412 self.assertIsInstance(ev, eolian.Event) 425 self.assertIsInstance(ev, eolian.Event)
413 self.assertEqual(ev.name, 'tick') 426 self.assertEqual(ev.name, 'timer,tick')
414 self.assertEqual(ev.c_macro, 'EFL_LOOP_TIMER_EVENT_TIMER_TICK') 427 self.assertEqual(ev.c_macro, 'EFL_LOOP_TIMER_EVENT_TIMER_TICK')
415 self.assertIsNone(ev.type) # TODO is this correct 428 self.assertIsNone(ev.type) # TODO is this correct
416 self.assertIsInstance(ev.documentation, eolian.Documentation) 429 self.assertIsInstance(ev.documentation, eolian.Documentation)
@@ -441,7 +454,7 @@ class TestEolianConstructor(unittest.TestCase):
441 ctor = ctors[0] 454 ctor = ctors[0]
442 self.assertIsInstance(ctor, eolian.Constructor) 455 self.assertIsInstance(ctor, eolian.Constructor)
443 self.assertEqual(ctor.name, 'Efl.Ui.Win.win_name') 456 self.assertEqual(ctor.name, 'Efl.Ui.Win.win_name')
444 self.assertFalse(ctor.is_optional) 457 self.assertTrue(ctor.is_optional)
445 self.assertIsInstance(ctor.class_, eolian.Class) 458 self.assertIsInstance(ctor.class_, eolian.Class)
446 self.assertEqual(ctor.class_.name, 'Efl.Ui.Win') 459 self.assertEqual(ctor.class_.name, 'Efl.Ui.Win')
447 self.assertIsInstance(ctor.function, eolian.Function) 460 self.assertIsInstance(ctor.function, eolian.Function)
@@ -450,14 +463,14 @@ class TestEolianConstructor(unittest.TestCase):
450 463
451class TestEolianDocumentation(unittest.TestCase): 464class TestEolianDocumentation(unittest.TestCase):
452 def test_documentation(self): 465 def test_documentation(self):
453 td = eolian_db.class_by_name_get('Efl.Net.Control.Manager') 466 td = eolian_db.class_by_name_get('Efl.Object')
454 doc = td.documentation 467 doc = td.documentation
455 self.assertIsInstance(doc, eolian.Documentation) 468 self.assertIsInstance(doc, eolian.Documentation)
456 self.assertIsInstance(doc.summary, str) 469 self.assertIsInstance(doc.summary, str)
457 self.assertGreater(len(doc.summary), 10) 470 self.assertGreater(len(doc.summary), 10)
458 self.assertIsInstance(doc.description, str) 471 self.assertIsInstance(doc.description, str)
459 self.assertGreater(len(doc.description), 20) 472 self.assertGreater(len(doc.description), 20)
460 self.assertEqual(doc.since, '1.19') 473 self.assertEqual(doc.since, '1.22')
461 474
462 475
463class TestEolianVariable(unittest.TestCase): 476class TestEolianVariable(unittest.TestCase):
@@ -475,10 +488,10 @@ class TestEolianVariable(unittest.TestCase):
475 self.assertIsNone(var.value) # TODO is None correct here? no value? 488 self.assertIsNone(var.value) # TODO is None correct here? no value?
476 489
477 def test_variable_constant(self): 490 def test_variable_constant(self):
478 var = eolian_db.constant_by_name_get('Efl.Gfx.Hint_Fill') 491 var = eolian_db.constant_by_name_get('Efl.Gfx.Hint_Expand')
479 self.assertIsInstance(var, eolian.Variable) 492 self.assertIsInstance(var, eolian.Variable)
480 self.assertEqual(var.name, 'Efl.Gfx.Hint_Fill') 493 self.assertEqual(var.name, 'Efl.Gfx.Hint_Expand')
481 self.assertEqual(var.short_name, 'Size_Hint_Fill') 494 self.assertEqual(var.short_name, 'Hint_Expand')
482 self.assertEqual(var.type, eolian.Eolian_Variable_Type.CONSTANT) 495 self.assertEqual(var.type, eolian.Eolian_Variable_Type.CONSTANT)
483 self.assertEqual(var.file, 'efl_gfx_hint.eo') 496 self.assertEqual(var.file, 'efl_gfx_hint.eo')
484 self.assertFalse(var.is_extern) 497 self.assertFalse(var.is_extern)
@@ -551,7 +564,7 @@ class TestEolianTypedecl(unittest.TestCase):
551class TestEolianType(unittest.TestCase): 564class TestEolianType(unittest.TestCase):
552 def test_type_regular_builtin(self): 565 def test_type_regular_builtin(self):
553 cls = eolian_db.class_by_name_get('Efl.Loop_Timer') 566 cls = eolian_db.class_by_name_get('Efl.Loop_Timer')
554 func = cls.function_by_name_get('delay') 567 func = cls.function_by_name_get('timer_delay')
555 param = list(func.parameters)[0] 568 param = list(func.parameters)[0]
556 t = param.type # type: double 569 t = param.type # type: double
557 self.assertIsInstance(t, eolian.Type) 570 self.assertIsInstance(t, eolian.Type)
@@ -629,16 +642,16 @@ class TestEolianExpression(unittest.TestCase):
629 self.assertEqual(exp.serialize, '100') 642 self.assertEqual(exp.serialize, '100')
630 643
631 def test_expression_unary(self): 644 def test_expression_unary(self):
632 var = eolian_db.constant_by_name_get('Efl.Gfx.Hint_Fill') 645 var = eolian_db.constant_by_name_get('Efl.Gfx.Stack_Layer_Min')
633 exp = var.value 646 exp = var.value
634 self.assertIsInstance(exp, eolian.Expression) 647 self.assertIsInstance(exp, eolian.Expression)
635 self.assertEqual(exp.type, eolian.Eolian_Expression_Type.UNARY) 648 self.assertEqual(exp.type, eolian.Eolian_Expression_Type.UNARY)
636 self.assertEqual(float(exp.serialize), 1.0) # TODO is this a bug? isn't -1.0 ? 649 self.assertEqual(float(exp.serialize), 32768.0) # TODO is this a bug? isn't -1.0 ?
637 self.assertEqual(exp.unary_operator, eolian.Eolian_Unary_Operator.UNM) 650 self.assertEqual(exp.unary_operator, eolian.Eolian_Unary_Operator.UNM) # Invalid -> NOP
638 unary = exp.unary_expression 651 unary = exp.unary_expression
639 self.assertIsInstance(unary, eolian.Expression) 652 self.assertIsInstance(unary, eolian.Expression)
640 self.assertEqual(unary.type, eolian.Eolian_Expression_Type.DOUBLE) 653 self.assertEqual(unary.type, eolian.Eolian_Expression_Type.INT)
641 self.assertEqual(float(exp.serialize), 1.0) 654 self.assertEqual(float(exp.serialize), 32768.0) # Bug too?
642 655
643 # TODO test_expression_binary 656 # TODO test_expression_binary
644 # exp.binary_operator # TODO find a better test (only works for BINARY expr) 657 # exp.binary_operator # TODO find a better test (only works for BINARY expr)