forked from qt-creator/qt-creator
64 lines
3.1 KiB
Python
64 lines
3.1 KiB
Python
|
|
source("../../shared/qtcreator.py")
|
||
|
|
|
||
|
|
refreshFinishedCount = 0
|
||
|
|
workingDir = None
|
||
|
|
|
||
|
|
def handleRefreshFinished(object, fileList):
|
||
|
|
global refreshFinishedCount
|
||
|
|
refreshFinishedCount += 1
|
||
|
|
|
||
|
|
def main():
|
||
|
|
global workingDir,buildFinished,buildSucceeded
|
||
|
|
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)
|
||
|
|
test.log("Building project")
|
||
|
|
invokeMenuItem("Build","Build All")
|
||
|
|
waitForBuildFinished()
|
||
|
|
if buildSucceeded:
|
||
|
|
checkCompile()
|
||
|
|
invokeMenuItem("File", "Exit")
|
||
|
|
|
||
|
|
def createNewQmlExtension():
|
||
|
|
global workingDir
|
||
|
|
invokeMenuItem("File", "New File or Project...")
|
||
|
|
clickItem(waitForObject("{type='QTreeView' name='templateCategoryView'}", 20000), "Projects.Qt Quick Project", 5, 5, 0, Qt.LeftButton)
|
||
|
|
clickItem(waitForObject("{name='templatesView' type='QListView'}", 20000), "Custom QML Extension Plugin", 5, 5, 0, Qt.LeftButton)
|
||
|
|
clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000))
|
||
|
|
baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
|
||
|
|
replaceLineEditorContent(baseLineEd, workingDir)
|
||
|
|
stateLabel = findObject("{type='QLabel' name='stateLabel'}")
|
||
|
|
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)
|
||
|
|
# now there's the 'untitled' project inside a temporary directory - step forward...!
|
||
|
|
nextButton = waitForObject("{text='Next' type='QPushButton' visible='1'}", 20000)
|
||
|
|
clickButton(nextButton)
|
||
|
|
chooseDestination()
|
||
|
|
clickButton(nextButton)
|
||
|
|
# buddy = waitForObject("{type='QLabel' text='Object Class-name:' unnamed='1' visible='1'}", 20000)
|
||
|
|
nameLineEd = waitForObject("{buddy={type='QLabel' text='Object Class-name:' unnamed='1' visible='1'} "
|
||
|
|
"type='QLineEdit' unnamed='1' visible='1'}", 20000)
|
||
|
|
replaceLineEditorContent(nameLineEd, "TestItem")
|
||
|
|
uriLineEd = waitForObject("{buddy={type='QLabel' text='URI:' unnamed='1' visible='1'} "
|
||
|
|
"type='QLineEdit' unnamed='1' visible='1'}", 20000)
|
||
|
|
replaceLineEditorContent(uriLineEd, "com.nokia.test.qmlcomponents")
|
||
|
|
clickButton(nextButton)
|
||
|
|
clickButton(waitForObject("{type='QPushButton' text='Finish' visible='1'}", 20000))
|
||
|
|
|
||
|
|
def cleanup():
|
||
|
|
global workingDir
|
||
|
|
# waiting for a clean exit - for a full-remove of the temp directory
|
||
|
|
appCtxt = currentApplicationContext()
|
||
|
|
waitFor("appCtxt.isRunning==False")
|
||
|
|
if workingDir!=None:
|
||
|
|
deleteDirIfExists(workingDir)
|
||
|
|
|