Commit 106473c4 authored by Bill King's avatar Bill King Committed by Christian Stenger

Cleanup to use new waitForSignal function.

Change-Id: Id47c81fc3c2d4448f26dd2432b73286501be1e26
Reviewed-on: http://codereview.qt-project.org/5297Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarChristian Stenger <christian.stenger@nokia.com>
parent 226a11db
......@@ -8,10 +8,12 @@
:Build:_QComboBox {aboveWidget=':Desktop_QLabel' container=':QtCreator.MenuBar_ProjectExplorer::Internal::ProjectListWidget' leftWidget=':Build:_QLabel' type='QComboBox'}
:Build:_QLabel {container=':QtCreator.MenuBar_ProjectExplorer::Internal::ProjectListWidget' name='buildLabel' text='Build:' type='QLabel' visible='1'}
:CMake Wizard.Finish_QPushButton {text='Finish' type='QPushButton' unnamed='1' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'}
:CMake Wizard.Generator:_QLabel {text='Generator:' type='QLabel' unnamed='1' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'}
:CMake Wizard.Next_QPushButton {name='__qt__passive_wizardbutton1' text='Next' type='QPushButton' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'}
:CMake Wizard.Run CMake_QPushButton {text='Run CMake' type='QPushButton' unnamed='1' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'}
:CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard {type='CMakeProjectManager::Internal::CMakeOpenProjectWizard' unnamed='1' visible='1' windowTitle='CMake Wizard'}
:Desktop_QLabel {container=':QtCreator.MenuBar_ProjectExplorer::Internal::ProjectListWidget' name='target' text='Desktop' type='QLabel' visible='1'}
:Generator:_QComboBox {buddy=':CMake Wizard.Generator:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:Project Setup.scrollArea_QScrollArea {name='scrollArea' type='QScrollArea' visible='1' window=':Project Setup_Qt4ProjectManager::Internal::ProjectLoadWizard'}
:Project Setup_Qt4ProjectManager::Internal::ProjectLoadWizard {type='Qt4ProjectManager::Internal::ProjectLoadWizard' unnamed='1' visible='1' windowTitle='Project Setup'}
:Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
......
......@@ -2,10 +2,6 @@
installedSignalHandlers = {}
# flag to indicate whether overrideInstallLazySignalHandler() has been called already
overridenInstallLazySignalHandlers = False
# flag to indicate a finished build (has to be resetted before doing another build)
buildFinished = False
# flag to indicate a successful build
buildSucceeded = False
# flag to indicate whether a tasks file should be created when building ends with errors
createTasksFileOnError = True
# currently used directory for tasks files
......@@ -88,18 +84,6 @@ def checkLastBuild(expectedToFail=False):
createTasksFile(list)
return not gotErrors
# helper function used as handler for signal buildQueueFinished(bool) - see below
def handleBuildFinished(object, success):
global buildFinished, buildSucceeded
buildFinished = True
if success:
buildSucceeded = checkLastBuild()
else:
test.fatal("Build failed")
buildSucceeded = success
checkCompile()
checkLastBuild()
# helper function to check the compilation when build wasn't successful
def checkCompile():
toggleCompOutput = waitForObject("{type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' "
......@@ -114,13 +98,6 @@ def checkCompile():
else:
test.fatal("Compile Output:\n%s" % output.plainText)
# after starting to build an application this function can be used to synchronize the following tests
# make sure to set global variable buildFinished to False before starting to build
def waitForBuildFinished(timeOutMSeconds=30000):
overrideInstallLazySignalHandler()
installLazySignalHandler("{type='ProjectExplorer::BuildManager'}", "buildQueueFinished(bool)", "handleBuildFinished")
waitFor("buildFinished == True", timeOutMSeconds)
# helper method that parses the Build Issues output and writes a tasks file
def createTasksFile(list):
global tasksFileDir, tasksFileCount
......
......@@ -85,13 +85,14 @@ def chooseDestination(destination=QtQuickConstants.Destinations.DESKTOP):
test.fail("Failed to check destination '%s'" % QtQuickConstants.getStringForDestination(current))
def runAndCloseApp():
global buildSucceeded, buildFinished, processStarted, processExited
buildSucceeded = buildFinished = processStarted = processExited = False
global processStarted, processExited
processStarted = processExited = False
installLazySignalHandler("{type='ProjectExplorer::ApplicationLaucher'}", "processStarted()", "handleProcessStarted")
installLazySignalHandler("{type='ProjectExplorer::ApplicationLaucher'}", "processExited(int)", "handleProcessExited")
runButton = waitForObject("{type='Core::Internal::FancyToolButton' text='Run' visible='1'}", 20000)
clickButton(runButton)
waitForBuildFinished()
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
buildSucceeded = checkLastBuild()
waitFor("processStarted==True", 10000)
if not buildSucceeded:
test.log("Build inside run wasn't successful - leaving test")
......
......@@ -11,6 +11,7 @@ def main():
startApplication("qtcreator" + SettingsPath)
## leave this one like this, it's too fast for delayed installation of signal handler
installLazySignalHandler("{type='CppTools::Internal::CppModelManager'}", "sourceFilesRefreshed(QStringList)", "handleRefreshFinished")
openQmakeProject(SDKPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro")
......
......@@ -2,21 +2,12 @@ source("../../shared/qtcreator.py")
import re;
SpeedCrunchPath = ""
buildSucceeded = 0
buildFinished = False
refreshFinishedCount = 0
def handleRefreshFinished(object, fileList):
global refreshFinishedCount
refreshFinishedCount += 1
def main():
global buildSucceeded, buildFinished, refreshFinishedCount
test.verify(os.path.exists(SpeedCrunchPath))
startApplication("qtcreator" + SettingsPath)
installLazySignalHandler("{type='CppTools::Internal::CppModelManager'}", "sourceFilesRefreshed(QStringList)", "handleRefreshFinished")
openQmakeProject(SpeedCrunchPath)
waitFor("refreshFinishedCount == 1", 300000)
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000)
# Test that some of the expected items are in the navigation tree
for row, record in enumerate(testData.dataset("speedcrunch_tree.tsv")):
......@@ -24,8 +15,6 @@ def main():
value = testData.field(record, "value")
test.compare(waitForObject(node).text, value)
installLazySignalHandler("{type='CppTools::Internal::CppModelManager'}", "sourceFilesRefreshed(QStringList)", "handleRefreshFinished")
clickButton(waitForObject(":*Qt Creator_Core::Internal::FancyToolButton"))
buildCombo = waitForObject(":Build:_QComboBox")
sendEvent("QMouseEvent", waitForObject(":QtCreator.MenuBar_ProjectExplorer::Internal::MiniProjectTargetSelector"), QEvent.MouseButtonPress, -5, 5, Qt.LeftButton, 0)
......@@ -33,18 +22,19 @@ def main():
prog = re.compile("Qt.*Release")
for row in range(buildCombo.count):
if prog.match(str(buildCombo.itemText(row))):
refreshFinishedCount = 0;
clickButton(waitForObject(":*Qt Creator_Core::Internal::FancyToolButton"))
itemText = buildCombo.itemText(row);
test.log("Testing build configuration: "+str(itemText))
if str(itemText) != str(buildCombo.currentText):
buildCombo.setCurrentIndex(row)
sendEvent("QMouseEvent", waitForObject(":QtCreator.MenuBar_ProjectExplorer::Internal::MiniProjectTargetSelector"), QEvent.MouseButtonPress, -45, 64, Qt.LeftButton, 0)
waitFor("refreshFinishedCount == 1", 300000)
buildSucceeded = 0
buildFinished = False
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000)
invokeMenuItem("Build", "Run qmake")
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
invokeMenuItem("Build", "Rebuild All")
waitForBuildFinished(300000)
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
checkCompile()
checkLastBuild()
# Add a new run configuration
......
......@@ -13,7 +13,7 @@ def main():
openCmakeProject(SpeedCrunchPath)
waitFor("object.exists(':speedcrunch_QModelIndex')", 20000)
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000)
# Test that some of the expected items are in the navigation tree
for row, record in enumerate(testData.dataset("speedcrunch_tree.tsv")):
......@@ -25,7 +25,9 @@ def main():
invokeMenuItem("Build", "Rebuild All")
# Wait for, and test if the build succeeded
waitForBuildFinished(300000)
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
checkCompile()
checkLastBuild()
invokeMenuItem("File", "Exit")
......
source("../../shared/qtcreator.py")
refreshFinishedCount = 0
workingDir = None
def handleRefreshFinished(object, fileList):
global refreshFinishedCount
refreshFinishedCount += 1
def main():
global workingDir,buildFinished,buildSucceeded
global workingDir
startApplication("qtcreator" + SettingsPath)
installLazySignalHandler("{type='CppTools::Internal::CppModelManager'}", "sourceFilesRefreshed(QStringList)", "handleRefreshFinished")
# using a temporary directory won't mess up an eventually exisiting
workingDir = tempDir()
createNewQtQuickApplication()
# wait for parsing to complete
waitFor("refreshFinishedCount == 1", 10000)
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000)
test.log("Building project")
invokeMenuItem("Build","Build All")
waitForBuildFinished()
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
checkCompile()
checkLastBuild()
test.log("Running project (includes build)")
if runAndCloseApp():
logApplicationOutput()
......
source("../../shared/qtcreator.py")
refreshFinishedCount = 0
workingDir = None
templateDir = None
def handleRefreshFinished(object, fileList):
global refreshFinishedCount
refreshFinishedCount += 1
def main():
global workingDir,templateDir,buildFinished,buildSucceeded
global workingDir,templateDir
startApplication("qtcreator" + SettingsPath)
installLazySignalHandler("{type='CppTools::Internal::CppModelManager'}", "sourceFilesRefreshed(QStringList)", "handleRefreshFinished")
# using a temporary directory won't mess up an eventually exisiting
workingDir = tempDir()
prepareTemplate()
createNewQtQuickApplication()
# wait for parsing to complete
waitFor("refreshFinishedCount == 1", 10000)
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000)
test.log("Building project")
invokeMenuItem("Build","Build All")
waitForBuildFinished()
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
checkCompile()
checkLastBuild()
test.log("Running project (includes build)")
if runAndCloseApp():
logApplicationOutput()
......
source("../../shared/qtcreator.py")
refreshFinishedCount = 0
workingDir = None
def handleRefreshFinished(object, fileList):
global refreshFinishedCount
refreshFinishedCount += 1
def main():
global workingDir,buildFinished,buildSucceeded
global workingDir
startApplication("qtcreator" + SettingsPath)
# using a temporary directory won't mess up an eventually exisiting
workingDir = tempDir()
......
source("../../shared/qtcreator.py")
refreshFinishedCount = 0
workingDir = None
def handleRefreshFinished(object, fileList):
global refreshFinishedCount
refreshFinishedCount += 1
def main():
global workingDir,buildFinished,buildSucceeded
global workingDir
startApplication("qtcreator" + SettingsPath)
installLazySignalHandler("{type='CppTools::Internal::CppModelManager'}", "sourceFilesRefreshed(QStringList)", "handleRefreshFinished")
# using a temporary directory won't mess up an eventually exisiting
workingDir = tempDir()
createNewQmlExtension()
# wait for parsing to complete
waitFor("refreshFinishedCount == 1", 10000)
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000)
test.log("Building project")
invokeMenuItem("Build","Build All")
waitForBuildFinished()
if buildSucceeded:
checkCompile()
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
checkCompile()
checkLastBuild()
invokeMenuItem("File", "Exit")
def createNewQmlExtension():
......
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