diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py index 58728bcb0b2b832e7569a82a04599197ff3248e2..31421ca66f0a31bc2c9f2011de259e66c4ae4bcf 100644 --- a/tests/system/shared/build_utils.py +++ b/tests/system/shared/build_utils.py @@ -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) diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index fee725f7b127b59c026f390672e033a28777ddc3..dc620b245f30382a8b9f558fabc39dbc98bb5a28 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -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 diff --git a/tests/system/shared/qtquick.py b/tests/system/shared/qtquick.py index c5d3d56c173cf9d2c0fe774ce24d22c98df233dd..3db7a5ecc6441d830cd636b0d56d65af93018204 100644 --- a/tests/system/shared/qtquick.py +++ b/tests/system/shared/qtquick.py @@ -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) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 218df2813196de5e4b4b7d4cc0fc3e6e228b69dc..d42db116b6b061c7f961b86a6bb1fe87c461b83e 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -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)