summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@digia.com>2013-11-01 15:39:00 +0100
committerChristian Stenger <christian.stenger@digia.com>2013-11-22 16:04:10 +0100
commit4b4e5f69901f80ace0c0dba683771c2139d5c2b8 (patch)
treef3229245487eda194d70518b4494a0033a6d856e
parentfe86e1ba3e35cf309120e9ee4281d44cfb2c3479 (diff)
downloadqt-creator-4b4e5f69901f80ace0c0dba683771c2139d5c2b8.tar.gz
Squish: Qt Quick [12] Application templates are merged
Additionally there is no more a way of creating a Qt Quick application from an existing qml file. Change-Id: I5c1e8d26640fa3e1b865b6cc97745d64b51edc75 Reviewed-by: Robert Loehning <robert.loehning@digia.com>
-rw-r--r--tests/system/shared/hook_utils.py18
-rw-r--r--tests/system/shared/project.py47
-rw-r--r--tests/system/suite_editors/tst_qml_editor/test.py28
-rw-r--r--tests/system/suite_qtquick/suite.conf2
-rw-r--r--tests/system/suite_qtquick/tst_qtquick_creation/test.py19
-rw-r--r--tests/system/suite_qtquick/tst_qtquick_creation2/test.py87
-rw-r--r--tests/system/suite_qtquick/tst_qtquick_creation3/test.py2
7 files changed, 67 insertions, 136 deletions
diff --git a/tests/system/shared/hook_utils.py b/tests/system/shared/hook_utils.py
index 27e92a14e1..f1f64dd9ea 100644
--- a/tests/system/shared/hook_utils.py
+++ b/tests/system/shared/hook_utils.py
@@ -85,7 +85,7 @@ def batchEditRunEnvironment(kitCount, currentTarget, modifications, alreadyOnRun
clickButton(waitForObject("{text='OK' type='QPushButton' unnamed='1' visible='1' "
"window=':Edit Environment_ProjectExplorer::EnvironmentItemsDialog'}"))
-def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, port):
+def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, port, quickVersion=1):
switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(kitCount, 0, ProjectSettings.RUN, True)
@@ -102,12 +102,15 @@ def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, por
"Using fallback of pushing STOP inside Creator.")
return None
test.log("Using (QtVersion/mkspec) %s/%s with SquishPath %s" % (qtVersion, mkspec, squishPath))
- if platform.system() == "Darwin":
- qmlViewer = os.path.abspath(os.path.dirname(qmake) + "/QMLViewer.app")
+ if quickVersion == 1:
+ if platform.system() == "Darwin":
+ executable = os.path.abspath(os.path.dirname(qmake) + "/QMLViewer.app")
+ else:
+ executable = os.path.abspath(os.path.dirname(qmake) + "/qmlviewer")
else:
- qmlViewer = os.path.abspath(os.path.dirname(qmake) + "/qmlviewer")
+ executable = os.path.abspath(os.path.dirname(qmake) + "/qmlscene")
if platform.system() in ('Microsoft', 'Windows'):
- qmlViewer = qmlViewer + ".exe"
+ executable = executable + ".exe"
addRunConfig = waitForObject("{container={window=':Qt Creator_Core::Internal::MainWindow' "
"type='ProjectExplorer::Internal::RunSettingsWidget' unnamed='1' "
"visible='1'} occurrence='2' text='Add' type='QPushButton' "
@@ -129,7 +132,7 @@ def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, por
projectPath = os.path.abspath("%s/%s" % (workingDir, projectName))
replaceEditorContent(exeLineEd, startAUT)
replaceEditorContent(argLineEd, "--verbose --port=%d %s %s.qml"
- % (port, qmlViewer, projectName))
+ % (port, executable, projectName))
replaceEditorContent(wdLineEd, projectPath)
clickButton(waitForObject("{text='Details' type='Utils::DetailsButton' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow' "
@@ -144,7 +147,7 @@ def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, por
if not platform.system() in ('Microsoft', 'Windows'):
if not os.getenv("DISPLAY"):
__addVariableToRunEnvironment__("DISPLAY", ":0.0")
- result = qmlViewer
+ result = executable
switchViewTo(ViewConstants.EDIT)
return result
@@ -155,6 +158,7 @@ def __addVariableToRunEnvironment__(name, value):
"container={window=':Qt Creator_Core::Internal::MainWindow' "
"type='Utils::DetailsWidget' unnamed='1' visible='1' occurrence='2'}}"))
varNameLineEd = waitForObject("{type='QExpandingLineEdit' visible='1' unnamed='1'}")
+ doubleClick(varNameLineEd)
replaceEditorContent(varNameLineEd, name)
type(varNameLineEd, "<Return>")
row = getTableRowOf(name, ":Qt Creator_QTableView")
diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py
index 16243564e8..3646ea647d 100644
--- a/tests/system/shared/project.py
+++ b/tests/system/shared/project.py
@@ -139,6 +139,23 @@ def __createProjectSetNameAndPath__(path, projectName = None, checks = True):
clickButton(waitForObject(":Next_QPushButton"))
return str(projectName)
+def __createProjectHandleQtQuickSelection__(qtQuickVersion, withControls):
+ comboBox = waitForObject("{type='QComboBox' unnamed='1' visible='1' "
+ "leftWidget={text='Qt Quick component set:' type='QLabel' unnamed='1' "
+ "visible='1'}}")
+ if qtQuickVersion == 1:
+ selectFromCombo(comboBox, "Qt Quick 1.1")
+ if withControls:
+ test.warning("Controls are not available for Quick 1.")
+ elif qtQuickVersion == 2:
+ if withControls:
+ selectFromCombo(comboBox, "Qt Quick Controls 1.0")
+ else:
+ selectFromCombo(comboBox, "Qt Quick 2.0")
+ else:
+ test.fatal("Got unknown Qt Quick version: %s - trying to continue." % str(qtQuickVersion))
+ clickButton(waitForObject(":Next_QPushButton"))
+
# Selects the Qt versions for a project
# param checks turns tests in the function on if set to True
# param available a list holding the available targets
@@ -234,35 +251,26 @@ def createProject_Qt_Console(path, projectName, checks = True):
__verifyFileCreation__(path, expectedFiles)
return checkedTargets
-def createNewQtQuickApplication(workingDir, projectName = None, templateFile = None,
+def createNewQtQuickApplication(workingDir, projectName = None,
targets=Targets.desktopTargetClasses(), qtQuickVersion=1,
- fromWelcome=False):
- if templateFile:
- available = __createProjectOrFileSelectType__(" Applications", "Qt Quick %d Application (from Existing QML File)"
- % qtQuickVersion, fromWelcome)
- else:
- available = __createProjectOrFileSelectType__(" Applications", "Qt Quick %d Application (Built-in Types)"
- % qtQuickVersion, fromWelcome)
+ fromWelcome=False, withControls=False):
+ available = __createProjectOrFileSelectType__(" Applications", "Qt Quick Application", fromWelcome)
projectName = __createProjectSetNameAndPath__(workingDir, projectName)
- if templateFile:
- baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}")
- type(baseLineEd, templateFile)
- nextButton = waitForObject(":Next_QPushButton")
- clickButton(nextButton)
+ __createProjectHandleQtQuickSelection__(qtQuickVersion, withControls)
checkedTargets = __chooseTargets__(targets, available)
snooze(1)
- nextButton = waitForObject(":Next_QPushButton")
- clickButton(nextButton)
+ clickButton(waitForObject(":Next_QPushButton"))
__createProjectHandleLastPage__()
progressBarWait(10000)
return checkedTargets, projectName
-def createNewQtQuickUI(workingDir, qtQuickVersion=1):
- __createProjectOrFileSelectType__(" Applications", "Qt Quick %d UI" % qtQuickVersion)
+def createNewQtQuickUI(workingDir, qtQuickVersion=1, withControls=False):
+ __createProjectOrFileSelectType__(" Applications", "Qt Quick UI")
if workingDir == None:
workingDir = tempDir()
projectName = __createProjectSetNameAndPath__(workingDir)
+ __createProjectHandleQtQuickSelection__(qtQuickVersion, withControls)
__createProjectHandleLastPage__()
return projectName
@@ -443,7 +451,10 @@ def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefT
# assuming we're still on the build settings of the current project (TODO)
switchViewTo(ViewConstants.PROJECTS)
if sType == SubprocessType.QT_QUICK_UI:
- selectConfig = "QML Viewer"
+ if "qmlscene" in executable:
+ selectConfig = "QML Scene"
+ else:
+ selectConfig = "QML Viewer"
else:
selectConfig = executable
selectFromCombo(waitForObject("{buddy={text='Run configuration:' type='QLabel' "
diff --git a/tests/system/suite_editors/tst_qml_editor/test.py b/tests/system/suite_editors/tst_qml_editor/test.py
index ae2a3f12b6..2e48fbb8b7 100644
--- a/tests/system/suite_editors/tst_qml_editor/test.py
+++ b/tests/system/suite_editors/tst_qml_editor/test.py
@@ -35,8 +35,8 @@ searchFinished = False
def main():
global templateDir
sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/keyinteraction/focus")
- qmlFile = os.path.join("qml", "focus.qml")
- if not neededFilePresent(os.path.join(sourceExample, qmlFile)):
+ proFile = "focus.pro"
+ if not neededFilePresent(os.path.join(sourceExample, proFile)):
return
startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError():
@@ -45,8 +45,8 @@ def main():
addHelpDocumentation([os.path.join(sdkPath, "Documentation", "qt.qch")])
templateDir = prepareTemplate(sourceExample)
installLazySignalHandler("{type='Core::FutureProgress' unnamed='1'}", "finished()", "__handleFutureProgress__")
- # using a temporary directory won't mess up a potentially existing
- createNewQtQuickApplication(tempDir(), "untitled", os.path.join(templateDir, qmlFile))
+ openQmakeProject(os.path.join(templateDir,proFile))
+ openDocument("focus.QML.qml.focus\\.qml")
testRenameId()
testFindUsages()
testHovering()
@@ -68,7 +68,7 @@ def testRenameId():
# although used objectMap.realName() for both
formerTxt = editor.plainText
for file in files:
- doubleClickFile(navTree, file)
+ openDocument("focus.QML.qml.%s" % file)
# wait until editor content switched to the double-clicked file
while formerTxt==editor.plainText:
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
@@ -93,7 +93,7 @@ def testRenameId():
# store editor content for synchronizing purpose
formerTxt = editor.plainText
for file in files:
- doubleClickFile(navTree, file)
+ openDocument("focus.QML.qml.%s" % file)
# wait until editor content switched to double-clicked file
while formerTxt==editor.plainText:
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
@@ -105,7 +105,7 @@ def testRenameId():
def __invokeFindUsage__(treeView, filename, line, additionalKeyPresses, expectedCount):
global searchFinished
- doubleClickFile(treeView, filename)
+ openDocument("focus.QML.qml.%s" % filename)
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
if not placeCursorToLine(editor, line, True):
test.fatal("File seems to have changed... Canceling current test")
@@ -133,7 +133,7 @@ def testHovering():
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}")
test.log("Testing hovering elements")
- doubleClickFile(navTree, "focus\\.qml")
+ openDocument("focus.QML.qml.focus\\.qml")
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
lines=["FocusScope\s*\{", "Rectangle\s*\{"]
if platform.system() == "Darwin":
@@ -151,7 +151,7 @@ def testHovering():
alternativeValues = [{"text":"FocusScope"}, {"text":"Rectangle"}]
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
test.log("Testing hovering properties")
- doubleClickFile(navTree, "focus\\.qml")
+ openDocument("focus.QML.qml.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"]
@@ -171,7 +171,7 @@ def testHovering():
alternativeValues = [{"text":"boolean"}, {"text":"string"}, {"text":"State"}, {"text":"Transition"}]
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
test.log("Testing hovering expressions")
- doubleClickFile(navTree, "focus\\.qml")
+ openDocument("focus.QML.qml.focus\\.qml")
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
lines=['color:\s*"black"', 'color:\s*"#3E606F"']
additionalKeyPresses = ["<Left>"]
@@ -179,7 +179,7 @@ def testHovering():
alternativeValues = [None, "#39616B"]
expectedTypes = ["ColorTip", "ColorTip"]
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
- doubleClickFile(navTree, "Core.ListMenu\\.qml")
+ openDocument("focus.QML.qml.Core.ListMenu\\.qml")
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
lines=['Rectangle\s*\{.*color:\s*"#D1DBBD"', 'NumberAnimation\s*\{\s*.*Easing.OutQuint\s*\}']
additionalKeyPresses = ["<Left>", "<Left>", "<Left>", "<Left>"]
@@ -188,12 +188,6 @@ def testHovering():
alternativeValues = ["#D6DBBD", None]
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
-def doubleClickFile(navTree, file):
- global templateDir
- treeElement = ("untitled.QML.%s/qml.%s" %
- (maskSpecialCharsForProjectTree(templateDir),file))
- openDocument(treeElement)
-
def __getUnmaskedFilename__(maskedFilename):
name = maskedFilename.split("\\.")
path = name[0].rsplit(".", 1)
diff --git a/tests/system/suite_qtquick/suite.conf b/tests/system/suite_qtquick/suite.conf
index b7ff85fa5a..36d52be5c7 100644
--- a/tests/system/suite_qtquick/suite.conf
+++ b/tests/system/suite_qtquick/suite.conf
@@ -7,6 +7,6 @@ HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python
OBJECTMAP=../objects.map
-TEST_CASES=tst_qml_outline tst_qtquick_creation tst_qtquick_creation2 tst_qtquick_creation3 tst_qtquick_creation4
+TEST_CASES=tst_qml_outline tst_qtquick_creation tst_qtquick_creation3 tst_qtquick_creation4
VERSION=2
WRAPPERS=Qt
diff --git a/tests/system/suite_qtquick/tst_qtquick_creation/test.py b/tests/system/suite_qtquick/tst_qtquick_creation/test.py
index cbeac8bd45..8c240bbb3b 100644
--- a/tests/system/suite_qtquick/tst_qtquick_creation/test.py
+++ b/tests/system/suite_qtquick/tst_qtquick_creation/test.py
@@ -52,7 +52,9 @@ def main():
result = addExecutableAsAttachableAUT(projectName, 11223)
allowAppThroughWinFW(workingDir, projectName)
if result:
- result = runAndCloseApp(True, projectName, 11223, "subprocessFunction", SubprocessType.QT_QUICK_APPLICATION)
+ result = runAndCloseApp(True, projectName, 11223,
+ "subprocessFunctionQuick%d" % qVer,
+ SubprocessType.QT_QUICK_APPLICATION)
else:
result = runAndCloseApp(sType=SubprocessType.QT_QUICK_APPLICATION)
removeExecutableAsAttachableAUT(projectName, 11223)
@@ -65,8 +67,15 @@ def main():
invokeMenuItem("File", "Exit")
-def subprocessFunction():
- helloWorldText = waitForObject("{container={type='QmlApplicationViewer' visible='1' unnamed='1'} "
- "enabled='true' text='Hello World' type='Text' unnamed='1' visible='true'}")
- test.log("Clicking 'Hello World' Text to close QmlApplicationViewer")
+def subprocessFunctionGenericQuick(quickVersion):
+ helloWorldText = waitForObject("{container={type='QtQuick%dApplicationViewer' visible='1' "
+ "unnamed='1'} enabled='true' text='Hello World' type='Text' "
+ "unnamed='1' visible='true'}" % quickVersion)
+ test.log("Clicking 'Hello World' Text to close QtQuick%dApplicationViewer" % quickVersion)
mouseClick(helloWorldText, 5, 5, 0, Qt.LeftButton)
+
+def subprocessFunctionQuick1():
+ subprocessFunctionGenericQuick(1)
+
+def subprocessFunctionQuick2():
+ subprocessFunctionGenericQuick(2)
diff --git a/tests/system/suite_qtquick/tst_qtquick_creation2/test.py b/tests/system/suite_qtquick/tst_qtquick_creation2/test.py
deleted file mode 100644
index 925fff538d..0000000000
--- a/tests/system/suite_qtquick/tst_qtquick_creation2/test.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-## Contact: http://www.qt-project.org/legal
-##
-## This file is part of Qt Creator.
-##
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and Digia. For licensing terms and
-## conditions see http://qt.digia.com/licensing. For further information
-## use the contact form at http://qt.digia.com/contact-us.
-##
-## GNU Lesser General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU Lesser
-## General Public License version 2.1 as published by the Free Software
-## Foundation and appearing in the file LICENSE.LGPL included in the
-## packaging of this file. Please review the following information to
-## ensure the GNU Lesser General Public License version 2.1 requirements
-## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-##
-## In addition, as a special exception, Digia gives you certain additional
-## rights. These rights are described in the Digia Qt LGPL Exception
-## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-##
-#############################################################################
-
-source("../../shared/qtcreator.py")
-
-def main():
- sourceExampleQt4 = os.path.join(sdkPath, "Examples", "4.7", "declarative", "text",
- "textselection", "qml", "textselection.qml")
- sourceExampleQt5 = os.path.join(qt5SDKPath(), "examples", "quick", "text", "textselection",
- "textselection.qml")
- if not neededFilePresent(sourceExampleQt4):
- return
- if not neededFilePresent(sourceExampleQt5):
- return
- startApplication("qtcreator" + SettingsPath)
- if not startedWithoutPluginError():
- return
- targetsAndQuickVersion = {Targets.DESKTOP_480_GCC:[1, sourceExampleQt4],
- Targets.DESKTOP_501_DEFAULT:[2, sourceExampleQt5]}
- for targ, qVerAndEx in targetsAndQuickVersion.items():
- # using a temporary directory won't mess up a potentially existing
- workingDir = tempDir()
- checkedTargets, projectName = createNewQtQuickApplication(workingDir, None,
- qVerAndEx[1],
- targ, qVerAndEx[0])
- test.log("Building project Qt Quick %d Application (%s)"
- % (qVerAndEx[0], Targets.getStringForTarget(targ)))
- result = modifyRunSettingsForHookInto(projectName, len(checkedTargets), 11223)
- invokeMenuItem("Build","Build All")
- waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
- if not checkCompile():
- test.fatal("Compile failed")
- else:
- checkLastBuild()
- test.log("Running project (includes build)")
- if result:
- result = addExecutableAsAttachableAUT(projectName, 11223)
- allowAppThroughWinFW(workingDir, projectName)
- if result:
- result = runAndCloseApp(True, projectName, 11223, subprocessFunction, SubprocessType.QT_QUICK_APPLICATION)
- else:
- result = runAndCloseApp(sType=SubprocessType.QT_QUICK_APPLICATION)
- removeExecutableAsAttachableAUT(projectName, 11223)
- deleteAppFromWinFW(workingDir, projectName)
- else:
- result = runAndCloseApp()
- if result:
- logApplicationOutput()
- invokeMenuItem("File", "Close All Projects and Editors")
- invokeMenuItem("File", "Exit")
-
-def subprocessFunction():
- textEdit = waitForObject("{container={type='QmlApplicationViewer' unnamed='1' visible='1'} "
- "enabled='true' type='TextEdit' unnamed='1' visible='true'}")
- test.log("Test dragging")
- dragItemBy(textEdit, 30, 30, 50, 50, 0, Qt.LeftButton)
- test.log("Test editing")
- textEdit.cursorPosition = 0
- typeLines(textEdit, "This text is entered by Squish...")
- test.log("Closing QmlApplicationViewer")
- sendEvent("QCloseEvent", "{type='QmlApplicationViewer' unnamed='1' visible='1'}")
diff --git a/tests/system/suite_qtquick/tst_qtquick_creation3/test.py b/tests/system/suite_qtquick/tst_qtquick_creation3/test.py
index d8d647d43f..b6ea90a164 100644
--- a/tests/system/suite_qtquick/tst_qtquick_creation3/test.py
+++ b/tests/system/suite_qtquick/tst_qtquick_creation3/test.py
@@ -38,7 +38,7 @@ def main():
workingDir = tempDir()
projectName = createNewQtQuickUI(workingDir, quickVersion)
test.log("Running project Qt Quick %d UI" % quickVersion)
- qmlViewer = modifyRunSettingsForHookIntoQtQuickUI(1, workingDir, projectName, 11223)
+ qmlViewer = modifyRunSettingsForHookIntoQtQuickUI(1, workingDir, projectName, 11223, quickVersion)
if qmlViewer!=None:
qmlViewerPath = os.path.dirname(qmlViewer)
qmlViewer = os.path.basename(qmlViewer)