Squish: Fix switchToBuildOrRunSettingsFor()

Properties of the model indices did change recently and so
checking for enabled does no more work - use its toolTip
content instead to check for the enabled state.

Change-Id: Idc2b5ed1a0a14cfabdbdb4231eab243d28c0aee7
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
Christian Stenger
2016-10-17 15:57:46 +02:00
committed by Robert Loehning
parent ccc5359c42
commit 3ffec118d0

View File

@@ -83,6 +83,7 @@ def prepareBuildSettings(targetCount, currentTarget, setReleaseBuild=True, disab
# param targetCount specifies the number of targets currently defined (must be correct!)
# param projectSettings specifies where to switch to (must be one of ProjectSettings.BUILD or ProjectSettings.RUN)
def switchToBuildOrRunSettingsFor(targetCount, currentTarget, projectSettings):
clickToActivate = "<h3>Click to activate:</h3>"
try:
treeView = waitForObject(":Projects.ProjectNavigationTreeView")
except LookupError:
@@ -90,13 +91,14 @@ def switchToBuildOrRunSettingsFor(targetCount, currentTarget, projectSettings):
bAndRIndex = getQModelIndexStr("text='Build & Run'", ":Projects.ProjectNavigationTreeView")
targetIndices = dumpIndices(treeView.model(), waitForObject(bAndRIndex))
targets = map(lambda t: str(t.data(0)), filter(lambda x: x.enabled, targetIndices))
targets = map(lambda t: str(t.data(0)),
filter(lambda x: not str(x.toolTip).startswith(clickToActivate), targetIndices))
if not test.compare(targetCount, len(targets), "Check whether all chosen targets are listed."):
return False
# we assume the targets are still ordered the same way
currentTargetIndex = getQModelIndexStr("text='%s'" % targets[currentTarget], bAndRIndex)
if not test.verify(findObject(currentTargetIndex).enabled, "Verifying target '%s' is enabled."
% targets[currentTarget]):
if not test.verify(not str(findObject(currentTargetIndex).toolTip).startswith(clickToActivate),
"Verifying target '%s' is enabled." % targets[currentTarget]):
return False
mouseClick(waitForObject(currentTargetIndex))