test.py 1.89 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")

# entry of test
def main():
    # expected error texts - for different compilers
    expectedErrorAlternatives = ["'SyntaxError' was not declared in this scope",
                                 "'SyntaxError' : undeclared identifier"]
    startApplication("qtcreator" + SettingsPath)
    # create qt quick application
11
    checkedTargets, projectName = createNewQtQuickApplication(tempDir(), "SampleApp")
12
    # create syntax error in cpp file
13
    openDocument("SampleApp.Sources.main\\.cpp")
14
15
16
17
18
    if not appendToLine(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget"), "viewer.showExpanded();", "SyntaxError"):
        invokeMenuItem("File", "Exit")
        return
    # save all
    invokeMenuItem("File", "Save All")
19
    # build it - on all build configurations
20
    availableConfigs = iterateBuildConfigs(len(checkedTargets))
21
    if not availableConfigs:
22
23
        test.fatal("Haven't found a suitable Qt version - leaving without building.")
    for kit, config in availableConfigs:
24
        selectBuildConfig(len(checkedTargets), kit, config)
25
26
        # try to compile
        test.log("Testing build configuration: " + config)
27
        clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton"))
28
29
30
        # wait until build finished
        waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
        # open issues list view
31
        ensureChecked(waitForObject(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton"))
32
33
34
35
36
37
        issuesView = waitForObject(":Qt Creator.Issues_QListView")
        # verify that error is properly reported
        test.verify(checkSyntaxError(issuesView, expectedErrorAlternatives, False),
                    "Verifying cpp syntax error while building simple qt quick application.")
    # exit qt creator
    invokeMenuItem("File", "Exit")