Commit c4ec04d2 authored by Christian Stenger's avatar Christian Stenger

Squish: Adapt QMLS suite to changed template

Change-Id: I43fcb9a47759025c4da2d2fba75c4fa05d1dc340
Reviewed-by: default avatarRobert Loehning <robert.loehning@qt.io>
parent e33d0cb1
......@@ -423,3 +423,14 @@ def replaceLine(fileSpec, oldLine, newLine):
type(editor, "<Backspace>")
type(editor, newLine)
return True
def addTestableCodeAfterLine(editorObject, line, newCodeLines):
if not placeCursorToLine(editorObject, line):
return False
type(editorObject, "<Return>")
typeLines(editorObject, newCodeLines)
return True
def saveAndExit():
invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit")
......@@ -108,13 +108,16 @@ def testSuggestionsManual(lineText, textToType, expectedText):
__endTestSuggestions__(editorArea)
return True
def saveAndExit():
invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit")
def main():
if not startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp"):
return
# add basic TextEdit item to check it afterwards
codelines = ['TextEdit {', 'text: "Enter something"', 'anchors.top: parent.top',
'anchors.horizontalCenter: parent.horizontalCenter', 'anchors.topMargin: 20']
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
if not addTestableCodeAfterLine(editor, 'title: qsTr("Hello World")', codelines):
saveAndExit()
return
# test "color: " suggestion usage with Enter key
if not testSuggestionsAuto("TextEdit {", "col", "color:", "<Return>"):
saveAndExit()
......@@ -123,11 +126,11 @@ def main():
if not testSuggestionsAuto("TextEdit {", "col", "color:", "<Tab>"):
saveAndExit()
return
# test "textChanged: " suggestion - automatic insert, because only one suggestion available
# test automatic insertion (prerequisite: only one suggestion available)
shortcutToSuggestions = "<Ctrl+Space>"
if platform.system() == "Darwin":
shortcutToSuggestions = "<Meta+Space>"
if not testSuggestionsAuto("TextEdit {","baseu", "baseUrl:", shortcutToSuggestions):
if not testSuggestionsAuto("TextEdit {", "online", "onLineCountChanged:", shortcutToSuggestions):
saveAndExit()
return
# change settings to manual insertion of suggestions
......
......@@ -27,9 +27,15 @@ source("../shared/qmls.py")
source("../../shared/suites_qtta.py")
def main():
editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp", "TextEdit {")
editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp")
if not editorArea:
return
# add basic TextEdit item to check it afterwards
codelines = ['TextEdit {', 'text: "Enter something"', 'anchors.top: parent.top',
'anchors.horizontalCenter: parent.horizontalCenter', 'anchors.topMargin: 20']
if not addTestableCodeAfterLine(editorArea, 'title: qsTr("Hello World")', codelines):
saveAndExit()
return
# write code with error (C should be lower case)
testingCodeLine = 'Color : "blue"'
type(editorArea, "<Return>")
......
......@@ -27,9 +27,16 @@ source("../shared/qmls.py")
def main():
projectDir = tempDir()
editorArea = startQtCreatorWithNewAppAtQMLEditor(projectDir, "SampleApp", "TextEdit {")
editorArea = startQtCreatorWithNewAppAtQMLEditor(projectDir, "SampleApp")
if not editorArea:
return
# add basic TextEdit item to check it afterwards
codelines = ['TextEdit {', 'id: textEdit', 'text: "Enter something"', 'anchors.top: parent.top',
'anchors.horizontalCenter: parent.horizontalCenter', 'anchors.topMargin: 20']
if not addTestableCodeAfterLine(editorArea, 'title: qsTr("Hello World")', codelines):
saveAndExit()
return
placeCursorToLine(editorArea, "TextEdit {")
for i in range(5):
type(editorArea, "<Left>")
# invoke Refactoring - Move Component into separate file
......
......@@ -26,7 +26,7 @@
source("../shared/qmls.py")
def main():
editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp", "TextEdit {")
editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp", "}")
if not editorArea:
return
homeKey = "<Home>"
......
......@@ -29,7 +29,14 @@ def main():
editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp", "}")
if not editorArea:
return
homeKey = "<Home>"
if platform.system() == "Darwin":
homeKey = "<Ctrl+Left>"
for i in range(2):
type(editorArea, homeKey)
type(editorArea, "<Return>")
type(editorArea, "<Up>")
type(editorArea, "<Tab>")
testingItemText = "Item { x: 10; y: 20; width: 10 }"
type(editorArea, testingItemText)
for i in range(30):
......
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