Commit 58e4a5fb authored by Robert Loehning's avatar Robert Loehning
Browse files

Squish: Fixed opening of files



Change-Id: Ia96a4a000cac1dde0f660e5f58141a73c7625a1e
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 5e5eb43d
...@@ -287,14 +287,22 @@ def invokeFindUsage(editor, line, typeOperation, n=1): ...@@ -287,14 +287,22 @@ def invokeFindUsage(editor, line, typeOperation, n=1):
invokeContextMenuItem(editor, "Find Usages") invokeContextMenuItem(editor, "Find Usages")
return True return True
def addBranchWildcardToRoot(rootNode):
pos = rootNode.find(".")
return rootNode[:pos] + " (*)" + rootNode[pos:]
def openDocument(treeElement): def openDocument(treeElement):
try: try:
selectFromCombo(":Qt Creator_Core::Internal::NavComboBox", "Open Documents") selectFromCombo(":Qt Creator_Core::Internal::NavComboBox", "Open Documents")
navigator = waitForObject(":Qt Creator_Utils::NavigationTreeView") 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) doubleClickItem(navigator, treeElement, 5, 5, 0, Qt.LeftButton)
mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow") mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow")
waitFor("fileName in str(mainWindow.windowTitle)") waitFor("item.text in str(mainWindow.windowTitle)")
return True return True
except: except:
return False return False
...@@ -15,7 +15,7 @@ def main(): ...@@ -15,7 +15,7 @@ def main():
# open example project # open example project
openQmakeProject(examplePath) openQmakeProject(examplePath)
# create syntax error # 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"): if not appendToLine(waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget"), "Image {", "SyntaxError"):
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
return return
......
...@@ -11,7 +11,7 @@ def main(): ...@@ -11,7 +11,7 @@ def main():
test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp"), test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp"),
"Step 1: Verifying if: Project is opened.") "Step 1: Verifying if: Project is opened.")
# Step 2: Open .cpp file in Edit mode. # 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"), test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"),
"Step 2: Verifying if: .cpp file is opened in Edit mode.") "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. # Step 3: Insert text "re" to new line in Editor mode and press Ctrl+Space.
......
...@@ -11,7 +11,7 @@ def main(): ...@@ -11,7 +11,7 @@ def main():
test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp"), test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp"),
"Step 1: Verifying if: Project is opened.") "Step 1: Verifying if: Project is opened.")
# Step 2: Open .cpp file in Edit mode. # 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"), test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"),
"Step 2: Verifying if: .cpp file is opened in Edit mode.") "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. # Steps 3&4: Insert text "class" to new line in Editor mode and press Ctrl+Space.
......
...@@ -22,7 +22,7 @@ def main(): ...@@ -22,7 +22,7 @@ def main():
test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation"), test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation"),
"Verifying if: Project is opened.") "Verifying if: Project is opened.")
# open .cpp file in editor # 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"), test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"),
"Verifying if: .cpp file is opened in Edit mode.") "Verifying if: .cpp file is opened in Edit mode.")
# place cursor on line "QmlApplicationViewer viewer;" # place cursor on line "QmlApplicationViewer viewer;"
...@@ -39,7 +39,7 @@ def main(): ...@@ -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. " 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.") "File with used text is opened.")
# move cursor to the other word and test Find Usages function by pressing Ctrl+Shift+U. # 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);"): if not placeCursorToLine(editorWidget, "viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);"):
return return
for i in range(4): for i in range(4):
......
...@@ -19,7 +19,7 @@ def main(): ...@@ -19,7 +19,7 @@ def main():
test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation"), test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation"),
"Verifying if: Project is opened.") "Verifying if: Project is opened.")
# open .cpp file in editor # 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"), test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"),
"Verifying if: .cpp file is opened in Edit mode.") "Verifying if: .cpp file is opened in Edit mode.")
# select some word for example "viewer" and press Ctrl+F. # select some word for example "viewer" and press Ctrl+F.
......
...@@ -6,8 +6,11 @@ def startQtCreatorWithNewAppAtQMLEditor(projectDir, projectName, line = None): ...@@ -6,8 +6,11 @@ def startQtCreatorWithNewAppAtQMLEditor(projectDir, projectName, line = None):
# create qt quick application # create qt quick application
createNewQtQuickApplication(projectDir, projectName) createNewQtQuickApplication(projectDir, projectName)
# open qml file # open qml file
doubleClickItem(":Qt Creator_Utils::NavigationTreeView", projectName + ".QML.qml/" + qmlFile = projectName + ".QML.qml/" + projectName + ".main\\.qml"
projectName + ".main\\.qml", 5, 5, 0, Qt.LeftButton) if not openDocument(qmlFile):
test.fatal("Could not open %s" % qmlFile)
invokeMenuItem("File", "Exit")
return None
# get editor # get editor
editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
# place to line if needed # place to line if needed
......
...@@ -50,7 +50,7 @@ def main(): ...@@ -50,7 +50,7 @@ def main():
# open example project # open example project
openQmakeProject(examplePath) openQmakeProject(examplePath)
# open qml file # 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 # get editor
editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
# 1. check usages using context menu # 1. check usages using context menu
......
...@@ -7,7 +7,7 @@ def main(): ...@@ -7,7 +7,7 @@ def main():
# create qt quick application # create qt quick application
createNewQtQuickApplication(tempDir(), "SampleApp") createNewQtQuickApplication(tempDir(), "SampleApp")
# create syntax error in qml file # 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"): if not appendToLine(waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget"), "Text {", "SyntaxError"):
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
return return
......
...@@ -10,7 +10,7 @@ def main(): ...@@ -10,7 +10,7 @@ def main():
# create qt quick application # create qt quick application
checkedTargets, projectName = createNewQtQuickApplication(tempDir(), "SampleApp") checkedTargets, projectName = createNewQtQuickApplication(tempDir(), "SampleApp")
# create syntax error in cpp file # 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"): if not appendToLine(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "viewer.showExpanded();", "SyntaxError"):
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
return return
......
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