Commit e465a176 authored by Robert Loehning's avatar Robert Loehning Committed by Robert Löhning

Squish: Added function ensureChecked

Change-Id: Icca18645613d0b88e4394aa5fc3820626a59e647
Reviewed-by: default avatarBill King <bill.king@nokia.com>
Reviewed-by: default avatarChristian Stenger <christian.stenger@nokia.com>
parent ed2458a8
......@@ -70,10 +70,8 @@ def checkLastBuild(expectedToFail=False):
else:
test.fail("Errors: %s | Warnings: %s" % (errors, warnings))
# additional stuff - could be removed... or improved :)
toggleIssues = waitForObject("{type='Core::Internal::OutputPaneToggleButton' unnamed='1' "
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
if not toggleIssues.checked:
clickButton(toggleIssues)
ensureChecked("{type='Core::Internal::OutputPaneToggleButton' unnamed='1' "
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
list=waitForObject("{type='QListView' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'}", 20000)
model = list.model()
......@@ -84,10 +82,8 @@ def checkLastBuild(expectedToFail=False):
# helper function to check the compilation when build wasn't successful
def checkCompile():
toggleCompOutput = waitForObject("{type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow' occurrence='4'}", 20000)
if not toggleCompOutput.checked:
clickButton(toggleCompOutput)
ensureChecked("{type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow' occurrence='4'}")
output = waitForObject("{type='Core::OutputWindow' unnamed='1' visible='1' windowTitle='Compile Output'"
" window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
waitFor("len(str(output.plainText))>0",5000)
......
......@@ -75,9 +75,7 @@ def __createProjectSetNameAndPath__(path, projectName = None, checks = True):
labelCheck = stateLabel.text=="" and stateLabel.styleSheet == ""
test.verify(labelCheck, "Project name and base directory without warning or error")
# make sure this is not set as default location
cbDefaultLocation = waitForObject("{type='QCheckBox' name='projectsDirectoryCheckBox' visible='1'}", 20000)
if cbDefaultLocation.checked:
clickButton(cbDefaultLocation)
ensureChecked("{type='QCheckBox' name='projectsDirectoryCheckBox' visible='1'}", False)
clickButton(waitForObject(":Next_QPushButton"))
return projectName
......
......@@ -66,20 +66,17 @@ def __chooseComponents__(components=QtQuickConstants.Components.BUILTIN):
# parameter target can be an OR'd value of QtQuickConstants.Targets
def __chooseTargets__(targets=QtQuickConstants.Targets.DESKTOP):
# DESKTOP should be always accessible
destDesktop = waitForObject("{type='QCheckBox' text='%s' visible='1'}"
% QtQuickConstants.getStringForTarget(QtQuickConstants.Targets.DESKTOP), 20000)
mustCheck = targets & QtQuickConstants.Targets.DESKTOP==QtQuickConstants.Targets.DESKTOP
if (mustCheck ^ destDesktop.checked):
clickButton(destDesktop)
ensureChecked("{type='QCheckBox' text='%s' visible='1'}"
% QtQuickConstants.getStringForTarget(QtQuickConstants.Targets.DESKTOP),
targets & QtQuickConstants.Targets.DESKTOP)
# following targets depend on the build environment - added for further/later tests
available = [QtQuickConstants.Targets.SYMBIAN, QtQuickConstants.Targets.MAEMO5,
QtQuickConstants.Targets.SIMULATOR, QtQuickConstants.Targets.HARMATTAN]
for current in available:
mustCheck = targets & current == current
try:
targetCheckbox = findObject("{type='QCheckBox' text='%s' visible='1'}" % QtQuickConstants.getStringForTarget(current))
if mustCheck ^ targetCheckbox.checked:
clickButton(targetCheckbox)
ensureChecked("{type='QCheckBox' text='%s' visible='1'}" % QtQuickConstants.getStringForTarget(current),
mustCheck)
except LookupError:
if mustCheck:
test.fail("Failed to check target '%s'" % QtQuickConstants.getStringForTarget(current))
......@@ -103,8 +100,7 @@ def runAndCloseApp():
invokeMenuItem("File", "Exit")
return False
# the following is currently a work-around for not using hooking into subprocesses
if (waitForObject(":Qt Creator_Core::Internal::OutputPaneToggleButton").checked!=True):
clickButton(":Qt Creator_Core::Internal::OutputPaneToggleButton")
ensureChecked(":Qt Creator_Core::Internal::OutputPaneToggleButton")
playButton = verifyEnabled(":Qt Creator.ReRun_QToolButton", False)
stopButton = verifyEnabled(":Qt Creator.Stop_QToolButton")
clickButton(stopButton)
......@@ -121,8 +117,7 @@ def runAndCloseQtQuickUI():
clickButton(runButton)
waitFor("processStarted==True", 10000)
# the following is currently a work-around for not using hooking into subprocesses
if (waitForObject(":Qt Creator_Core::Internal::OutputPaneToggleButton").checked!=True):
clickButton(":Qt Creator_Core::Internal::OutputPaneToggleButton")
ensureChecked(":Qt Creator_Core::Internal::OutputPaneToggleButton")
stop = findObject(":Qt Creator.Stop_QToolButton")
waitFor("stop.enabled==True")
clickButton(stop)
......
......@@ -20,6 +20,12 @@ def verifyChecked(objectName):
test.compare(object.checked, True)
return object
def ensureChecked(objectName, shouldBeChecked = True):
object = waitForObject(objectName, 20000)
if object.checked ^ shouldBeChecked:
clickButton(object)
return object
def verifyEnabled(objectName, expectedState = True):
waitFor("object.exists('" + objectName + "')", 20000)
object = findObject(objectName)
......@@ -141,9 +147,7 @@ def invokeMenuItem(menu, item):
def logApplicationOutput():
# make sure application output is shown
toggleAppOutput = waitForObject("{type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow' occurrence='3'}", 20000)
if not toggleAppOutput.checked:
clickButton(toggleAppOutput)
ensureChecked("{type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow' occurrence='3'}")
output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}", 20000)
test.log("Application Output:\n%s" % output.plainText)
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