diff options
author | Robert Loehning <robert.loehning@digia.com> | 2013-01-30 18:15:38 +0100 |
---|---|---|
committer | Robert Loehning <robert.loehning@digia.com> | 2013-01-31 11:22:17 +0100 |
commit | 58e4a5fb5ebbdd041ce7c1389df5442891a936a3 (patch) | |
tree | e0836d5620d49f2983a7ae2fa51df41e8d091851 | |
parent | 5e5eb43d183801553a0701c9807b41100a129159 (diff) | |
download | qt-creator-58e4a5fb5ebbdd041ce7c1389df5442891a936a3.tar.gz |
Squish: Fixed opening of files
Change-Id: Ia96a4a000cac1dde0f660e5f58141a73c7625a1e
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
-rw-r--r-- | tests/system/shared/editor_utils.py | 12 | ||||
-rwxr-xr-x | tests/system/suite_CCOM/tst_CCOM02/test.py | 2 | ||||
-rw-r--r-- | tests/system/suite_CSUP/tst_CSUP01/test.py | 2 | ||||
-rw-r--r-- | tests/system/suite_CSUP/tst_CSUP02/test.py | 2 | ||||
-rw-r--r-- | tests/system/suite_CSUP/tst_CSUP04/test.py | 4 | ||||
-rw-r--r-- | tests/system/suite_CSUP/tst_CSUP05/test.py | 2 | ||||
-rw-r--r-- | tests/system/suite_QMLS/shared/qmls.py | 7 | ||||
-rw-r--r-- | tests/system/suite_QMLS/tst_QMLS03/test.py | 2 | ||||
-rw-r--r-- | tests/system/suite_SCOM/tst_SCOM02/test.py | 2 | ||||
-rw-r--r-- | tests/system/suite_SCOM/tst_SCOM04/test.py | 2 |
10 files changed, 24 insertions, 13 deletions
diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py index c438804429..558eef273d 100644 --- a/tests/system/shared/editor_utils.py +++ b/tests/system/shared/editor_utils.py @@ -287,14 +287,22 @@ def invokeFindUsage(editor, line, typeOperation, n=1): invokeContextMenuItem(editor, "Find Usages") return True +def addBranchWildcardToRoot(rootNode): + pos = rootNode.find(".") + return rootNode[:pos] + " (*)" + rootNode[pos:] + def openDocument(treeElement): try: selectFromCombo(":Qt Creator_Core::Internal::NavComboBox", "Open Documents") navigator = waitForObject(":Qt Creator_Utils::NavigationTreeView") - fileName = waitForObjectItem(navigator, treeElement).text + try: + item = waitForObjectItem(navigator, treeElement, 3000) + except: + treeElement = addBranchWildcardToRoot(treeElement) + item = waitForObjectItem(navigator, treeElement) doubleClickItem(navigator, treeElement, 5, 5, 0, Qt.LeftButton) mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow") - waitFor("fileName in str(mainWindow.windowTitle)") + waitFor("item.text in str(mainWindow.windowTitle)") return True except: return False diff --git a/tests/system/suite_CCOM/tst_CCOM02/test.py b/tests/system/suite_CCOM/tst_CCOM02/test.py index a687649f8c..02b3e93df3 100755 --- a/tests/system/suite_CCOM/tst_CCOM02/test.py +++ b/tests/system/suite_CCOM/tst_CCOM02/test.py @@ -15,7 +15,7 @@ def main(): # open example project openQmakeProject(examplePath) # create syntax error - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.QML.qml.property-animation\\.qml", 5, 5, 0, Qt.LeftButton) + openDocument("propertyanimation.QML.qml.property-animation\\.qml") if not appendToLine(waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget"), "Image {", "SyntaxError"): invokeMenuItem("File", "Exit") return diff --git a/tests/system/suite_CSUP/tst_CSUP01/test.py b/tests/system/suite_CSUP/tst_CSUP01/test.py index 10b4f3ffa6..78962ce23a 100644 --- a/tests/system/suite_CSUP/tst_CSUP01/test.py +++ b/tests/system/suite_CSUP/tst_CSUP01/test.py @@ -11,7 +11,7 @@ def main(): test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp"), "Step 1: Verifying if: Project is opened.") # Step 2: Open .cpp file in Edit mode. - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton) + openDocument("SampleApp.Sources.main\\.cpp") test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "Step 2: Verifying if: .cpp file is opened in Edit mode.") # Step 3: Insert text "re" to new line in Editor mode and press Ctrl+Space. diff --git a/tests/system/suite_CSUP/tst_CSUP02/test.py b/tests/system/suite_CSUP/tst_CSUP02/test.py index ec8313a9fe..804ea8caea 100644 --- a/tests/system/suite_CSUP/tst_CSUP02/test.py +++ b/tests/system/suite_CSUP/tst_CSUP02/test.py @@ -11,7 +11,7 @@ def main(): test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp"), "Step 1: Verifying if: Project is opened.") # Step 2: Open .cpp file in Edit mode. - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton) + openDocument("SampleApp.Sources.main\\.cpp") test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "Step 2: Verifying if: .cpp file is opened in Edit mode.") # Steps 3&4: Insert text "class" to new line in Editor mode and press Ctrl+Space. diff --git a/tests/system/suite_CSUP/tst_CSUP04/test.py b/tests/system/suite_CSUP/tst_CSUP04/test.py index 28d4ac145b..c591a3425b 100644 --- a/tests/system/suite_CSUP/tst_CSUP04/test.py +++ b/tests/system/suite_CSUP/tst_CSUP04/test.py @@ -22,7 +22,7 @@ def main(): test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation"), "Verifying if: Project is opened.") # open .cpp file in editor - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton) + openDocument("propertyanimation.Sources.main\\.cpp") test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "Verifying if: .cpp file is opened in Edit mode.") # place cursor on line "QmlApplicationViewer viewer;" @@ -39,7 +39,7 @@ def main(): test.verify(result, "Verifying if: The list of all usages of the selected text is displayed in Search Results. " "File with used text is opened.") # move cursor to the other word and test Find Usages function by pressing Ctrl+Shift+U. - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton) + openDocument("propertyanimation.Sources.main\\.cpp") if not placeCursorToLine(editorWidget, "viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);"): return for i in range(4): diff --git a/tests/system/suite_CSUP/tst_CSUP05/test.py b/tests/system/suite_CSUP/tst_CSUP05/test.py index f3d065ed0e..4a947079d4 100644 --- a/tests/system/suite_CSUP/tst_CSUP05/test.py +++ b/tests/system/suite_CSUP/tst_CSUP05/test.py @@ -19,7 +19,7 @@ def main(): test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation"), "Verifying if: Project is opened.") # open .cpp file in editor - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton) + openDocument("propertyanimation.Sources.main\\.cpp") test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "Verifying if: .cpp file is opened in Edit mode.") # select some word for example "viewer" and press Ctrl+F. diff --git a/tests/system/suite_QMLS/shared/qmls.py b/tests/system/suite_QMLS/shared/qmls.py index 37bcdcb622..1792c98ff4 100644 --- a/tests/system/suite_QMLS/shared/qmls.py +++ b/tests/system/suite_QMLS/shared/qmls.py @@ -6,8 +6,11 @@ def startQtCreatorWithNewAppAtQMLEditor(projectDir, projectName, line = None): # create qt quick application createNewQtQuickApplication(projectDir, projectName) # open qml file - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", projectName + ".QML.qml/" + - projectName + ".main\\.qml", 5, 5, 0, Qt.LeftButton) + qmlFile = projectName + ".QML.qml/" + projectName + ".main\\.qml" + if not openDocument(qmlFile): + test.fatal("Could not open %s" % qmlFile) + invokeMenuItem("File", "Exit") + return None # get editor editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") # place to line if needed diff --git a/tests/system/suite_QMLS/tst_QMLS03/test.py b/tests/system/suite_QMLS/tst_QMLS03/test.py index 4340260f65..abb3ab3a5a 100644 --- a/tests/system/suite_QMLS/tst_QMLS03/test.py +++ b/tests/system/suite_QMLS/tst_QMLS03/test.py @@ -50,7 +50,7 @@ def main(): # open example project openQmakeProject(examplePath) # open qml file - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.QML.qml.color-animation\\.qml", 5, 5, 0, Qt.LeftButton) + openDocument("propertyanimation.QML.qml.color-animation\\.qml") # get editor editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") # 1. check usages using context menu diff --git a/tests/system/suite_SCOM/tst_SCOM02/test.py b/tests/system/suite_SCOM/tst_SCOM02/test.py index 67e8fca6ab..517217dabd 100644 --- a/tests/system/suite_SCOM/tst_SCOM02/test.py +++ b/tests/system/suite_SCOM/tst_SCOM02/test.py @@ -7,7 +7,7 @@ def main(): # create qt quick application createNewQtQuickApplication(tempDir(), "SampleApp") # create syntax error in qml file - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.QML.qml/SampleApp.main\\.qml", 5, 5, 0, Qt.LeftButton) + openDocument("SampleApp.QML.qml/SampleApp.main\\.qml") if not appendToLine(waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget"), "Text {", "SyntaxError"): invokeMenuItem("File", "Exit") return diff --git a/tests/system/suite_SCOM/tst_SCOM04/test.py b/tests/system/suite_SCOM/tst_SCOM04/test.py index 254fea1060..be20b1fd36 100644 --- a/tests/system/suite_SCOM/tst_SCOM04/test.py +++ b/tests/system/suite_SCOM/tst_SCOM04/test.py @@ -10,7 +10,7 @@ def main(): # create qt quick application checkedTargets, projectName = createNewQtQuickApplication(tempDir(), "SampleApp") # create syntax error in cpp file - doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton) + openDocument("SampleApp.Sources.main\\.cpp") if not appendToLine(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "viewer.showExpanded();", "SyntaxError"): invokeMenuItem("File", "Exit") return |