Commit d101a360 authored by Christian Stenger's avatar Christian Stenger

Squish: Fix hook into QtQuick and QtQuick UI

Change-Id: I168ee74464cfc1ae9efbd69f8e0f3cb10cbbf2d4
Reviewed-by: default avatarRobert Loehning <robert.loehning@digia.com>
parent d388d929
......@@ -104,32 +104,43 @@ def modifyRunSettingsForHookIntoQtQuickUI(kitCount, workingDir, projectName, por
"window=':Qt Creator_Core::Internal::MainWindow' "
"leftWidget={type='QLabel' text~='Us(e|ing) <b>Build Environment</b>'"
" unnamed='1' visible='1'}}"))
row = 0
for varName in ("PATH", "SQUISH_LIBQTDIR"):
__addVariableToRunEnvironment__(varName, qtLibPath, row)
row = row + 1
__addVariableToRunEnvironment__(varName, qtLibPath)
if not platform.system() in ('Microsoft', 'Windows', 'Darwin'):
__addVariableToRunEnvironment__("LD_LIBRARY_PATH", qtLibPath, 0)
__addVariableToRunEnvironment__("LD_LIBRARY_PATH", qtLibPath)
if platform.system() == "Darwin":
__addVariableToRunEnvironment__("DYLD_FRAMEWORK_PATH", qtLibPath, 0)
__addVariableToRunEnvironment__("DYLD_FRAMEWORK_PATH", qtLibPath)
if not platform.system() in ('Microsoft', 'Windows'):
__addVariableToRunEnvironment__("DISPLAY", ":0.0", 0)
__addVariableToRunEnvironment__("DISPLAY", ":0.0")
result = qmlViewer
switchViewTo(ViewConstants.EDIT)
return result
# this helper method must be called on the run settings page of a Qt Quick UI with DetailsWidget
# for the run settings already opened - it won't work on other views because of a different layout
def __addVariableToRunEnvironment__(name, value, row):
def __addVariableToRunEnvironment__(name, value):
clickButton(waitForObject("{text='Add' type='QPushButton' unnamed='1' visible='1' "
"container={window=':Qt Creator_Core::Internal::MainWindow' "
"type='Utils::DetailsWidget' unnamed='1' visible='1' occurrence='2'}}"))
varNameLineEd = waitForObject("{type='QExpandingLineEdit' visible='1' unnamed='1'}")
replaceEditorContent(varNameLineEd, name)
type(varNameLineEd, "<Return>")
row = getTableRowOf(name, ":Qt Creator_QTableView")
if row == -1:
test.fatal("Could not find entered variable name inside table - skipping entering value.")
return
valueLineEd = __doubleClickQTableView__(":Qt Creator_QTableView", row, 1)
replaceEditorContent(valueLineEd, value)
type(valueLineEd, "<Return>")
def getTableRowOf(value, table):
tblModel = waitForObject(table).model()
items = dumpItems(tblModel)
if value in items:
return items.index(value)
else:
return -1
def __getMkspecFromQMakeConf__(qmakeConf):
if qmakeConf==None or not os.path.exists(qmakeConf):
return None
......@@ -303,6 +314,7 @@ def __configureFW__(workingDir, projectName, isReleaseBuild, addToFW=True):
else:
mode = "delete"
enable = ""
projectName = ""
return subprocess.call('netsh firewall %s allowedprogram "%s.exe" %s %s' % (mode, path, projectName, enable))
# helper to check whether win firewall is running or not
......
......@@ -386,8 +386,33 @@ def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefT
try:
attachToApplication(executable)
except:
test.warning("Could not attach to '%s' - using fallback of pushing STOP inside Creator." % executable)
resetApplicationContextToCreator()
if "Loading Qt Wrapper failed" in str(output.plainText):
test.warning("Loading of Qt Wrapper failed - probably different Qt versions.",
"Resetting hook-into settings to continue.")
# 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"
else:
selectConfig = executable
selectFromCombo(waitForObject("{buddy={text='Run configuration:' type='QLabel' "
"unnamed='1' visible='1'} type='QComboBox' unnamed='1' "
"visible='1'}"), selectConfig)
switchViewTo(ViewConstants.EDIT)
global processStarted
processStarted = False
runButton = waitForObject("{type='Core::Internal::FancyToolButton' text='Run' "
"visible='1'}")
clickButton(runButton)
if not waitFor("processStarted == True", 10000):
test.fatal("Something seems to be really wrong.", "Application output:"
% str(output.plainText))
return False
else:
test.log("Application seems to be started without hooking-into.")
else:
test.warning("Could not attach to '%s' - using fallback of pushing STOP inside Creator." % executable)
__closeSubprocessByPushingStop__(sType)
return False
if function == None:
......
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