summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kerekes <jan.kerekes@ixonos.com>2012-05-10 10:53:06 +0200
committerRobert Löhning <robert.loehning@nokia.com>2012-05-11 18:12:00 +0200
commit7b51bfc845b1c768dbeca64a517f1f81fd8dd843 (patch)
treed507454917c18bb70f50a95e86da20c44d65a0d0
parent131424ed81af81e731d311c656237f651eb938d0 (diff)
downloadqt-creator-7b51bfc845b1c768dbeca64a517f1f81fd8dd843.tar.gz
Refactoring of QMLS suites
- moved common parts to shared script Change-Id: I25ac888d7103ee36edff9ead502fa432a5dc2937 Reviewed-by: Christian Stenger <christian.stenger@nokia.com> Reviewed-by: Robert Löhning <robert.loehning@nokia.com>
-rw-r--r--tests/system/suite_QMLS/shared/qmls.py24
-rw-r--r--tests/system/suite_QMLS/tst_QMLS01/test.py10
-rw-r--r--tests/system/suite_QMLS/tst_QMLS02/test.py14
-rw-r--r--tests/system/suite_QMLS/tst_QMLS04/test.py15
-rw-r--r--tests/system/suite_QMLS/tst_QMLS05/test.py31
5 files changed, 42 insertions, 52 deletions
diff --git a/tests/system/suite_QMLS/shared/qmls.py b/tests/system/suite_QMLS/shared/qmls.py
new file mode 100644
index 0000000000..37bcdcb622
--- /dev/null
+++ b/tests/system/suite_QMLS/shared/qmls.py
@@ -0,0 +1,24 @@
+source("../../shared/qtcreator.py")
+source("../../shared/suites_qtta.py")
+
+def startQtCreatorWithNewAppAtQMLEditor(projectDir, projectName, line = None):
+ startApplication("qtcreator" + SettingsPath)
+ # 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)
+ # get editor
+ editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
+ # place to line if needed
+ if line:
+ # place cursor to component
+ if not placeCursorToLine(editorArea, line):
+ invokeMenuItem("File", "Exit")
+ return None
+ return editorArea
+
+def verifyCurrentLine(editorArea, currentLineExpectedText, verifyMessage):
+ currentLineText = str(lineUnderCursor(editorArea)).strip();
+ return test.compare(currentLineText, currentLineExpectedText, verifyMessage)
+
diff --git a/tests/system/suite_QMLS/tst_QMLS01/test.py b/tests/system/suite_QMLS/tst_QMLS01/test.py
index 92a62f985b..b76dd10106 100644
--- a/tests/system/suite_QMLS/tst_QMLS01/test.py
+++ b/tests/system/suite_QMLS/tst_QMLS01/test.py
@@ -1,5 +1,4 @@
-source("../../shared/qtcreator.py")
-source("../../shared/suites_qtta.py")
+source("../shared/qmls.py")
# go to proper line, make backup, type needed text
def __beginTestSuggestions__(editorArea, lineText, textToType):
@@ -84,11 +83,8 @@ def saveAndExit():
invokeMenuItem("File", "Exit")
def main():
- startApplication("qtcreator" + SettingsPath)
- # create qt quick application
- createNewQtQuickApplication(tempDir(), "SampleApp")
- # open qml file
- doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.QML.qml/SampleApp.main\\.qml", 5, 5, 0, Qt.LeftButton)
+ if not startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp"):
+ return
# test "color: " suggestion usage with Enter key
if not testSuggestionsAuto("Text {", "col", "color:", "<Return>"):
saveAndExit()
diff --git a/tests/system/suite_QMLS/tst_QMLS02/test.py b/tests/system/suite_QMLS/tst_QMLS02/test.py
index 0cfc9e88ff..3c65ac020f 100644
--- a/tests/system/suite_QMLS/tst_QMLS02/test.py
+++ b/tests/system/suite_QMLS/tst_QMLS02/test.py
@@ -1,16 +1,8 @@
-source("../../shared/qtcreator.py")
-source("../../shared/suites_qtta.py")
+source("../shared/qmls.py")
def main():
- startApplication("qtcreator" + SettingsPath)
- # create qt quick application
- createNewQtQuickApplication(tempDir(), "SampleApp")
- # open qml file
- doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.QML.qml/SampleApp.main\\.qml", 5, 5, 0, Qt.LeftButton)
- # get editor
- editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
- if not placeCursorToLine(editorArea, "Text {"):
- invokeMenuItem("File", "Exit")
+ editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp", "Text {")
+ if not editorArea:
return
# write code with error (C should be lower case)
testingCodeLine = 'Color : "blue"'
diff --git a/tests/system/suite_QMLS/tst_QMLS04/test.py b/tests/system/suite_QMLS/tst_QMLS04/test.py
index 3c7f76ffdc..e62b72dc6a 100644
--- a/tests/system/suite_QMLS/tst_QMLS04/test.py
+++ b/tests/system/suite_QMLS/tst_QMLS04/test.py
@@ -1,18 +1,9 @@
-source("../../shared/qtcreator.py")
-source("../../shared/suites_qtta.py")
+source("../shared/qmls.py")
def main():
- startApplication("qtcreator" + SettingsPath)
- # create qt quick application
projectDir = tempDir()
- createNewQtQuickApplication(projectDir, "SampleApp")
- # open qml file
- doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.QML.qml/SampleApp.main\\.qml", 5, 5, 0, Qt.LeftButton)
- # get editor
- editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
- # place cursor to component
- if not placeCursorToLine(editorArea, "Text {"):
- invokeMenuItem("File", "Exit")
+ editorArea = startQtCreatorWithNewAppAtQMLEditor(projectDir, "SampleApp", "Text {")
+ if not editorArea:
return
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 5)
# 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 5f018bde2a..694460eea3 100644
--- a/tests/system/suite_QMLS/tst_QMLS05/test.py
+++ b/tests/system/suite_QMLS/tst_QMLS05/test.py
@@ -1,22 +1,8 @@
-source("../../shared/qtcreator.py")
-source("../../shared/suites_qtta.py")
-
-def verifyCurrentLine(editorArea, currentLineExpectedText):
- verifyMessage = "Verifying split initializer functionality at element line."
- currentLineText = str(lineUnderCursor(editorArea)).strip();
- return test.compare(currentLineText, currentLineExpectedText, verifyMessage)
+source("../shared/qmls.py")
def main():
- startApplication("qtcreator" + SettingsPath)
- # create qt quick application
- createNewQtQuickApplication(tempDir(), "SampleApp")
- # open qml file
- doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.QML.qml/SampleApp.main\\.qml", 5, 5, 0, Qt.LeftButton)
- # get editor
- editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
- # prepare code for test - type one-line element
- if not placeCursorToLine(editorArea, "Text {"):
- invokeMenuItem("File", "Exit")
+ editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp", "Text {")
+ if not editorArea:
return
moveTextCursor(editorArea, QTextCursor.StartOfLine, QTextCursor.MoveAnchor)
type(editorArea, "<Return>")
@@ -33,15 +19,16 @@ def main():
# wait until refactoring ended
waitFor("len(str(editorArea.plainText).splitlines()) == numLinesExpected", 5000)
# verify if refactoring was properly applied - each part on separate line
- verifyCurrentLine(editorArea, "Item {")
+ verifyMessage = "Verifying split initializer functionality at element line."
+ verifyCurrentLine(editorArea, "Item {", verifyMessage)
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
- verifyCurrentLine(editorArea, "x: 10;")
+ verifyCurrentLine(editorArea, "x: 10;", verifyMessage)
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
- verifyCurrentLine(editorArea, "y: 20;")
+ verifyCurrentLine(editorArea, "y: 20;", verifyMessage)
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
- verifyCurrentLine(editorArea, "width: 10")
+ verifyCurrentLine(editorArea, "width: 10", verifyMessage)
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
- verifyCurrentLine(editorArea, "}")
+ verifyCurrentLine(editorArea, "}", verifyMessage)
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
#save and exit
invokeMenuItem("File", "Save All")