Commit 1cdb5d87 authored by Christian Stenger's avatar Christian Stenger
Browse files

Squish: Update Qt Quick hooking stuff...



...to differentiate between Qt Quick 1 and Qt Quick 2 when using
no additional function on the subprocess.

Change-Id: Ia345a1503128be0c5b81a010c438009bf41d93b5
Reviewed-by: default avatarRobert Loehning <robert.loehning@digia.com>
parent c567dabc
......@@ -136,13 +136,16 @@ class SubprocessType:
USER_DEFINED=3
@staticmethod
def getWindowType(subprocessType):
def getWindowType(subprocessType, qtQuickVersion=1):
if subprocessType == SubprocessType.QT_WIDGET:
return "QMainWindow"
if subprocessType == SubprocessType.QT_QUICK_APPLICATION:
return "QmlApplicationViewer"
return "QtQuick%dApplicationViewer" % qtQuickVersion
if subprocessType == SubprocessType.QT_QUICK_UI:
return "QDeclarativeViewer"
if qtQuickVersion == 1:
return "QDeclarativeViewer"
else:
return "QQuickView"
if subprocessType == SubprocessType.USER_DEFINED:
return "user-defined"
test.fatal("Could not determine the WindowType for SubprocessType %s" % subprocessType)
......
......@@ -397,7 +397,7 @@ def waitForProcessRunning(running=True):
# userDefinedType - if you set sType to SubprocessType.USER_DEFINED you must(!) specify the WindowType for hooking into
# 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
def runAndCloseApp(withHookInto=False, executable=None, port=None, function=None, sType=None, userDefinedType=None):
def runAndCloseApp(withHookInto=False, executable=None, port=None, function=None, sType=None, userDefinedType=None, quickVersion=1):
runButton = waitForObject(":*Qt Creator.Run_Core::Internal::FancyToolButton")
clickButton(runButton)
if sType != SubprocessType.QT_QUICK_UI:
......@@ -414,7 +414,7 @@ def runAndCloseApp(withHookInto=False, executable=None, port=None, function=None
return False
if sType == SubprocessType.QT_QUICK_UI and os.getenv("SYSTEST_QMLVIEWER_NO_HOOK_INTO", "0") == "1":
withHookInto = False
if withHookInto and not validType(sType, userDefinedType):
if withHookInto and not validType(sType, userDefinedType, quickVersion):
if function != None:
test.warning("You did not provide a valid value for the SubprocessType value - sType, but you have "
"provided a function to execute on the subprocess. Please ensure that your function "
......@@ -425,15 +425,15 @@ def runAndCloseApp(withHookInto=False, executable=None, port=None, function=None
"inside creator to terminate execution of the subprocess.")
withHookInto = False
if withHookInto and not executable in ("", None):
__closeSubprocessByHookingInto__(executable, port, function, sType, userDefinedType)
__closeSubprocessByHookingInto__(executable, port, function, sType, userDefinedType, quickVersion)
else:
__closeSubprocessByPushingStop__(sType)
return True
def validType(sType, userDef):
def validType(sType, userDef, quickVersion):
if sType == None:
return False
ty = SubprocessType.getWindowType(sType)
ty = SubprocessType.getWindowType(sType, quickVersion)
return ty != None and not (ty == "user-defined" and (userDef == None or userDef.strip() == ""))
def __closeSubprocessByPushingStop__(sType):
......@@ -455,7 +455,7 @@ def __closeSubprocessByPushingStop__(sType):
else:
test.fatal("Subprocess does not seem to have been started.")
def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefType):
def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefType, quickVersion):
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}")
if port == None:
......@@ -498,7 +498,7 @@ def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefT
if sType==SubprocessType.USER_DEFINED:
sendEvent("QCloseEvent", "{type='%s' unnamed='1' visible='1'}" % userDefType)
else:
sendEvent("QCloseEvent", "{type='%s' unnamed='1' visible='1'}" % SubprocessType.getWindowType(sType))
sendEvent("QCloseEvent", "{type='%s' unnamed='1' visible='1'}" % SubprocessType.getWindowType(sType, quickVersion))
resetApplicationContextToCreator()
else:
try:
......
......@@ -54,7 +54,7 @@ def main():
if result:
result = runAndCloseApp(True, projectName, 11223,
"subprocessFunctionQuick%d" % qVer,
SubprocessType.QT_QUICK_APPLICATION)
SubprocessType.QT_QUICK_APPLICATION, quickVersion=qVer)
else:
result = runAndCloseApp(sType=SubprocessType.QT_QUICK_APPLICATION)
removeExecutableAsAttachableAUT(projectName, 11223)
......
......@@ -45,7 +45,7 @@ def main():
result = addExecutableAsAttachableAUT(qmlViewer, 11223)
allowAppThroughWinFW(qmlViewerPath, qmlViewer, None)
if result:
result = runAndCloseApp(True, qmlViewer, 11223, sType=SubprocessType.QT_QUICK_UI)
result = runAndCloseApp(True, qmlViewer, 11223, sType=SubprocessType.QT_QUICK_UI, quickVersion=quickVersion)
else:
result = runAndCloseApp(sType=SubprocessType.QT_QUICK_UI)
removeExecutableAsAttachableAUT(qmlViewer, 11223)
......
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