Commit d2c9e3f4 authored by Christian Stenger's avatar Christian Stenger
Browse files

Squish: Fix tests on Mac



Change-Id: Ibedf2bb581a5b0deb7c8e95ec792630e429f1570
Reviewed-by: default avatarBill King <bill.king@nokia.com>
parent 4e0421ed
......@@ -2,6 +2,7 @@ source("../../shared/qtcreator.py")
workingDir = None
templateDir = None
searchFinished = False
def main():
global workingDir,templateDir
......@@ -15,6 +16,7 @@ def main():
workingDir = tempDir()
prepareTemplate(sourceExample)
prepareForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
installLazySignalHandler("{type='Core::FutureProgress' unnamed='1''}", "finished()", "__handleFutureProgress__")
createNewQtQuickApplication(workingDir, "untitled", templateDir + "/qml/focus.qml")
# wait for parsing to complete
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
......@@ -30,6 +32,7 @@ def prepareTemplate(sourceExample):
shutil.copytree(sourceExample, templateDir)
def testRenameId():
global searchFinished
test.log("Testing rename of id")
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
......@@ -59,9 +62,14 @@ def testRenameId():
test.fatal("File seems to have changed... Canceling current test")
return False
type(editor, "<Down>")
openContextMenuOnTextCursorPosition(editor)
ctxtMenu = waitForObject("{type='QMenu' visible='1' unnamed='1'}")
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Rename Symbol Under Cursor"))
searchFinished = False
if platform.system() == "Darwin":
invokeMenuItem("Tools", "QML/JS", "Rename Symbol Under Cursor")
else:
openContextMenuOnTextCursorPosition(editor)
ctxtMenu = waitForObject("{type='QMenu' visible='1' unnamed='1'}")
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Rename Symbol Under Cursor"))
waitFor("searchFinished")
type(waitForObject("{leftWidget={text='Replace with:' type='QLabel' unnamed='1' visible='1'} "
"type='Find::Internal::WideEnoughLineEdit' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}"), "renamedView")
......@@ -82,6 +90,7 @@ def testRenameId():
invokeMenuItem("File","Save All")
def __invokeFindUsage__(treeView, filename, line, additionalKeyPresses, expectedCount):
global searchFinished
doubleClickFile(treeView, filename)
editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
......@@ -90,9 +99,14 @@ def __invokeFindUsage__(treeView, filename, line, additionalKeyPresses, expected
return
for ty in additionalKeyPresses:
type(editor, ty)
openContextMenuOnTextCursorPosition(editor)
ctxtMenu = waitForObject("{type='QMenu' visible='1' unnamed='1'}")
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Find Usages"))
searchFinished = False
if platform.system() == "Darwin":
invokeMenuItem("Tools", "QML/JS", "Find Usages")
else:
openContextMenuOnTextCursorPosition(editor)
ctxtMenu = waitForObject("{type='QMenu' visible='1' unnamed='1'}")
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Find Usages"))
waitFor("searchFinished")
validateSearchResult(expectedCount)
def testFindUsages():
......@@ -103,7 +117,10 @@ def testFindUsages():
test.log("Testing find usage of a property")
clickButton(waitForObject("{type='QToolButton' text='Clear' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}"))
__invokeFindUsage__(navTree, "focus\\.qml", "id: window", ["<Down>", "<Down>", "<Home>"], 26)
home = "<Home>"
if platform.system() == "Darwin":
home = "<Ctrl+Left>"
__invokeFindUsage__(navTree, "focus\\.qml", "id: window", ["<Down>", "<Down>", home], 26)
def validateSearchResult(expectedCount):
searchResult = waitForObject(":Qt Creator_SearchResult_Core::Internal::OutputPaneToggleButton")
......@@ -217,3 +234,8 @@ def cleanup():
deleteDirIfExists(workingDir)
if templateDir!=None:
deleteDirIfExists(os.path.dirname(templateDir))
def __handleFutureProgress__(obj):
global searchFinished
if className(obj) == "Core::FutureProgress":
searchFinished = True
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