test.py 4.66 KB
Newer Older
1
2
#############################################################################
##
Eike Ziller's avatar
Eike Ziller committed
3
4
## Copyright (C) 2015 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing
5
6
7
8
9
10
11
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance with the commercial license agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
Eike Ziller's avatar
Eike Ziller committed
12
13
## a written agreement between you and The Qt Company.  For licensing terms and
## conditions see http://www.qt.io/terms-conditions.  For further information
Eike Ziller's avatar
Eike Ziller committed
14
## use the contact form at http://www.qt.io/contact-us.
15
16
17
##
## GNU Lesser General Public License Usage
## Alternatively, this file may be used under the terms of the GNU Lesser
Eike Ziller's avatar
Eike Ziller committed
18
19
20
21
22
## General Public License version 2.1 or version 3 as published by the Free
## Software Foundation and appearing in the file LICENSE.LGPLv21 and
## LICENSE.LGPLv3 included in the packaging of this file.  Please review the
## following information to ensure the GNU Lesser General Public License
## requirements will be met: https://www.gnu.org/licenses/lgpl.html and
23
## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
##
Eike Ziller's avatar
Eike Ziller committed
25
26
## In addition, as a special exception, The Qt Company gives you certain additional
## rights.  These rights are described in The Qt Company LGPL Exception
27
28
29
30
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
##
#############################################################################

31
32
33
34
source("../../shared/qtcreator.py")

def main():
    startApplication("qtcreator" + SettingsPath)
35
36
    if not startedWithoutPluginError():
        return
Christian Stenger's avatar
Christian Stenger committed
37
38
39
40
41
42
43
44
45
46
47
48

    available = [("5.3", False), ("5.3", True)]
    if platform.system() != 'Darwin':
        available.extend([("5.4", False), ("5.4", True)])

    for qtVersion, controls in available:
        if qtVersion == "5.3":
            targ = Targets.DESKTOP_531_DEFAULT
            quick = "2.3"
        else:
            targ = Targets.DESKTOP_541_GCC
            quick = "2.4"
49
50
51
        # using a temporary directory won't mess up a potentially existing
        workingDir = tempDir()
        checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targ,
Christian Stenger's avatar
Christian Stenger committed
52
53
54
55
56
57
58
59
60
61
                                                                  minimumQtVersion=qtVersion,
                                                                  withControls = controls)
        if len(checkedTargets) == 0:
            test.fatal("Could not check wanted target")
            continue
        additionalText = ''
        if controls:
            additionalText = ' Controls '
        test.log("Building project Qt Quick%sApplication (%s)"
                 % (additionalText, Targets.getStringForTarget(targ)))
62
63
        result = modifyRunSettingsForHookInto(projectName, len(checkedTargets), 11223)
        invokeMenuItem("Build", "Build All")
64
        waitForCompile()
65
66
67
68
69
        if not checkCompile():
            test.fatal("Compile failed")
        else:
            checkLastBuild()
            test.log("Running project (includes build)")
70
            if result:
71
72
73
                result = addExecutableAsAttachableAUT(projectName, 11223)
                allowAppThroughWinFW(workingDir, projectName)
                if result:
74
75
                    function = "subprocessFunctionQuick2"
                    result = runAndCloseApp(True, projectName, 11223, function,
Christian Stenger's avatar
Christian Stenger committed
76
                                            SubprocessType.QT_QUICK_APPLICATION, quickVersion=quick)
77
78
79
80
                else:
                    result = runAndCloseApp(sType=SubprocessType.QT_QUICK_APPLICATION)
                removeExecutableAsAttachableAUT(projectName, 11223)
                deleteAppFromWinFW(workingDir, projectName)
81
            else:
82
                result = runAndCloseApp()
83
84
85
            if result == None:
                checkCompile()
            else:
86
87
88
                appOutput = logApplicationOutput()
                test.verify(not ("main.qml" in appOutput or "MainForm.ui.qml" in appOutput),
                            "Does the Application Output indicate QML errors?")
89
        invokeMenuItem("File", "Close All Projects and Editors")
90

91
92
    invokeMenuItem("File", "Exit")

93
94
95
96
97
def subprocessFunctionGenericQuick(quickVersion):
    helloWorldText = waitForObject("{container={type='QtQuick%dApplicationViewer' visible='1' "
                                   "unnamed='1'} enabled='true' text='Hello World' type='Text' "
                                   "unnamed='1' visible='true'}" % quickVersion)
    test.log("Clicking 'Hello World' Text to close QtQuick%dApplicationViewer" % quickVersion)
98
    mouseClick(helloWorldText, 5, 5, 0, Qt.LeftButton)
99
100
101

def subprocessFunctionQuick2():
    subprocessFunctionGenericQuick(2)