diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py index 44970382032bf72732b4310931accc496a15471b..746d5fa4a8a0c8e0659ba41010f73e1f3e357b2f 100644 --- a/tests/system/shared/build_utils.py +++ b/tests/system/shared/build_utils.py @@ -30,12 +30,7 @@ def __addSignalHandlerDict__(lazySignalHandlerFunction): lazySignalHandlerFunction(name, signalSignature, handlerFunctionName) installedSignalHandlers.setdefault("%s____%s" % (name,signalSignature), [handlerFunctionName]) else: - alreadyInstalled = False - for h in handlers: - if (h == handlerFunctionName): - alreadyInstalled = True - break - if not alreadyInstalled: + if not handlerFunctionName in handlers: lazySignalHandlerFunction(name, signalSignature, handlerFunctionName) handlers.append(handlerFunctionName) installedSignalHandlers.setdefault("%s____%s" % (name,signalSignature), handlers) @@ -148,13 +143,12 @@ def createTasksFile(list): def iterateBuildConfigs(targetCount, currentTarget, filter = ""): switchViewTo(ViewConstants.PROJECTS) switchToBuildOrRunSettingsFor(targetCount, currentTarget, ProjectSettings.BUILD) - configs = [] model = waitForObject(":scrollArea.Edit build configuration:_QComboBox", 20000).model() prog = re.compile(filter) - for row in range(model.rowCount()): - configName = str(model.index(row, 0).data()) - if prog.match(configName): - configs += [configName] + # for each row in the model, write its data to a list + configNames = [str(model.index(row, 0).data()) for row in range(model.rowCount())] + # pick only those configuration names which pass the filter + configs = [config for config in configNames if prog.match(config)] switchViewTo(ViewConstants.EDIT) return configs diff --git a/tests/system/shared/classes.py b/tests/system/shared/classes.py index 81978f59fc0ae3f0b1fd18e36948e9e11fa9ca33..5e2d5ac143df640683a8104473aeb13390d4f6ae 100644 --- a/tests/system/shared/classes.py +++ b/tests/system/shared/classes.py @@ -56,9 +56,7 @@ class QtQuickConstants: if not isinstance(targets, (tuple,list)): test.fatal("Wrong usage... This function handles only tuples or lists.") return None - result = [] - for target in targets: - result.append(QtQuickConstants.getStringForTarget(target)) + result = map(QtQuickConstants.getStringForTarget, targets) if None in result: test.fatal("You've passed at least one unknown target!") return result diff --git a/tests/system/shared/hook_utils.py b/tests/system/shared/hook_utils.py index eb1ebf8ad27d6e1e063b7ca4ab7bdd38d18eaaf9..8239b27f8ccd414388b06f5fba4869ca29521c8d 100644 --- a/tests/system/shared/hook_utils.py +++ b/tests/system/shared/hook_utils.py @@ -239,13 +239,11 @@ def __configureCustomExecutable__(projectName, port, mkspec, qmakeVersion): # occur more than once - but could easily be found by using a compound object # (e.g. search for Utils::PathChooser instead of Utils::BaseValidatingLineEdit and get the child) def getChildByClass(parent, classToSearchFor, occurence=1): - counter = 0 - for child in object.children(parent): - if className(child) == classToSearchFor: - counter = counter + 1 - if counter == occurence: - return child - return None + children = [child for child in object.children(parent) if className(child) == classToSearchFor] + if len(children) < occurence: + return None + else: + return children[occurence - 1] # helper that tries to get the mkspec entry of the QtVersion ToolTip def __getMkspec__(qtToolTip): diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 9525e10722a6fa93bd909b7048740831f4bbd493..d0b4cb1d5e394035aa65f2a4c47f8b6bbea9c699 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -294,3 +294,10 @@ def getCorrectlyConfiguredTargets(): result.update({target:[version]}) clickButton(waitForObject(":Options.OK_QPushButton")) return result + +def visibleCheckBoxExists(text): + try: + findObject("{type='QCheckBox' text='%s' visible='1'}" % text) + return True + except: + return False diff --git a/tests/system/suite_general/tst_create_proj_wizard/test.py b/tests/system/suite_general/tst_create_proj_wizard/test.py index 80ba5ab18f2210c591480ddb631600ebba0e39f0..0f3f9d4c4c437f1c5eca6f1862ba154a25fbb88f 100644 --- a/tests/system/suite_general/tst_create_proj_wizard/test.py +++ b/tests/system/suite_general/tst_create_proj_wizard/test.py @@ -69,14 +69,8 @@ def main(): clickButton(waitForObject(":Next_QPushButton")) except LookupError: pass - availableCheckboxes = [] waitForObject("{type='QLabel' unnamed='1' visible='1' text='Target Setup'}") - for current in QtQuickConstants.getAllTargetStrings(): - try: - findObject("{type='QCheckBox' text='%s' visible='1'}" % current) - availableCheckboxes.append(current) - except: - pass + availableCheckboxes = filter(visibleCheckBoxExists, QtQuickConstants.getAllTargetStrings()) JIRA.performWorkaroundIfStillOpen(6967, JIRA.Bug.CREATOR, template, displayedPlatforms) # verification whether expected, found and configured match for t in targets: diff --git a/tests/system/suite_qtquick/tst_qml_indent/test.py b/tests/system/suite_qtquick/tst_qml_indent/test.py index c460a84a0db1427521681999802e28ef94121831..6c7da9eccc2721f73c7c25caca4272f91ecdbf6d 100644 --- a/tests/system/suite_qtquick/tst_qml_indent/test.py +++ b/tests/system/suite_qtquick/tst_qml_indent/test.py @@ -36,18 +36,15 @@ def prepareQmlFile(): return False markText(editor, start, end) type(editor, "<Ctrl+C>") - for i in range(10): + for j in range(10): type(editor, "<Ctrl+V>") global originalText # assume the current editor content to be indented correctly originalText = "%s" % editor.plainText indented = editor.plainText - unindented = "" lines = str(indented).splitlines() test.log("Using %d lines..." % len(lines)) - for line in lines: - unindented += line.lstrip()+"\n" - editor.plainText = unindented + editor.plainText = "\n".join([line.lstrip() for line in lines]) + "\n" return True def handleTextChanged(object):