Squish: Store text of item as early as possible

It seems that item.text can change after (not during!) the
double-click. Storing it earlier to workaround this problem.

Change-Id: I5da4ae7ea8e19b945e56349c2236940a9e5731cb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Robert Loehning
2017-08-31 17:21:52 +02:00
committed by Christian Stenger
parent 4e4118dd26
commit 5f7636254a

View File

@@ -380,13 +380,13 @@ def openDocument(treeElement):
except: except:
treeElement = addBranchWildcardToRoot(treeElement) treeElement = addBranchWildcardToRoot(treeElement)
item = waitForObjectItem(navigator, treeElement) item = waitForObjectItem(navigator, treeElement)
expected = str(item.text).split("/")[-1]
for _ in range(2): for _ in range(2):
# Expands items as needed what might make scrollbars appear. # Expands items as needed what might make scrollbars appear.
# These might cover the item to click. # These might cover the item to click.
# In this case, do it again to hit the item then. # In this case, do it again to hit the item then.
doubleClickItem(navigator, treeElement, 5, 5, 0, Qt.LeftButton) doubleClickItem(navigator, treeElement, 5, 5, 0, Qt.LeftButton)
mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow") mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow")
expected = str(item.text).split("/")[-1]
if waitFor("str(mainWindow.windowTitle).startswith(expected + ' ')", 5000): if waitFor("str(mainWindow.windowTitle).startswith(expected + ' ')", 5000):
return True return True
test.log("Expected file (%s) was not being opened in openDocument()" % expected) test.log("Expected file (%s) was not being opened in openDocument()" % expected)