From 3ffec118d0f255ba162ad042d03d5054a4c33fcf Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 17 Oct 2016 15:57:46 +0200 Subject: [PATCH] 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 --- tests/system/shared/project_explorer.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py index 29327857822..8ab8f012313 100644 --- a/tests/system/shared/project_explorer.py +++ b/tests/system/shared/project_explorer.py @@ -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 = "

Click to activate:

" 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))