diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py index e5a652aae96b12bae2e385b84f1d06a70f5712e1..1730fed46c090f9c1d34cfa917529537138874fe 100644 --- a/tests/system/shared/editor_utils.py +++ b/tests/system/shared/editor_utils.py @@ -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") diff --git a/tests/system/suite_QMLS/tst_QMLS01/test.py b/tests/system/suite_QMLS/tst_QMLS01/test.py index cb8f6447a2ac5e55463913f740476574027ddad3..434b1ae47eaf50f8418febb09c8ed224733794d5 100644 --- a/tests/system/suite_QMLS/tst_QMLS01/test.py +++ b/tests/system/suite_QMLS/tst_QMLS01/test.py @@ -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 diff --git a/tests/system/suite_QMLS/tst_QMLS02/test.py b/tests/system/suite_QMLS/tst_QMLS02/test.py index 78101fc08fe44dedc870c70df7186148d457d473..687f53a53f5149ed58ee7b873fc33465360100a9 100644 --- a/tests/system/suite_QMLS/tst_QMLS02/test.py +++ b/tests/system/suite_QMLS/tst_QMLS02/test.py @@ -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>") diff --git a/tests/system/suite_QMLS/tst_QMLS04/test.py b/tests/system/suite_QMLS/tst_QMLS04/test.py index 5dabdf7f0f24283a21c84b1cf0981b86548db83d..6d4d9624775495b21626e614561e328089029040 100644 --- a/tests/system/suite_QMLS/tst_QMLS04/test.py +++ b/tests/system/suite_QMLS/tst_QMLS04/test.py @@ -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 diff --git a/tests/system/suite_QMLS/tst_QMLS05/test.py b/tests/system/suite_QMLS/tst_QMLS05/test.py index 3db2f02f015612101bd67069b4d1bb966d2ecc73..111bf68f3910e2f67d01462edbe356a2ef017030 100644 --- a/tests/system/suite_QMLS/tst_QMLS05/test.py +++ b/tests/system/suite_QMLS/tst_QMLS05/test.py @@ -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>" diff --git a/tests/system/suite_QMLS/tst_QMLS06/test.py b/tests/system/suite_QMLS/tst_QMLS06/test.py index e114fd2f2381e527e5cb32aa3ca3204c6b422bb6..f4e9a12d92d52d21d7b943bd46de5d93a14716af 100644 --- a/tests/system/suite_QMLS/tst_QMLS06/test.py +++ b/tests/system/suite_QMLS/tst_QMLS06/test.py @@ -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):