Commit 0e0158fc authored by Robert Loehning's avatar Robert Loehning Committed by Robert Löhning

Squish: Cleaned for-loops

Change-Id: Ide5313c8838aa7ad9ad74cbaed12872ce0a35413
Reviewed-by: default avatarBill King <bill.king@nokia.com>
Reviewed-by: default avatarChristian Stenger <christian.stenger@nokia.com>
parent e48e185d
...@@ -30,12 +30,7 @@ def __addSignalHandlerDict__(lazySignalHandlerFunction): ...@@ -30,12 +30,7 @@ def __addSignalHandlerDict__(lazySignalHandlerFunction):
lazySignalHandlerFunction(name, signalSignature, handlerFunctionName) lazySignalHandlerFunction(name, signalSignature, handlerFunctionName)
installedSignalHandlers.setdefault("%s____%s" % (name,signalSignature), [handlerFunctionName]) installedSignalHandlers.setdefault("%s____%s" % (name,signalSignature), [handlerFunctionName])
else: else:
alreadyInstalled = False if not handlerFunctionName in handlers:
for h in handlers:
if (h == handlerFunctionName):
alreadyInstalled = True
break
if not alreadyInstalled:
lazySignalHandlerFunction(name, signalSignature, handlerFunctionName) lazySignalHandlerFunction(name, signalSignature, handlerFunctionName)
handlers.append(handlerFunctionName) handlers.append(handlerFunctionName)
installedSignalHandlers.setdefault("%s____%s" % (name,signalSignature), handlers) installedSignalHandlers.setdefault("%s____%s" % (name,signalSignature), handlers)
...@@ -148,13 +143,12 @@ def createTasksFile(list): ...@@ -148,13 +143,12 @@ def createTasksFile(list):
def iterateBuildConfigs(targetCount, currentTarget, filter = ""): def iterateBuildConfigs(targetCount, currentTarget, filter = ""):
switchViewTo(ViewConstants.PROJECTS) switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(targetCount, currentTarget, ProjectSettings.BUILD) switchToBuildOrRunSettingsFor(targetCount, currentTarget, ProjectSettings.BUILD)
configs = []
model = waitForObject(":scrollArea.Edit build configuration:_QComboBox", 20000).model() model = waitForObject(":scrollArea.Edit build configuration:_QComboBox", 20000).model()
prog = re.compile(filter) prog = re.compile(filter)
for row in range(model.rowCount()): # for each row in the model, write its data to a list
configName = str(model.index(row, 0).data()) configNames = [str(model.index(row, 0).data()) for row in range(model.rowCount())]
if prog.match(configName): # pick only those configuration names which pass the filter
configs += [configName] configs = [config for config in configNames if prog.match(config)]
switchViewTo(ViewConstants.EDIT) switchViewTo(ViewConstants.EDIT)
return configs return configs
......
...@@ -56,9 +56,7 @@ class QtQuickConstants: ...@@ -56,9 +56,7 @@ class QtQuickConstants:
if not isinstance(targets, (tuple,list)): if not isinstance(targets, (tuple,list)):
test.fatal("Wrong usage... This function handles only tuples or lists.") test.fatal("Wrong usage... This function handles only tuples or lists.")
return None return None
result = [] result = map(QtQuickConstants.getStringForTarget, targets)
for target in targets:
result.append(QtQuickConstants.getStringForTarget(target))
if None in result: if None in result:
test.fatal("You've passed at least one unknown target!") test.fatal("You've passed at least one unknown target!")
return result return result
......
...@@ -239,13 +239,11 @@ def __configureCustomExecutable__(projectName, port, mkspec, qmakeVersion): ...@@ -239,13 +239,11 @@ def __configureCustomExecutable__(projectName, port, mkspec, qmakeVersion):
# occur more than once - but could easily be found by using a compound object # 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) # (e.g. search for Utils::PathChooser instead of Utils::BaseValidatingLineEdit and get the child)
def getChildByClass(parent, classToSearchFor, occurence=1): def getChildByClass(parent, classToSearchFor, occurence=1):
counter = 0 children = [child for child in object.children(parent) if className(child) == classToSearchFor]
for child in object.children(parent): if len(children) < occurence:
if className(child) == classToSearchFor: return None
counter = counter + 1 else:
if counter == occurence: return children[occurence - 1]
return child
return None
# helper that tries to get the mkspec entry of the QtVersion ToolTip # helper that tries to get the mkspec entry of the QtVersion ToolTip
def __getMkspec__(qtToolTip): def __getMkspec__(qtToolTip):
......
...@@ -294,3 +294,10 @@ def getCorrectlyConfiguredTargets(): ...@@ -294,3 +294,10 @@ def getCorrectlyConfiguredTargets():
result.update({target:[version]}) result.update({target:[version]})
clickButton(waitForObject(":Options.OK_QPushButton")) clickButton(waitForObject(":Options.OK_QPushButton"))
return result return result
def visibleCheckBoxExists(text):
try:
findObject("{type='QCheckBox' text='%s' visible='1'}" % text)
return True
except:
return False
...@@ -69,14 +69,8 @@ def main(): ...@@ -69,14 +69,8 @@ def main():
clickButton(waitForObject(":Next_QPushButton")) clickButton(waitForObject(":Next_QPushButton"))
except LookupError: except LookupError:
pass pass
availableCheckboxes = []
waitForObject("{type='QLabel' unnamed='1' visible='1' text='Target Setup'}") waitForObject("{type='QLabel' unnamed='1' visible='1' text='Target Setup'}")
for current in QtQuickConstants.getAllTargetStrings(): availableCheckboxes = filter(visibleCheckBoxExists, QtQuickConstants.getAllTargetStrings())
try:
findObject("{type='QCheckBox' text='%s' visible='1'}" % current)
availableCheckboxes.append(current)
except:
pass
JIRA.performWorkaroundIfStillOpen(6967, JIRA.Bug.CREATOR, template, displayedPlatforms) JIRA.performWorkaroundIfStillOpen(6967, JIRA.Bug.CREATOR, template, displayedPlatforms)
# verification whether expected, found and configured match # verification whether expected, found and configured match
for t in targets: for t in targets:
......
...@@ -36,18 +36,15 @@ def prepareQmlFile(): ...@@ -36,18 +36,15 @@ def prepareQmlFile():
return False return False
markText(editor, start, end) markText(editor, start, end)
type(editor, "<Ctrl+C>") type(editor, "<Ctrl+C>")
for i in range(10): for j in range(10):
type(editor, "<Ctrl+V>") type(editor, "<Ctrl+V>")
global originalText global originalText
# assume the current editor content to be indented correctly # assume the current editor content to be indented correctly
originalText = "%s" % editor.plainText originalText = "%s" % editor.plainText
indented = editor.plainText indented = editor.plainText
unindented = ""
lines = str(indented).splitlines() lines = str(indented).splitlines()
test.log("Using %d lines..." % len(lines)) test.log("Using %d lines..." % len(lines))
for line in lines: editor.plainText = "\n".join([line.lstrip() for line in lines]) + "\n"
unindented += line.lstrip()+"\n"
editor.plainText = unindented
return True return True
def handleTextChanged(object): def handleTextChanged(object):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment