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

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):
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
......@@ -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
......
......@@ -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.
......
......@@ -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.
......
......@@ -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):
......
......@@ -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.
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
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