From d2c9e3f40e4c7b1de0ea47b228bf65b096f90bf8 Mon Sep 17 00:00:00 2001 From: Christian Stenger <christian.stenger@nokia.com> Date: Wed, 21 Dec 2011 14:08:36 +0100 Subject: [PATCH] Squish: Fix tests on Mac Change-Id: Ibedf2bb581a5b0deb7c8e95ec792630e429f1570 Reviewed-by: Bill King <bill.king@nokia.com> --- .../suite_qtquick/tst_qml_editor/test.py | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/tests/system/suite_qtquick/tst_qml_editor/test.py b/tests/system/suite_qtquick/tst_qml_editor/test.py index 68abcf05319..209a8ab18d6 100644 --- a/tests/system/suite_qtquick/tst_qml_editor/test.py +++ b/tests/system/suite_qtquick/tst_qml_editor/test.py @@ -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 -- GitLab