1 source("../../shared/qtcreator.py")
7 global workingDir,templateDir
8 sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/text/textselection")
9 if not neededFilePresent(sourceExample):
11 startApplication("qtcreator" + SettingsPath)
12 # using a temporary directory won't mess up an eventually exisiting
13 workingDir = tempDir()
14 prepareTemplate(sourceExample)
15 createNewQtQuickApplication()
16 # wait for parsing to complete
17 waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000)
18 test.log("Building project")
19 invokeMenuItem("Build","Build All")
20 waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
21 if not checkCompile():
22 test.fatal("Compile failed")
25 test.log("Running project (includes build)")
27 logApplicationOutput()
28 invokeMenuItem("File", "Exit")
30 def prepareTemplate(sourceExample):
32 templateDir = tempDir()
33 templateDir = os.path.abspath(templateDir + "/template")
34 shutil.copytree(sourceExample, templateDir)
36 def createNewQtQuickApplication():
37 global workingDir,templateDir
38 invokeMenuItem("File", "New File or Project...")
39 clickItem(waitForObject("{type='QTreeView' name='templateCategoryView'}", 20000), "Projects.Qt Quick Project", 5, 5, 0, Qt.LeftButton)
40 clickItem(waitForObject("{name='templatesView' type='QListView'}", 20000), "Qt Quick Application", 5, 5, 0, Qt.LeftButton)
41 clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000))
42 baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
43 replaceEditorContent(baseLineEd, workingDir)
44 stateLabel = findObject("{type='QLabel' name='stateLabel'}")
45 labelCheck = stateLabel.text=="" and stateLabel.styleSheet == ""
46 test.verify(labelCheck, "Project name and base directory without warning or error")
47 # make sure this is not set as default location
48 cbDefaultLocation = waitForObject("{type='QCheckBox' name='projectsDirectoryCheckBox' visible='1'}", 20000)
49 if cbDefaultLocation.checked:
50 clickButton(cbDefaultLocation)
51 # now there's the 'untitled' project inside a temporary directory - step forward...!
52 nextButton = waitForObject("{text~='(Next.*|Continue)' type='QPushButton' visible='1'}", 20000)
53 clickButton(nextButton)
54 chooseComponents(QtQuickConstants.Components.EXISTING_QML)
55 # define the existing qml file to import
56 baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
57 type(baseLineEd, templateDir+"/qml/textselection.qml")
58 clickButton(nextButton)
61 clickButton(nextButton)
62 clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000))
65 global workingDir,templateDir
66 # waiting for a clean exit - for a full-remove of the temp directory
67 waitForCleanShutdown()
69 deleteDirIfExists(workingDir)
71 deleteDirIfExists(os.path.dirname(templateDir))