test.verify(os.path.exists(h_path), "Checking if '" + h_path + "' was created")
test.verify(os.path.exists(ui_path), "Checking if '" + ui_path + "' was created")
test.verify(os.path.exists(pro_path), "Checking if '" + pro_path + "' was created")
+
+def createNewQtQuickApplication(workingDir, projectName = None, templateFile = None, destination = QtQuickConstants.Destinations.DESKTOP):
+ 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), "Qt Quick Application", 5, 5, 0, Qt.LeftButton)
+ clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000))
+ if projectName!=None:
+ baseLineEd = waitForObject("{name='nameLineEdit' visible='1' "
+ "type='Utils::ProjectNameValidatingLineEdit'}", 20000)
+ replaceEditorContent(baseLineEd, projectName)
+ baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
+ replaceEditorContent(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)
+ nextButton = waitForObject("{text~='(Next.*|Continue)' type='QPushButton' visible='1'}", 20000)
+ clickButton(nextButton)
+ if (templateFile==None):
+ chooseComponents()
+ else:
+ chooseComponents(QtQuickConstants.Components.EXISTING_QML)
+ # define the existing qml file to import
+ baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
+ type(baseLineEd, templateFile)
+ clickButton(nextButton)
+ chooseDestination(destination)
+ snooze(1)
+ clickButton(nextButton)
+ clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
source("../../shared/utils.py")
source("../../shared/build_utils.py")
-source("../../shared/project.py")
source("../../shared/qtquick.py")
+source("../../shared/project.py")
source("../../shared/editor_utils.py")
def waitForCleanShutdown(timeOut=10):
# using a temporary directory won't mess up an eventually exisiting
workingDir = tempDir()
prepareTemplate(sourceExample)
- createNewQtQuickApplication()
+ createNewQtQuickApplication(workingDir, "untitled", templateDir + "/qml/focus.qml")
# wait for parsing to complete
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000)
testRenameId()
templateDir = os.path.abspath(templateDir + "/template")
shutil.copytree(sourceExample, templateDir)
-def createNewQtQuickApplication():
- global workingDir,templateDir
- 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),
- "Qt Quick Application", 5, 5, 0, Qt.LeftButton)
- clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000))
- baseLineEd = waitForObject("{name='nameLineEdit' visible='1' "
- "type='Utils::ProjectNameValidatingLineEdit'}", 20000)
- replaceEditorContent(baseLineEd, "untitled")
- baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
- replaceEditorContent(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.*|Continue)' type='QPushButton' visible='1'}", 20000)
- clickButton(nextButton)
- chooseComponents(QtQuickConstants.Components.EXISTING_QML)
- # define the existing qml file to import
- baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
- type(baseLineEd, templateDir+"/qml/focus.qml")
- clickButton(nextButton)
- chooseDestination()
- snooze(1)
- clickButton(nextButton)
- clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
-
def testRenameId():
test.log("Testing rename of id")
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
startApplication("qtcreator" + SettingsPath)
# using a temporary directory won't mess up an eventually exisiting
workingDir = tempDir()
- createNewQtQuickApplication()
+ createNewQtQuickApplication(workingDir, "untitled")
# wait for parsing to complete
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 5000)
if not prepareQmlFile():
invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit")
-def createNewQtQuickApplication():
- 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),
- "Qt Quick Application", 5, 5, 0, Qt.LeftButton)
- clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000))
- baseLineEd = waitForObject("{name='nameLineEdit' visible='1' "
- "type='Utils::ProjectNameValidatingLineEdit'}", 20000)
- replaceEditorContent(baseLineEd, "untitled")
- baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
- replaceEditorContent(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.*|Continue)' type='QPushButton' visible='1'}", 20000)
- clickButton(nextButton)
- chooseComponents()
- clickButton(nextButton)
- chooseDestination(QtQuickConstants.Destinations.DESKTOP)
- snooze(1)
- clickButton(nextButton)
- clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
-
def prepareQmlFile():
# make sure the QML file is opened
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
startApplication("qtcreator" + SettingsPath)
# using a temporary directory won't mess up an eventually exisiting
workingDir = tempDir()
- createNewQtQuickApplication()
+ createNewQtQuickApplication(workingDir)
# wait for parsing to complete
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000)
test.log("Building project")
logApplicationOutput()
invokeMenuItem("File", "Exit")
-def createNewQtQuickApplication():
- 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), "Qt Quick Application", 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)
- replaceEditorContent(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.*|Continue)' type='QPushButton' visible='1'}", 20000)
- clickButton(nextButton)
- chooseComponents()
- clickButton(nextButton)
- chooseDestination(QtQuickConstants.Destinations.DESKTOP)
- snooze(1)
- clickButton(nextButton)
- clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
-
def cleanup():
global workingDir
# waiting for a clean exit - for a full-remove of the temp directory
# using a temporary directory won't mess up an eventually exisiting
workingDir = tempDir()
prepareTemplate(sourceExample)
- createNewQtQuickApplication()
+ createNewQtQuickApplication(workingDir, None, templateDir + "/qml/textselection.qml")
# wait for parsing to complete
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000)
test.log("Building project")
templateDir = os.path.abspath(templateDir + "/template")
shutil.copytree(sourceExample, templateDir)
-def createNewQtQuickApplication():
- global workingDir,templateDir
- 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), "Qt Quick Application", 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)
- replaceEditorContent(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.*|Continue)' type='QPushButton' visible='1'}", 20000)
- clickButton(nextButton)
- chooseComponents(QtQuickConstants.Components.EXISTING_QML)
- # define the existing qml file to import
- baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
- type(baseLineEd, templateDir+"/qml/textselection.qml")
- clickButton(nextButton)
- chooseDestination()
- snooze(1)
- clickButton(nextButton)
- clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
-
def cleanup():
global workingDir,templateDir
# waiting for a clean exit - for a full-remove of the temp directory