Squish: Update Qt Quick tests to reflect new available versions

Change-Id: I60d4b2ca64825101358774a4e04cceb3040fc630
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
This commit is contained in:
Christian Stenger
2014-02-14 13:04:07 +01:00
parent fb0bc00670
commit ae781b1919
6 changed files with 29 additions and 24 deletions

View File

@@ -136,13 +136,13 @@ class SubprocessType:
USER_DEFINED=3 USER_DEFINED=3
@staticmethod @staticmethod
def getWindowType(subprocessType, qtQuickVersion=1): def getWindowType(subprocessType, qtQuickVersion="1.1"):
if subprocessType == SubprocessType.QT_WIDGET: if subprocessType == SubprocessType.QT_WIDGET:
return "QMainWindow" return "QMainWindow"
if subprocessType == SubprocessType.QT_QUICK_APPLICATION: if subprocessType == SubprocessType.QT_QUICK_APPLICATION:
return "QtQuick%dApplicationViewer" % qtQuickVersion return "QtQuick%sApplicationViewer" % qtQuickVersion[0]
if subprocessType == SubprocessType.QT_QUICK_UI: if subprocessType == SubprocessType.QT_QUICK_UI:
if qtQuickVersion == 1: if qtQuickVersion == "1.1":
return "QDeclarativeViewer" return "QDeclarativeViewer"
else: else:
return "QQuickView" return "QQuickView"

View File

@@ -90,7 +90,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, quickVersion=1): def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, port, quickVersion="1.1"):
switchViewTo(ViewConstants.PROJECTS) switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(kitCount, 0, ProjectSettings.RUN, True) switchToBuildOrRunSettingsFor(kitCount, 0, ProjectSettings.RUN, True)
@@ -107,7 +107,7 @@ 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 quickVersion == "1.1":
if platform.system() == "Darwin": if platform.system() == "Darwin":
executable = os.path.abspath(os.path.dirname(qmake) + "/QMLViewer.app") executable = os.path.abspath(os.path.dirname(qmake) + "/QMLViewer.app")
else: else:

View File

@@ -129,19 +129,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): def __createProjectHandleQtQuickSelection__(qtQuickVersion, controlsVersion):
comboBox = waitForObject("{type='QComboBox' unnamed='1' visible='1' " comboBox = waitForObject("{type='QComboBox' unnamed='1' visible='1' "
"leftWidget={text='Qt Quick component set:' type='QLabel' unnamed='1' " "leftWidget={text='Qt Quick component set:' type='QLabel' unnamed='1' "
"visible='1'}}") "visible='1'}}")
if qtQuickVersion == 1: if qtQuickVersion == "1.1":
selectFromCombo(comboBox, "Qt Quick 1.1") selectFromCombo(comboBox, "Qt Quick 1.1")
if withControls: if controlsVersion:
test.warning("Controls are not available for Quick 1.") test.warning("Controls are not available for Quick 1.")
elif qtQuickVersion == 2: elif qtQuickVersion[:2] == "2.":
if withControls: if controlsVersion:
selectFromCombo(comboBox, "Qt Quick Controls 1.0") if controlsVersion in ("1.0", "1.1"):
selectFromCombo(comboBox, "Qt Quick Controls %s" % controlsVersion)
else:
test.fatal("Got unknown Qt Quick Controls version: %s - trying to continue."
% str(controlsVersion))
else: else:
selectFromCombo(comboBox, "Qt Quick 2.0") selectFromCombo(comboBox, "Qt Quick %s" % qtQuickVersion)
else: else:
test.fatal("Got unknown Qt Quick version: %s - trying to continue." % str(qtQuickVersion)) test.fatal("Got unknown Qt Quick version: %s - trying to continue." % str(qtQuickVersion))
label = waitForObject("{type='QLabel' unnamed='1' visible='1' text?='Creates a *' }") label = waitForObject("{type='QLabel' unnamed='1' visible='1' text?='Creates a *' }")
@@ -269,11 +273,11 @@ def createProject_Qt_Console(path, projectName, checks = True):
return checkedTargets return checkedTargets
def createNewQtQuickApplication(workingDir, projectName = None, def createNewQtQuickApplication(workingDir, projectName = None,
targets=Targets.desktopTargetClasses(), qtQuickVersion=1, targets=Targets.desktopTargetClasses(), qtQuickVersion="1.1",
fromWelcome=False, withControls=False): fromWelcome=False, controlsVersion=None):
available = __createProjectOrFileSelectType__(" Applications", "Qt Quick Application", fromWelcome) available = __createProjectOrFileSelectType__(" Applications", "Qt Quick Application", fromWelcome)
projectName = __createProjectSetNameAndPath__(workingDir, projectName) projectName = __createProjectSetNameAndPath__(workingDir, projectName)
requiredQt = __createProjectHandleQtQuickSelection__(qtQuickVersion, withControls) requiredQt = __createProjectHandleQtQuickSelection__(qtQuickVersion, controlsVersion)
__modifyAvailableTargets__(available, requiredQt) __modifyAvailableTargets__(available, requiredQt)
checkedTargets = __chooseTargets__(targets, available) checkedTargets = __chooseTargets__(targets, available)
snooze(1) snooze(1)
@@ -283,12 +287,12 @@ def createNewQtQuickApplication(workingDir, projectName = None,
progressBarWait(10000) progressBarWait(10000)
return checkedTargets, projectName return checkedTargets, projectName
def createNewQtQuickUI(workingDir, qtQuickVersion=1, withControls=False): def createNewQtQuickUI(workingDir, qtQuickVersion="1.1", controlsVersion=None):
__createProjectOrFileSelectType__(" Applications", "Qt Quick UI") __createProjectOrFileSelectType__(" Applications", "Qt Quick UI")
if workingDir == None: if workingDir == None:
workingDir = tempDir() workingDir = tempDir()
projectName = __createProjectSetNameAndPath__(workingDir) projectName = __createProjectSetNameAndPath__(workingDir)
__createProjectHandleQtQuickSelection__(qtQuickVersion, withControls) __createProjectHandleQtQuickSelection__(qtQuickVersion, controlsVersion)
__createProjectHandleLastPage__() __createProjectHandleLastPage__()
return projectName return projectName
@@ -399,7 +403,7 @@ def waitForProcessRunning(running=True):
# by yourself (or use the function parameter) # by yourself (or use the function parameter)
# ATTENTION! Make sure this function won't fail and the sub-process will end when the function returns # ATTENTION! Make sure this function won't fail and the sub-process will end when the function returns
# returns None if the build failed, False if the subprocess did not start, and True otherwise # returns None if the build failed, False if the subprocess did not start, and True otherwise
def runAndCloseApp(withHookInto=False, executable=None, port=None, function=None, sType=None, userDefinedType=None, quickVersion=1): def runAndCloseApp(withHookInto=False, executable=None, port=None, function=None, sType=None, userDefinedType=None, quickVersion="1.1"):
runButton = waitForObject(":*Qt Creator.Run_Core::Internal::FancyToolButton") runButton = waitForObject(":*Qt Creator.Run_Core::Internal::FancyToolButton")
clickButton(runButton) clickButton(runButton)
if sType != SubprocessType.QT_QUICK_UI: if sType != SubprocessType.QT_QUICK_UI:

View File

@@ -33,7 +33,7 @@ import re
def main(): def main():
global tmpSettingsDir global tmpSettingsDir
quickCombinations = [[1,False], [2,False], [2,True]] quickCombinations = [["1.1",None], ["2.1",None], ["2.2",None], ["2.1","1.0"], ["2.2","1.1"]]
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return

View File

@@ -33,12 +33,13 @@ def main():
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
for targ, qVer in {Targets.DESKTOP_480_GCC:1, Targets.DESKTOP_501_DEFAULT:2}.items(): # TODO provide Qt5.2/Qt5.1 to enable QtQuick2 testing
for targ, qVer in {Targets.DESKTOP_480_GCC:"1.1"}.items(): # Targets.DESKTOP_501_DEFAULT:2}.items():
# using a temporary directory won't mess up a potentially existing # using a temporary directory won't mess up a potentially existing
workingDir = tempDir() workingDir = tempDir()
checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targ, checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targ,
qtQuickVersion=qVer) qtQuickVersion=qVer)
test.log("Building project Qt Quick %d Application (%s)" test.log("Building project Qt Quick %s Application (%s)"
% (qVer, Targets.getStringForTarget(targ))) % (qVer, Targets.getStringForTarget(targ)))
result = modifyRunSettingsForHookInto(projectName, len(checkedTargets), 11223) result = modifyRunSettingsForHookInto(projectName, len(checkedTargets), 11223)
invokeMenuItem("Build", "Build All") invokeMenuItem("Build", "Build All")
@@ -53,7 +54,7 @@ def main():
allowAppThroughWinFW(workingDir, projectName) allowAppThroughWinFW(workingDir, projectName)
if result: if result:
result = runAndCloseApp(True, projectName, 11223, result = runAndCloseApp(True, projectName, 11223,
"subprocessFunctionQuick%d" % qVer, "subprocessFunctionQuick%s" % qVer[0],
SubprocessType.QT_QUICK_APPLICATION, quickVersion=qVer) SubprocessType.QT_QUICK_APPLICATION, quickVersion=qVer)
else: else:
result = runAndCloseApp(sType=SubprocessType.QT_QUICK_APPLICATION) result = runAndCloseApp(sType=SubprocessType.QT_QUICK_APPLICATION)

View File

@@ -33,11 +33,11 @@ def main():
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
for quickVersion in [1, 2]: for quickVersion in ["1.1"]:#, "2.1", "2.2"]: # TODO add Qt5.2 and/or Qt5.1 kit to enable these
# using a temporary directory won't mess up a potentially existing # using a temporary directory won't mess up a potentially existing
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 %s UI" % quickVersion)
qmlViewer = modifyRunSettingsForHookIntoQtQuickUI(1, workingDir, projectName, 11223, quickVersion) qmlViewer = modifyRunSettingsForHookIntoQtQuickUI(1, workingDir, projectName, 11223, quickVersion)
if qmlViewer!=None: if qmlViewer!=None:
qmlViewerPath = os.path.dirname(qmlViewer) qmlViewerPath = os.path.dirname(qmlViewer)