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