Commit 4b4e5f69 authored by Christian Stenger's avatar Christian Stenger

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: default avatarRobert Loehning <robert.loehning@digia.com>
parent fe86e1ba
...@@ -85,7 +85,7 @@ def batchEditRunEnvironment(kitCount, currentTarget, modifications, alreadyOnRun ...@@ -85,7 +85,7 @@ def batchEditRunEnvironment(kitCount, currentTarget, modifications, alreadyOnRun
clickButton(waitForObject("{text='OK' type='QPushButton' unnamed='1' visible='1' " clickButton(waitForObject("{text='OK' type='QPushButton' unnamed='1' visible='1' "
"window=':Edit Environment_ProjectExplorer::EnvironmentItemsDialog'}")) "window=':Edit Environment_ProjectExplorer::EnvironmentItemsDialog'}"))
def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, port): def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, port, quickVersion=1):
switchViewTo(ViewConstants.PROJECTS) switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(kitCount, 0, ProjectSettings.RUN, True) switchToBuildOrRunSettingsFor(kitCount, 0, ProjectSettings.RUN, True)
...@@ -102,12 +102,15 @@ def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, por ...@@ -102,12 +102,15 @@ def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, por
"Using fallback of pushing STOP inside Creator.") "Using fallback of pushing STOP inside Creator.")
return None return None
test.log("Using (QtVersion/mkspec) %s/%s with SquishPath %s" % (qtVersion, mkspec, squishPath)) test.log("Using (QtVersion/mkspec) %s/%s with SquishPath %s" % (qtVersion, mkspec, squishPath))
if quickVersion == 1:
if platform.system() == "Darwin": if platform.system() == "Darwin":
qmlViewer = os.path.abspath(os.path.dirname(qmake) + "/QMLViewer.app") executable = os.path.abspath(os.path.dirname(qmake) + "/QMLViewer.app")
else: else:
qmlViewer = os.path.abspath(os.path.dirname(qmake) + "/qmlviewer") executable = os.path.abspath(os.path.dirname(qmake) + "/qmlviewer")
else:
executable = os.path.abspath(os.path.dirname(qmake) + "/qmlscene")
if platform.system() in ('Microsoft', 'Windows'): if platform.system() in ('Microsoft', 'Windows'):
qmlViewer = qmlViewer + ".exe" executable = executable + ".exe"
addRunConfig = waitForObject("{container={window=':Qt Creator_Core::Internal::MainWindow' " addRunConfig = waitForObject("{container={window=':Qt Creator_Core::Internal::MainWindow' "
"type='ProjectExplorer::Internal::RunSettingsWidget' unnamed='1' " "type='ProjectExplorer::Internal::RunSettingsWidget' unnamed='1' "
"visible='1'} occurrence='2' text='Add' type='QPushButton' " "visible='1'} occurrence='2' text='Add' type='QPushButton' "
...@@ -129,7 +132,7 @@ def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, por ...@@ -129,7 +132,7 @@ def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, por
projectPath = os.path.abspath("%s/%s" % (workingDir, projectName)) projectPath = os.path.abspath("%s/%s" % (workingDir, projectName))
replaceEditorContent(exeLineEd, startAUT) replaceEditorContent(exeLineEd, startAUT)
replaceEditorContent(argLineEd, "--verbose --port=%d %s %s.qml" replaceEditorContent(argLineEd, "--verbose --port=%d %s %s.qml"
% (port, qmlViewer, projectName)) % (port, executable, projectName))
replaceEditorContent(wdLineEd, projectPath) replaceEditorContent(wdLineEd, projectPath)
clickButton(waitForObject("{text='Details' type='Utils::DetailsButton' unnamed='1' visible='1' " clickButton(waitForObject("{text='Details' type='Utils::DetailsButton' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow' " "window=':Qt Creator_Core::Internal::MainWindow' "
...@@ -144,7 +147,7 @@ def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, por ...@@ -144,7 +147,7 @@ def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, por
if not platform.system() in ('Microsoft', 'Windows'): if not platform.system() in ('Microsoft', 'Windows'):
if not os.getenv("DISPLAY"): if not os.getenv("DISPLAY"):
__addVariableToRunEnvironment__("DISPLAY", ":0.0") __addVariableToRunEnvironment__("DISPLAY", ":0.0")
result = qmlViewer result = executable
switchViewTo(ViewConstants.EDIT) switchViewTo(ViewConstants.EDIT)
return result return result
...@@ -155,6 +158,7 @@ def __addVariableToRunEnvironment__(name, value): ...@@ -155,6 +158,7 @@ def __addVariableToRunEnvironment__(name, value):
"container={window=':Qt Creator_Core::Internal::MainWindow' " "container={window=':Qt Creator_Core::Internal::MainWindow' "
"type='Utils::DetailsWidget' unnamed='1' visible='1' occurrence='2'}}")) "type='Utils::DetailsWidget' unnamed='1' visible='1' occurrence='2'}}"))
varNameLineEd = waitForObject("{type='QExpandingLineEdit' visible='1' unnamed='1'}") varNameLineEd = waitForObject("{type='QExpandingLineEdit' visible='1' unnamed='1'}")
doubleClick(varNameLineEd)
replaceEditorContent(varNameLineEd, name) replaceEditorContent(varNameLineEd, name)
type(varNameLineEd, "<Return>") type(varNameLineEd, "<Return>")
row = getTableRowOf(name, ":Qt Creator_QTableView") row = getTableRowOf(name, ":Qt Creator_QTableView")
......
...@@ -139,6 +139,23 @@ def __createProjectSetNameAndPath__(path, projectName = None, checks = True): ...@@ -139,6 +139,23 @@ def __createProjectSetNameAndPath__(path, projectName = None, checks = True):
clickButton(waitForObject(":Next_QPushButton")) clickButton(waitForObject(":Next_QPushButton"))
return str(projectName) 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 # Selects the Qt versions for a project
# param checks turns tests in the function on if set to True # param checks turns tests in the function on if set to True
# param available a list holding the available targets # param available a list holding the available targets
...@@ -234,35 +251,26 @@ def createProject_Qt_Console(path, projectName, checks = True): ...@@ -234,35 +251,26 @@ def createProject_Qt_Console(path, projectName, checks = True):
__verifyFileCreation__(path, expectedFiles) __verifyFileCreation__(path, expectedFiles)
return checkedTargets return checkedTargets
def createNewQtQuickApplication(workingDir, projectName = None, templateFile = None, def createNewQtQuickApplication(workingDir, projectName = None,
targets=Targets.desktopTargetClasses(), qtQuickVersion=1, targets=Targets.desktopTargetClasses(), qtQuickVersion=1,
fromWelcome=False): fromWelcome=False, withControls=False):
if templateFile: available = __createProjectOrFileSelectType__(" Applications", "Qt Quick Application", fromWelcome)
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)
projectName = __createProjectSetNameAndPath__(workingDir, projectName) projectName = __createProjectSetNameAndPath__(workingDir, projectName)
if templateFile: __createProjectHandleQtQuickSelection__(qtQuickVersion, withControls)
baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}")
type(baseLineEd, templateFile)
nextButton = waitForObject(":Next_QPushButton")
clickButton(nextButton)
checkedTargets = __chooseTargets__(targets, available) checkedTargets = __chooseTargets__(targets, available)
snooze(1) snooze(1)
nextButton = waitForObject(":Next_QPushButton") clickButton(waitForObject(":Next_QPushButton"))
clickButton(nextButton)
__createProjectHandleLastPage__() __createProjectHandleLastPage__()
progressBarWait(10000) progressBarWait(10000)
return checkedTargets, projectName return checkedTargets, projectName
def createNewQtQuickUI(workingDir, qtQuickVersion=1): def createNewQtQuickUI(workingDir, qtQuickVersion=1, withControls=False):
__createProjectOrFileSelectType__(" Applications", "Qt Quick %d UI" % qtQuickVersion) __createProjectOrFileSelectType__(" Applications", "Qt Quick UI")
if workingDir == None: if workingDir == None:
workingDir = tempDir() workingDir = tempDir()
projectName = __createProjectSetNameAndPath__(workingDir) projectName = __createProjectSetNameAndPath__(workingDir)
__createProjectHandleQtQuickSelection__(qtQuickVersion, withControls)
__createProjectHandleLastPage__() __createProjectHandleLastPage__()
return projectName return projectName
...@@ -443,6 +451,9 @@ def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefT ...@@ -443,6 +451,9 @@ def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefT
# assuming we're still on the build settings of the current project (TODO) # assuming we're still on the build settings of the current project (TODO)
switchViewTo(ViewConstants.PROJECTS) switchViewTo(ViewConstants.PROJECTS)
if sType == SubprocessType.QT_QUICK_UI: if sType == SubprocessType.QT_QUICK_UI:
if "qmlscene" in executable:
selectConfig = "QML Scene"
else:
selectConfig = "QML Viewer" selectConfig = "QML Viewer"
else: else:
selectConfig = executable selectConfig = executable
......
...@@ -35,8 +35,8 @@ searchFinished = False ...@@ -35,8 +35,8 @@ searchFinished = False
def main(): def main():
global templateDir global templateDir
sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/keyinteraction/focus") sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/keyinteraction/focus")
qmlFile = os.path.join("qml", "focus.qml") proFile = "focus.pro"
if not neededFilePresent(os.path.join(sourceExample, qmlFile)): if not neededFilePresent(os.path.join(sourceExample, proFile)):
return return
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
...@@ -45,8 +45,8 @@ def main(): ...@@ -45,8 +45,8 @@ def main():
addHelpDocumentation([os.path.join(sdkPath, "Documentation", "qt.qch")]) addHelpDocumentation([os.path.join(sdkPath, "Documentation", "qt.qch")])
templateDir = prepareTemplate(sourceExample) templateDir = prepareTemplate(sourceExample)
installLazySignalHandler("{type='Core::FutureProgress' unnamed='1'}", "finished()", "__handleFutureProgress__") installLazySignalHandler("{type='Core::FutureProgress' unnamed='1'}", "finished()", "__handleFutureProgress__")
# using a temporary directory won't mess up a potentially existing openQmakeProject(os.path.join(templateDir,proFile))
createNewQtQuickApplication(tempDir(), "untitled", os.path.join(templateDir, qmlFile)) openDocument("focus.QML.qml.focus\\.qml")
testRenameId() testRenameId()
testFindUsages() testFindUsages()
testHovering() testHovering()
...@@ -68,7 +68,7 @@ def testRenameId(): ...@@ -68,7 +68,7 @@ def testRenameId():
# although used objectMap.realName() for both # although used objectMap.realName() for both
formerTxt = editor.plainText formerTxt = editor.plainText
for file in files: for file in files:
doubleClickFile(navTree, file) openDocument("focus.QML.qml.%s" % file)
# wait until editor content switched to the double-clicked file # wait until editor content switched to the double-clicked file
while formerTxt==editor.plainText: while formerTxt==editor.plainText:
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
...@@ -93,7 +93,7 @@ def testRenameId(): ...@@ -93,7 +93,7 @@ def testRenameId():
# store editor content for synchronizing purpose # store editor content for synchronizing purpose
formerTxt = editor.plainText formerTxt = editor.plainText
for file in files: for file in files:
doubleClickFile(navTree, file) openDocument("focus.QML.qml.%s" % file)
# wait until editor content switched to double-clicked file # wait until editor content switched to double-clicked file
while formerTxt==editor.plainText: while formerTxt==editor.plainText:
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
...@@ -105,7 +105,7 @@ def testRenameId(): ...@@ -105,7 +105,7 @@ def testRenameId():
def __invokeFindUsage__(treeView, filename, line, additionalKeyPresses, expectedCount): def __invokeFindUsage__(treeView, filename, line, additionalKeyPresses, expectedCount):
global searchFinished global searchFinished
doubleClickFile(treeView, filename) openDocument("focus.QML.qml.%s" % filename)
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
if not placeCursorToLine(editor, line, True): if not placeCursorToLine(editor, line, True):
test.fatal("File seems to have changed... Canceling current test") test.fatal("File seems to have changed... Canceling current test")
...@@ -133,7 +133,7 @@ def testHovering(): ...@@ -133,7 +133,7 @@ def testHovering():
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' " navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}") "window=':Qt Creator_Core::Internal::MainWindow'}")
test.log("Testing hovering elements") test.log("Testing hovering elements")
doubleClickFile(navTree, "focus\\.qml") openDocument("focus.QML.qml.focus\\.qml")
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
lines=["FocusScope\s*\{", "Rectangle\s*\{"] lines=["FocusScope\s*\{", "Rectangle\s*\{"]
if platform.system() == "Darwin": if platform.system() == "Darwin":
...@@ -151,7 +151,7 @@ def testHovering(): ...@@ -151,7 +151,7 @@ def testHovering():
alternativeValues = [{"text":"FocusScope"}, {"text":"Rectangle"}] alternativeValues = [{"text":"FocusScope"}, {"text":"Rectangle"}]
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues) verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
test.log("Testing hovering properties") test.log("Testing hovering properties")
doubleClickFile(navTree, "focus\\.qml") openDocument("focus.QML.qml.focus\\.qml")
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
lines = ['focus:\s*true', 'color:\s*"black"', 'states:\s*State\s*\{', 'transitions:\s*Transition\s*\{'] lines = ['focus:\s*true', 'color:\s*"black"', 'states:\s*State\s*\{', 'transitions:\s*Transition\s*\{']
expectedTypes = ["TextTip", "TextTip", "TextTip", "TextTip"] expectedTypes = ["TextTip", "TextTip", "TextTip", "TextTip"]
...@@ -171,7 +171,7 @@ def testHovering(): ...@@ -171,7 +171,7 @@ def testHovering():
alternativeValues = [{"text":"boolean"}, {"text":"string"}, {"text":"State"}, {"text":"Transition"}] alternativeValues = [{"text":"boolean"}, {"text":"string"}, {"text":"State"}, {"text":"Transition"}]
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues) verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
test.log("Testing hovering expressions") test.log("Testing hovering expressions")
doubleClickFile(navTree, "focus\\.qml") openDocument("focus.QML.qml.focus\\.qml")
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
lines=['color:\s*"black"', 'color:\s*"#3E606F"'] lines=['color:\s*"black"', 'color:\s*"#3E606F"']
additionalKeyPresses = ["<Left>"] additionalKeyPresses = ["<Left>"]
...@@ -179,7 +179,7 @@ def testHovering(): ...@@ -179,7 +179,7 @@ def testHovering():
alternativeValues = [None, "#39616B"] alternativeValues = [None, "#39616B"]
expectedTypes = ["ColorTip", "ColorTip"] expectedTypes = ["ColorTip", "ColorTip"]
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues) 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") editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
lines=['Rectangle\s*\{.*color:\s*"#D1DBBD"', 'NumberAnimation\s*\{\s*.*Easing.OutQuint\s*\}'] lines=['Rectangle\s*\{.*color:\s*"#D1DBBD"', 'NumberAnimation\s*\{\s*.*Easing.OutQuint\s*\}']
additionalKeyPresses = ["<Left>", "<Left>", "<Left>", "<Left>"] additionalKeyPresses = ["<Left>", "<Left>", "<Left>", "<Left>"]
...@@ -188,12 +188,6 @@ def testHovering(): ...@@ -188,12 +188,6 @@ def testHovering():
alternativeValues = ["#D6DBBD", None] alternativeValues = ["#D6DBBD", None]
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues) 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): def __getUnmaskedFilename__(maskedFilename):
name = maskedFilename.split("\\.") name = maskedFilename.split("\\.")
path = name[0].rsplit(".", 1) path = name[0].rsplit(".", 1)
......
...@@ -7,6 +7,6 @@ HOOK_SUB_PROCESSES=false ...@@ -7,6 +7,6 @@ HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0 IMPLICITAUTSTART=0
LANGUAGE=Python LANGUAGE=Python
OBJECTMAP=../objects.map 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 VERSION=2
WRAPPERS=Qt WRAPPERS=Qt
...@@ -52,7 +52,9 @@ def main(): ...@@ -52,7 +52,9 @@ def main():
result = addExecutableAsAttachableAUT(projectName, 11223) result = addExecutableAsAttachableAUT(projectName, 11223)
allowAppThroughWinFW(workingDir, projectName) allowAppThroughWinFW(workingDir, projectName)
if result: 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: else:
result = runAndCloseApp(sType=SubprocessType.QT_QUICK_APPLICATION) result = runAndCloseApp(sType=SubprocessType.QT_QUICK_APPLICATION)
removeExecutableAsAttachableAUT(projectName, 11223) removeExecutableAsAttachableAUT(projectName, 11223)
...@@ -65,8 +67,15 @@ def main(): ...@@ -65,8 +67,15 @@ def main():
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
def subprocessFunction(): def subprocessFunctionGenericQuick(quickVersion):
helloWorldText = waitForObject("{container={type='QmlApplicationViewer' visible='1' unnamed='1'} " helloWorldText = waitForObject("{container={type='QtQuick%dApplicationViewer' visible='1' "
"enabled='true' text='Hello World' type='Text' unnamed='1' visible='true'}") "unnamed='1'} enabled='true' text='Hello World' type='Text' "
test.log("Clicking 'Hello World' Text to close QmlApplicationViewer") "unnamed='1' visible='true'}" % quickVersion)
test.log("Clicking 'Hello World' Text to close QtQuick%dApplicationViewer" % quickVersion)
mouseClick(helloWorldText, 5, 5, 0, Qt.LeftButton) mouseClick(helloWorldText, 5, 5, 0, Qt.LeftButton)
def subprocessFunctionQuick1():
subprocessFunctionGenericQuick(1)
def subprocessFunctionQuick2():
subprocessFunctionGenericQuick(2)
#############################################################################
##
## 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'}")
...@@ -38,7 +38,7 @@ def main(): ...@@ -38,7 +38,7 @@ def main():
workingDir = tempDir() workingDir = tempDir()
projectName = createNewQtQuickUI(workingDir, quickVersion) projectName = createNewQtQuickUI(workingDir, quickVersion)
test.log("Running project Qt Quick %d UI" % 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: if qmlViewer!=None:
qmlViewerPath = os.path.dirname(qmlViewer) qmlViewerPath = os.path.dirname(qmlViewer)
qmlViewer = os.path.basename(qmlViewer) qmlViewer = os.path.basename(qmlViewer)
......
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