Commit 507d260b authored by Bill King's avatar Bill King
Browse files

Fixes openProject, also tests multiple target selection and building.

Change-Id: I4a5aaea2eca940c3ffcf8458b5cc0afce591b63e
Reviewed-on: http://codereview.qt.nokia.com/3886

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarChristian Stenger <christian.stenger@nokia.com>
parent bbfa7e00
:*Qt Creator.Build Project_Core::Internal::FancyToolButton {text='Build Project' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator.Run_Core::Internal::FancyToolButton {text='Run' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator.findEdit_Utils::FilterLineEdit {name='findEdit' type='Utils::FilterLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator.qt_tabwidget_stackedwidget_QStackedWidget {name='qt_tabwidget_stackedwidget' type='QStackedWidget' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator_Core::Internal::FancyToolButton {occurrence='3' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator_Utils::FilterLineEdit {type='Utils::FilterLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator_Utils::IconButton {occurrence='4' type='Utils::IconButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
: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.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'}
:Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' unnamed='1' visible='1' windowTitle?='*Qt Creator'}
:Desktop_QLabel {container=':QtCreator.MenuBar_ProjectExplorer::Internal::ProjectListWidget' name='target' text='Desktop' type='QLabel' 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'}
:Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' visible='1' windowTitle?='*Qt Creator'}
:Qt Creator_CppEditor::Internal::CPPEditorWidget {type='CppEditor::Internal::CPPEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Utils::IconButton {occurrence='2' type='Utils::IconButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:QtCreator.MenuBar_ProjectExplorer::Internal::MiniProjectTargetSelector {type='ProjectExplorer::Internal::MiniProjectTargetSelector'}
:QtCreator.MenuBar_ProjectExplorer::Internal::ProjectListWidget {type='ProjectExplorer::Internal::ProjectListWidget' window=':QtCreator.MenuBar_ProjectExplorer::Internal::MiniProjectTargetSelector'}
:projects.projects.pro_QModelIndex {column='0' container=':projects_QModelIndex' text='projects.pro' type='QModelIndex'}
:projects_QModelIndex {column='0' container=':Qt Creator_Utils::NavigationTreeView' text='projects' type='QModelIndex'}
:scrollArea.Create Build Configurations:_QComboBox {container=':Project Setup.scrollArea_QScrollArea' leftWidget=':scrollArea.Create Build Configurations:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:scrollArea.Create Build Configurations:_QLabel {container=':Project Setup.scrollArea_QScrollArea' text='Create Build Configurations:' type='QLabel' unnamed='1' visible='1'}
......@@ -4,10 +4,20 @@ def invokeMenuItem(menu, item):
activateItem(menuObject)
activateItem(waitForObjectItem(menuObject, item))
def openProject(projectPath):
def openQmakeProject(projectPath):
invokeMenuItem("File", "Open File or Project...")
waitForObject("{name='QFileDialog' type='QFileDialog' visible='1' windowTitle='Open File'}")
type(findObject("{name='fileNameEdit' type='QLineEdit'}"), projectPath)
clickButton(findObject("{text='Open' type='QPushButton'}"))
waitForObject("{type='Qt4ProjectManager::Internal::ProjectLoadWizard' visible='1' windowTitle='Project Setup'}")
selectFromCombo(":scrollArea.Create Build Configurations:_QComboBox", "per Qt Version a Debug and Release")
clickButton(findObject("{text='Finish' type='QPushButton'}"))
def openCmakeProject(projectPath):
invokeMenuItem("File", "Open File or Project...")
waitForObject("{name='QFileDialog' type='QFileDialog' visible='1' windowTitle='Open File'}")
type(findObject("{name='fileNameEdit' type='QLineEdit'}"), projectPath)
clickButton(findObject("{text='Open' type='QPushButton'}"))
clickButton(waitForObject(":CMake Wizard.Next_QPushButton", 20000))
clickButton(waitForObject(":CMake Wizard.Run CMake_QPushButton", 20000))
clickButton(waitForObject(":CMake Wizard.Finish_QPushButton", 60000))
......@@ -18,8 +18,8 @@ def verifyEnabled(objectName):
def selectFromCombo(objectName, itemName):
object = verifyEnabled(objectName)
mouseClick(object, 198, 7, 0, Qt.LeftButton)
mouseClick(waitForObjectItem(object, itemName), 84, 5, 0, Qt.LeftButton)
mouseClick(object, 5, 5, 0, Qt.LeftButton)
mouseClick(waitForObjectItem(object, itemName), 5, 5, 0, Qt.LeftButton)
def wordUnderCursor(window):
cursor = window.textCursor()
......
......@@ -6,23 +6,26 @@ def handleRefreshFinished(object, fileList):
global refreshFinishedCount
refreshFinishedCount += 1
def main():
test.verify(os.path.exists(SDKPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro"))
startApplication("qtcreator" + SettingsPath)
installLazySignalHandler("{type='CppTools::Internal::CppModelManager'}", "sourceFilesRefreshed(QStringList)", "handleRefreshFinished")
test.verify(os.path.exists(SDKPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro"))
openProject(SDKPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro")
openQmakeProject(SDKPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro")
waitFor("refreshFinishedCount == 1", 20000)
test.compare(refreshFinishedCount, 1)
mouseClick(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), 110, 11, 0, Qt.LeftButton)
mouseClick(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), 5, 5, 0, Qt.LeftButton)
type(waitForObject(":*Qt Creator_Utils::FilterLineEdit"), "dummy.cpp")
# pause to wait for results to populate
snooze(1)
type(waitForObject(":*Qt Creator_Utils::FilterLineEdit"), "<Return>")
## Waiting for a solution from Froglogic to make the below work.
## There is an issue with slots that return a class type that wasn't running previously...
# editorManager = waitForObject("{type='Core::EditorManager'}", 2000)
# t2 = editorManager.currentEditor()
# t3 = t2.file()
......@@ -55,7 +58,7 @@ def main():
# Creator should show the definition of this function
# - Press Shift+F2 or select from menu: Tools / C++ / Switch Between Method Declaration/Definition again
# Creator should show the declaration of the function again.
mouseClick(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), 110, 11, 0, Qt.LeftButton)
mouseClick(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), 5, 5, 0, Qt.LeftButton)
clickButton(waitForObject(":Qt Creator_Utils::IconButton"))
type(waitForObject(":*Qt Creator_Utils::FilterLineEdit"), "dummy.cpp")
# pause to wait for results to populate
......
source("../../shared/qtcreator.py")
import re;
SpeedCrunchPath = ""
buildFinished = False
buildSucceeded = False
refreshFinishedCount = 0
def handleBuildFinished(object, success):
global buildFinished, buildSucceeded
buildFinished = True
buildSucceeded = success
def handleRefreshFinished(object, fileList):
global refreshFinishedCount
refreshFinishedCount += 1
def main():
startApplication("qtcreator" + SettingsPath)
global buildFinished, buildSucceeded
test.verify(os.path.exists(SpeedCrunchPath))
openProject(SpeedCrunchPath)
startApplication("qtcreator" + SettingsPath)
openQmakeProject(SpeedCrunchPath)
# Test that some of the expected items are in the navigation tree
for row, record in enumerate(testData.dataset("speedcrunch_tree.tsv")):
......@@ -22,14 +30,30 @@ def main():
test.compare(waitForObject(node).text, value)
# Invoke a rebuild of the application
invokeMenuItem("Build", "Rebuild All")
installLazySignalHandler("{type='CppTools::Internal::CppModelManager'}", "sourceFilesRefreshed(QStringList)", "handleRefreshFinished")
# Wait for, and test if the build succeeded
clickButton(waitForObject(":*Qt Creator_Core::Internal::FancyToolButton"))
buildCombo = waitForObject(":Build:_QComboBox")
installLazySignalHandler("{type='ProjectExplorer::BuildManager'}", "buildQueueFinished(bool)", "handleBuildFinished")
waitFor("buildFinished == True", 30000)
test.verify(buildSucceeded == 1) # buildSucceeded is True for me - even on failed builds; remove this check at all?
checkLastBuild()
# Now that this has finished, test adding a new build configuration
sendEvent("QMouseEvent", waitForObject(":QtCreator.MenuBar_ProjectExplorer::Internal::MiniProjectTargetSelector"), QEvent.MouseButtonPress, -5, 5, Qt.LeftButton, 0)
prog = re.compile("Qt.*Release")
for row in range(buildCombo.count):
if prog.match(str(buildCombo.itemText(row))):
clickButton(waitForObject(":*Qt Creator_Core::Internal::FancyToolButton"))
refreshFinishedCount = 0
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)
buildSucceeded = 0
buildFinished = False
invokeMenuItem("Build", "Rebuild All")
# Wait for, and test if the build succeeded
waitFor("buildFinished == True", 300000)
test.verify(buildSucceeded == 1) # buildSucceeded is True for me - even on failed builds; remove this check at all?
checkLastBuild()
# Add a new run configuration
......@@ -46,7 +70,9 @@ def cleanup():
os.remove(SpeedCrunchPath + ".user")
BuildPath = glob.glob(SDKPath + "/creator-test-data/speedcrunch/speedcrunch-build-*")
BuildPath += glob.glob(SDKPath + "/creator-test-data/speedcrunch/qtcreator-build-*")
for dir in BuildPath:
if os.access(dir, os.F_OK):
shutil.rmtree(dir)
if BuildPath:
for dir in BuildPath:
if os.access(dir, os.F_OK):
shutil.rmtree(dir)
......@@ -14,18 +14,11 @@ def main():
test.fatal("cmake not found")
return
startApplication("qtcreator" + SettingsPath)
invokeMenuItem("File", "Open File or Project...")
test.verify(os.path.exists(SpeedCrunchPath))
waitForObject("{name='QFileDialog' type='QFileDialog' visible='1' windowTitle='Open File'}", 20000)
type(findObject("{name='fileNameEdit' type='QLineEdit'}"), SpeedCrunchPath)
clickButton(findObject("{text='Open' type='QPushButton'}"))
clickButton(waitForObject(":CMake Wizard.Next_QPushButton", 20000))
clickButton(waitForObject(":CMake Wizard.Run CMake_QPushButton", 20000))
clickButton(waitForObject(":CMake Wizard.Finish_QPushButton", 60000))
startApplication("qtcreator" + SettingsPath)
openCmakeProject(SpeedCrunchPath)
waitFor("object.exists(':speedcrunch_QModelIndex')", 20000)
......
......@@ -7,15 +7,15 @@ def handleRefreshFinished(object, fileList):
refreshFinishedCount += 1
def main():
test.verify(os.path.exists(SDKPath + "/qt/projects.pro"))
test.verify(os.path.exists(SDKPath + "/creator/qtcreator.pro"))
startApplication("qtcreator" + SettingsPath)
installLazySignalHandler("{type='CppTools::Internal::CppModelManager'}", "sourceFilesRefreshed(QStringList)", "handleRefreshFinished")
test.verify(os.path.exists(SDKPath + "/qt/projects.pro"))
test.verify(os.path.exists(SDKPath + "/creator/qtcreator.pro"))
openProject(SDKPath + "/qt/projects.pro")
openProject(SDKPath + "/creator/qtcreator.pro")
openQmakeProject(SDKPath + "/qt/projects.pro")
openQmakeProject(SDKPath + "/creator/qtcreator.pro")
# Test that some of the expected items are in the navigation tree
for row, record in enumerate(testData.dataset("qt_tree.tsv")):
......@@ -34,7 +34,7 @@ def main():
# Now check some basic lookups in the search box
mouseClick(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), 101, 7, 0, Qt.LeftButton)
mouseClick(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), 5, 5, 0, Qt.LeftButton)
type(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), ": Qlist::QList")
snooze(1)
type(waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000), "<Return>")
......
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