From 24db24734d92f2f3edc9bc1a17851e6ac0df643e Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Fri, 9 Mar 2018 12:51:24 +0100 Subject: [PATCH] Squish: Open example from Qt 5.6 in tst_qml_editor Change-Id: Ibd5bd516d8409fa5389da3e330d6723ba772f135 Reviewed-by: Christian Stenger --- .../suite_editors/tst_qml_editor/test.py | 51 +++++++++++-------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/tests/system/suite_editors/tst_qml_editor/test.py b/tests/system/suite_editors/tst_qml_editor/test.py index c61b7aa43de..06679825214 100644 --- a/tests/system/suite_editors/tst_qml_editor/test.py +++ b/tests/system/suite_editors/tst_qml_editor/test.py @@ -25,10 +25,12 @@ source("../../shared/qtcreator.py") +focusDocumentPath = "keyinteraction.Resources.keyinteraction\.qrc./keyinteraction.focus.%s" + def main(): - target = Targets.DESKTOP_5_3_1_DEFAULT - sourceExample = os.path.join(Qt5Path.examplesPath(target), "declarative/keyinteraction/focus") - proFile = "focus.pro" + target = Targets.DESKTOP_5_6_1_DEFAULT + sourceExample = os.path.join(Qt5Path.examplesPath(target), "quick/keyinteraction") + proFile = "keyinteraction.pro" if not neededFilePresent(os.path.join(sourceExample, proFile)): return startApplication("qtcreator" + SettingsPath) @@ -36,9 +38,9 @@ def main(): return # add docs to have the correct tool tips addHelpDocumentation([os.path.join(Qt5Path.docsPath(target), "qtquick.qch")]) - templateDir = prepareTemplate(sourceExample, "/../../helper") + templateDir = prepareTemplate(sourceExample) openQmakeProject(os.path.join(templateDir, proFile), [target]) - openDocument("focus.QML.qml" + os.sep + "focus.focus\\.qml") + openDocument(focusDocumentPath % "focus\\.qml") testRenameId() testFindUsages() testHovering() @@ -47,20 +49,20 @@ def main(): def testRenameId(): test.log("Testing rename of id") - files = ["FocusCore.ContextMenu\\.qml", "FocusCore.GridMenu\\.qml", - "FocusCore.ListMenu\\.qml", "focus\\.qml"] + files = ["Core.ContextMenu\\.qml", "Core.GridMenu\\.qml", + "Core.ListMenu\\.qml", "focus\\.qml"] originalTexts = {} editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") formerTxt = editor.plainText for file in files: - openDocument("focus.QML.qml" + os.sep + "focus.%s" % file) + openDocument(focusDocumentPath % file) # wait until editor content switched to the double-clicked file while formerTxt==editor.plainText: editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") # store content for next round formerTxt = editor.plainText originalTexts.setdefault(file, "%s" % formerTxt) - test.log("stored %s's content" % file.replace("FocusCore.","").replace("\\","")) + test.log("stored %s's content" % file.replace("Core.","").replace("\\","")) # last opened file is the main file focus.qml line = "FocusScope\s*\{" if not placeCursorToLine(editor, line, True): @@ -77,18 +79,18 @@ def testRenameId(): # store editor content for synchronizing purpose formerTxt = editor.plainText for file in files: - openDocument("focus.QML.qml" + os.sep + "focus.%s" % file) + openDocument(focusDocumentPath % file) # wait until editor content switched to double-clicked file while formerTxt==editor.plainText: editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") # store content for next round formerTxt = editor.plainText originalText = originalTexts.get(file).replace("mainView", "renamedView") - test.compare(originalText,formerTxt, "Comparing %s" % file.replace("FocusCore.","").replace("\\","")) + test.compare(originalText,formerTxt, "Comparing %s" % file.replace("Core.","").replace("\\","")) invokeMenuItem("File","Save All") def __invokeFindUsage__(filename, line, additionalKeyPresses, expectedCount): - openDocument("focus.QML.qml" + os.sep + "focus.%s" % filename) + openDocument(focusDocumentPath % filename) editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") if not placeCursorToLine(editor, line, True): test.fatal("File seems to have changed... Canceling current test") @@ -101,17 +103,18 @@ def __invokeFindUsage__(filename, line, additionalKeyPresses, expectedCount): def testFindUsages(): test.log("Testing find usage of an ID") - __invokeFindUsage__("focus\\.qml", "FocusScope\s*\{", [""], 6) + __invokeFindUsage__("focus\\.qml", "FocusScope\s*\{", [""], 7) test.log("Testing find usage of a property") clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) home = "" if platform.system() == "Darwin": home = "" - __invokeFindUsage__("focus\\.qml", "id: window", ["", "", home], 26) + __invokeFindUsage__("focus\\.qml", "id: window", ["", "", home], + 29 if JIRA.isBugStillOpen(19915) else 30) def testHovering(): test.log("Testing hovering elements") - openDocument("focus.QML.qml" + os.sep + "focus.focus\\.qml") + openDocument(focusDocumentPath % "focus\\.qml") editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") lines=["FocusScope\s*\{", "Rectangle\s*\{"] if platform.system() == "Darwin": @@ -129,7 +132,7 @@ def testHovering(): alternativeValues = [{"text":"FocusScope"}, {"text":"Rectangle"}] verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues) test.log("Testing hovering properties") - openDocument("focus.QML.qml" + os.sep + "focus.focus\\.qml") + openDocument(focusDocumentPath % "focus\\.qml") editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") lines = ['focus:\s*true', 'color:\s*"black"', 'states:\s*State\s*\{', 'transitions:\s*Transition\s*\{'] expectedTypes = ["TextTip", "TextTip", "TextTip", "TextTip"] @@ -141,15 +144,19 @@ def testHovering(): '>'}, {'text':'
string

This property holds the color used to fill the rectangle.' '

  
'}, - {'text':'
State

This property holds a list of states defined by the item.' + {'text':'
State

This property holds the list of possible states for this item. ' + 'To change the state of this item, set the state property to one of these states, or set the state property ' + 'to an empty string to revert the item to its default state.' '

  
'}, - {'text':'
Transition

This property holds a list of transitions defined by ' - 'the item.

  
'} + {'text':'
Transition

This property holds the list of transitions for this item. ' + 'These define the transitions to be applied to the item whenever it changes its state.' + '

  
'} ] - alternativeValues = [{"text":"boolean"}, {"text":"string"}, {"text":"State"}, {"text":"Transition"}] + alternativeValues = [{"text":"Rectangle" if JIRA.isBugStillOpen(20020) else "boolean"}, + {"text":"string"}, {"text":"State"}, {"text":"Transition"}] verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues) test.log("Testing hovering expressions") - openDocument("focus.QML.qml" + os.sep + "focus.focus\\.qml") + openDocument(focusDocumentPath % "focus\\.qml") editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") lines=['color:\s*"black"', 'color:\s*"#3E606F"'] additionalKeyPresses = [""] @@ -157,7 +164,7 @@ def testHovering(): alternativeValues = [None, "#39616B"] expectedTypes = ["ColorTip", "ColorTip"] verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues) - openDocument("focus.QML.qml" + os.sep + "focus.FocusCore.ListMenu\\.qml") + openDocument(focusDocumentPath % "Core.ListMenu\\.qml") editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") lines=['Rectangle\s*\{.*color:\s*"#D1DBBD"', 'NumberAnimation\s*\{\s*.*Easing.OutQuint\s*\}'] additionalKeyPresses = ["", "", "", ""]