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