1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: http://www.qt-project.org/
7 ** This file is part of the test suite of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
45 id: flickableelementtest
47 property string testtext: ""
48 property int sidelength: 1500
51 id: flickableelementbox
52 color: "lightgray"; border.color: "gray"; radius: 5; clip: true; opacity: .1
53 height: 250; width: parent.width *.8
54 anchors.centerIn: parent
59 contentHeight: sidelength; contentWidth: sidelength; contentX: (sidelength/2)-125; contentY: (sidelength/2)-125
60 onAtYBeginningChanged: {
61 if (flicking && atYBeginning && statenum == 1) { advance(); }
62 else if (flicking && atYBeginning && atXBeginning && statenum == 4) { advance(); }
65 if (atYEnd && atXEnd && statenum == 2) {
66 if (flicking){ advance();
68 testtext = "The view must be flicked into the bottom left corner. Move the grid away slightly and try again"
72 onAtXBeginningChanged: {
73 if (atYEnd && atXBeginning && statenum == 3) {
74 if (!flicking) { advance(); } else { testtext = "Drag - do not flick. Move the grid away slightly and try again" }
79 width: sidelength; height: sidelength
85 height: flickableelement.contentHeight; width: 50; model: 30
86 Rectangle { height: 50; width: 50; color: "gray"; border.color: "black" }
91 Text { anchors.centerIn: parent; text: "Center" }
94 Text { anchors.left: flickableelementbox.left; anchors.top: flickableelementbox.bottom; anchors.topMargin: 5;
95 text: "Dragging"; color: !flickableelement.flicking && flickableelement.moving ? "Green" : "Red"
97 Text { anchors.right: flickableelementbox.right; anchors.top: flickableelementbox.bottom; anchors.topMargin: 5;
98 text: "Flicking"; color: flickableelement.flicking ? "Green" : "Red"
101 SystemTestHelp { id: helpbubble; visible: statenum != 0
102 anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
104 BugPanel { id: bugpanel }
107 State { name: "start"; when: statenum == 1
108 StateChangeScript { script: { flickableelement.contentX = (sidelength/2)-125; flickableelement.contentY = (sidelength/2)-125 } }
109 PropertyChanges { target: helpbubble; showadvance: false }
110 PropertyChanges { target: flickableelementtest
111 testtext: "This is a Flickable element. At present it should be displaying a grid,\n"+
112 "with the center marked and in the center of the view.\n"+
113 "Next, please flick the view to the top" }
115 State { name: "top"; when: statenum == 2
116 PropertyChanges { target: helpbubble; showadvance: false }
117 PropertyChanges { target: flickableelementtest; testtext: "Good. Now flick to the bottom right hand corner." }
119 State { name: "bottomright"; when: statenum == 3
120 PropertyChanges { target: helpbubble; showadvance: false }
121 PropertyChanges { target: flickableelementtest; testtext: "Great. Now drag, not flick, the view to the bottom left." }
123 State { name: "bottomleft"; when: statenum == 4
124 PropertyChanges { target: helpbubble; showadvance: false }
125 PropertyChanges { target: flickableelementtest; testtext: "Almost there. Flick to the top left" }
127 State { name: "sections"; when: statenum == 5
128 PropertyChanges { target: helpbubble; showadvance: true }
129 PropertyChanges { target: flickableelementtest
130 testtext: "Excellent.\n"+
131 "Advance to restart the test." }