~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to tests/system/suite_qtquick/tst_qtquick_creation2/test.py

  • Committer: Timo Jyrinki
  • Date: 2013-12-02 09:16:15 UTC
  • mfrom: (1.1.29)
  • Revision ID: timo.jyrinki@canonical.com-20131202091615-xbj1os1f604ber1m
New upstream release candidate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#############################################################################
2
 
##
3
 
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4
 
## Contact: http://www.qt-project.org/legal
5
 
##
6
 
## This file is part of Qt Creator.
7
 
##
8
 
## Commercial License Usage
9
 
## Licensees holding valid commercial Qt licenses may use this file in
10
 
## accordance with the commercial license agreement provided with the
11
 
## Software or, alternatively, in accordance with the terms contained in
12
 
## a written agreement between you and Digia.  For licensing terms and
13
 
## conditions see http://qt.digia.com/licensing.  For further information
14
 
## use the contact form at http://qt.digia.com/contact-us.
15
 
##
16
 
## GNU Lesser General Public License Usage
17
 
## Alternatively, this file may be used under the terms of the GNU Lesser
18
 
## General Public License version 2.1 as published by the Free Software
19
 
## Foundation and appearing in the file LICENSE.LGPL included in the
20
 
## packaging of this file.  Please review the following information to
21
 
## ensure the GNU Lesser General Public License version 2.1 requirements
22
 
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23
 
##
24
 
## In addition, as a special exception, Digia gives you certain additional
25
 
## rights.  These rights are described in the Digia Qt LGPL Exception
26
 
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27
 
##
28
 
#############################################################################
29
 
 
30
 
source("../../shared/qtcreator.py")
31
 
 
32
 
def main():
33
 
    sourceExampleQt4 = os.path.join(sdkPath, "Examples", "4.7", "declarative", "text",
34
 
                                    "textselection", "qml", "textselection.qml")
35
 
    sourceExampleQt5 = os.path.join(qt5SDKPath(), "examples", "quick", "text", "textselection",
36
 
                                    "textselection.qml")
37
 
    if not neededFilePresent(sourceExampleQt4):
38
 
        return
39
 
    if not neededFilePresent(sourceExampleQt5):
40
 
        return
41
 
    startApplication("qtcreator" + SettingsPath)
42
 
    if not startedWithoutPluginError():
43
 
        return
44
 
    targetsAndQuickVersion = {Targets.DESKTOP_480_GCC:[1, sourceExampleQt4],
45
 
                              Targets.DESKTOP_501_DEFAULT:[2, sourceExampleQt5]}
46
 
    for targ, qVerAndEx in targetsAndQuickVersion.items():
47
 
        # using a temporary directory won't mess up a potentially existing
48
 
        workingDir = tempDir()
49
 
        checkedTargets, projectName = createNewQtQuickApplication(workingDir, None,
50
 
                                                                  qVerAndEx[1],
51
 
                                                                  targ, qVerAndEx[0])
52
 
        test.log("Building project Qt Quick %d Application (%s)"
53
 
                 % (qVerAndEx[0], Targets.getStringForTarget(targ)))
54
 
        result = modifyRunSettingsForHookInto(projectName, len(checkedTargets), 11223)
55
 
        invokeMenuItem("Build","Build All")
56
 
        waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
57
 
        if not checkCompile():
58
 
            test.fatal("Compile failed")
59
 
        else:
60
 
            checkLastBuild()
61
 
            test.log("Running project (includes build)")
62
 
            if result:
63
 
                result = addExecutableAsAttachableAUT(projectName, 11223)
64
 
                allowAppThroughWinFW(workingDir, projectName)
65
 
                if result:
66
 
                    result = runAndCloseApp(True, projectName, 11223, subprocessFunction, SubprocessType.QT_QUICK_APPLICATION)
67
 
                else:
68
 
                    result = runAndCloseApp(sType=SubprocessType.QT_QUICK_APPLICATION)
69
 
                removeExecutableAsAttachableAUT(projectName, 11223)
70
 
                deleteAppFromWinFW(workingDir, projectName)
71
 
            else:
72
 
                result = runAndCloseApp()
73
 
            if result:
74
 
                logApplicationOutput()
75
 
        invokeMenuItem("File", "Close All Projects and Editors")
76
 
    invokeMenuItem("File", "Exit")
77
 
 
78
 
def subprocessFunction():
79
 
    textEdit = waitForObject("{container={type='QmlApplicationViewer' unnamed='1' visible='1'} "
80
 
                             "enabled='true' type='TextEdit' unnamed='1' visible='true'}")
81
 
    test.log("Test dragging")
82
 
    dragItemBy(textEdit, 30, 30, 50, 50, 0, Qt.LeftButton)
83
 
    test.log("Test editing")
84
 
    textEdit.cursorPosition = 0
85
 
    typeLines(textEdit, "This text is entered by Squish...")
86
 
    test.log("Closing QmlApplicationViewer")
87
 
    sendEvent("QCloseEvent", "{type='QmlApplicationViewer' unnamed='1' visible='1'}")