summaryrefslogtreecommitdiff
path: root/src/scripts
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-11-26 11:56:31 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-11-26 12:40:32 -0300
commitabaa90cfc20529f1507864e7b2d38ef69a16ded4 (patch)
treea00f268a15b6eb4e709b835773325547fe94c023 /src/scripts
parent0acc840f1970d60b1c610a1d5b83e17abd49f17f (diff)
pyolian: Add a method to get the hierarchy of extensions
Summary: To be used by the test generator Depends on D10420 Test Plan: test in the diff Reviewers: DaveMDS, herb, segfaultxavi, felipealmeida Reviewed By: felipealmeida Subscribers: cedric, brunobelo, #reviewers, felipealmeida, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10421
Diffstat (limited to 'src/scripts')
-rw-r--r--src/scripts/pyolian/eolian.py17
-rwxr-xr-xsrc/scripts/pyolian/test_eolian.py8
2 files changed, 25 insertions, 0 deletions
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index 31f4f06f44..eababfadba 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -733,6 +733,23 @@ class Class(Object):
733 return Iterator(Class, lib.eolian_class_extensions_get(self)) 733 return Iterator(Class, lib.eolian_class_extensions_get(self))
734 734
735 @cached_property 735 @cached_property
736 def extensions_hierarchy(self):
737 visited = set()
738 queue = [ext for ext in self.extensions]
739
740 while queue:
741 current = queue.pop()
742
743 if current in visited:
744 continue
745
746 visited.add(current)
747
748 queue.extend(current.extensions)
749
750 return visited
751
752 @cached_property
736 def inherits_full(self): 753 def inherits_full(self):
737 li = [] 754 li = []
738 755
diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py
index b6090c661e..133b279084 100755
--- a/src/scripts/pyolian/test_eolian.py
+++ b/src/scripts/pyolian/test_eolian.py
@@ -704,3 +704,11 @@ class TestEolianInherits(object):
704 def test_inherits_full(self, eolian_db): 704 def test_inherits_full(self, eolian_db):
705 cls = eolian_db.class_by_name_get('Efl.Ui.Widget') 705 cls = eolian_db.class_by_name_get('Efl.Ui.Widget')
706 assert 'Efl.Object' in cls.inherits_full 706 assert 'Efl.Object' in cls.inherits_full
707
708 def test_extensions_hierarchy(self, eolian_db):
709 cls = eolian_db.class_by_name_get('Efl.Ui.Widget')
710
711 # inherited extension
712 assert any(x.name == 'Efl.Gfx.Stack' for x in cls.extensions_hierarchy)
713 # direct extension
714 assert any(x.name == 'Efl.Access.Object' for x in cls.extensions_hierarchy)