[pitivi] dogtail tests: Exit the search loop immediately in search_by_text



commit afd24c38bb0c8cf50ea101c0a0a5211d17853b2e
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Fri Jul 20 22:16:45 2012 -0400

    dogtail tests: Exit the search loop immediately in search_by_text
    
    While the performance gains are almost negligible, it is pointless
    to keep searching when a match has been found.

 tests/dogtail_scripts/helper_functions.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/tests/dogtail_scripts/helper_functions.py b/tests/dogtail_scripts/helper_functions.py
index fc95f51..c211b68 100644
--- a/tests/dogtail_scripts/helper_functions.py
+++ b/tests/dogtail_scripts/helper_functions.py
@@ -43,13 +43,13 @@ class HelpFunc(BaseDogTail):
             return
 
     def search_by_text(self, text, parent, name=None, roleName=None):
-        children = parent.findChildren(GenericPredicate(roleName=roleName,
-                                                        name=name))
-        searched = None
+        """
+        Search a parent widget for childs containing the given text
+        """
+        children = parent.findChildren(GenericPredicate(roleName=roleName, name=name))
         for child in children:
             if child.text == text:
-                searched = child
-        return searched
+                return child
 
     def insert_clip(self, icon, n=1):
         icon.select()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]