test.py 1.59 KB
Newer Older
1
2
3
4
5
6
source("../../shared/qtcreator.py")

workingDir = None
templateDir = None

def main():
7
    global workingDir,templateDir
8
9
10
    sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/text/textselection")
    if not neededFilePresent(sourceExample):
        return
11
12
13
    startApplication("qtcreator" + SettingsPath)
    # using a temporary directory won't mess up an eventually exisiting
    workingDir = tempDir()
14
    prepareTemplate(sourceExample)
15
    createNewQtQuickApplication(workingDir, None, templateDir + "/qml/textselection.qml")
16
    # wait for parsing to complete
17
    waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 30000)
18
19
    test.log("Building project")
    invokeMenuItem("Build","Build All")
20
    waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
21
22
23
24
25
26
27
    if not checkCompile():
        test.fatal("Compile failed")
    else:
        checkLastBuild()
        test.log("Running project (includes build)")
        if runAndCloseApp():
            logApplicationOutput()
28
29
    invokeMenuItem("File", "Exit")

30
def prepareTemplate(sourceExample):
31
32
33
34
35
36
37
38
    global templateDir
    templateDir = tempDir()
    templateDir = os.path.abspath(templateDir + "/template")
    shutil.copytree(sourceExample, templateDir)

def cleanup():
    global workingDir,templateDir
    # waiting for a clean exit - for a full-remove of the temp directory
39
    waitForCleanShutdown()
40
41
42
43
    if workingDir!=None:
        deleteDirIfExists(workingDir)
    if templateDir!=None:
        deleteDirIfExists(os.path.dirname(templateDir))