1
/****************************************************************************
3
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/
6
** This file is part of the test suite of the Qt Toolkit.
8
** $QT_BEGIN_LICENSE:LGPL$
9
** GNU Lesser General Public License Usage
10
** This file may be used under the terms of the GNU Lesser General Public
11
** License version 2.1 as published by the Free Software Foundation and
12
** appearing in the file LICENSE.LGPL included in the packaging of this
13
** file. Please review the following information to ensure the GNU Lesser
14
** General Public License version 2.1 requirements will be met:
15
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17
** In addition, as a special exception, Nokia gives you certain additional
18
** rights. These rights are described in the Nokia Qt LGPL Exception
19
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21
** GNU General Public License Usage
22
** Alternatively, this file may be used under the terms of the GNU General
23
** Public License version 3.0 as published by the Free Software Foundation
24
** and appearing in the file LICENSE.GPL included in the packaging of this
25
** file. Please review the following information to ensure the GNU General
26
** Public License version 3.0 requirements will be met:
27
** http://www.gnu.org/copyleft/gpl.html.
30
** Alternatively, this file may be used in accordance with the terms and
31
** conditions contained in a signed written agreement between you and Nokia.
40
****************************************************************************/
45
id: listviewelementtest
47
property string testtext: ""
48
property bool hivis: false
51
id: listviewelementbackground
52
color: "lightgray"; border.color: "gray"; radius: 5; clip: true; opacity: .1
53
height: listviewelement.height + 10; width: listviewelement.width + 10
54
anchors.centerIn: listviewelement
59
height: 250; width: parent.width *.8; clip: true
60
anchors.centerIn: parent
62
highlightFollowsCurrentItem: true
63
highlight: highlightrect
64
delegate: delegaterect
65
section.property: "os"
66
section.delegate: sectiondelegaterect
70
Behavior on spacing { NumberAnimation { duration: 200 } }
73
Component { id: delegaterect
75
width: listviewelement.width - 4; height: 30
76
Rectangle { color: "blue"; anchors.fill: parent; radius: 5; border.color: "black"; opacity: .1 }
77
Text { text: model.name; anchors.centerIn: parent }
81
Component { id: sectiondelegaterect
83
width: listviewelement.width - 4; height: 30
84
Rectangle { color: "green"; anchors.fill: parent; radius: 5; border.color: "black"; opacity: .5 }
85
Text { text: section; anchors.verticalCenter: parent.verticalCenter; anchors.left: parent.left; anchors.leftMargin: 5 }
89
Component { id: highlightrect
91
id: coloredbox; color: "yellow"; width: listviewelement.width - 4; height: 30; radius: 5; opacity: .5; visible: hivis
92
SequentialAnimation on color { loops: Animation.Infinite; running: coloredbox.visible
93
ColorAnimation { to: "green"; duration: 2000 }
94
ColorAnimation { to: "yellow"; duration: 2000 }
99
Component { id: headerrect
100
Rectangle { id: hdr; color: "brown"; width: listviewelement.width - 4; height: 30; radius: 5; opacity: .5
101
Text { anchors.centerIn: parent; text: "Nokia Devices" }
105
Component { id: footerrect
106
Rectangle { id: ftr; color: "brown"; width: listviewelement.width - 4; height: 30; radius: 5; opacity: .5
107
Text { anchors.centerIn: parent; text: "Nokia pty ltd." }
111
SystemTestHelp { id: helpbubble; visible: statenum != 0
112
anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
114
BugPanel { id: bugpanel }
117
State { name: "start"; when: statenum == 1
118
PropertyChanges { target: listviewelementtest
119
testtext: "This is a ListView element. At present it should be displaying the names of a few Nokia devices, ordered by Operating System.\n"+
120
"Next, let's view the end of the list" }
122
State { name: "end"; when: statenum == 2
123
StateChangeScript { script: listviewelement.positionViewAtEnd(); }
124
PropertyChanges { target: listviewelementtest
125
testtext: "The end of the list should now be visible.\nNext, let's add a highlight." }
127
State { name: "highlight"; when: statenum == 3
128
PropertyChanges { target: listviewelement; currentIndex: 0 }
129
StateChangeScript { script: listviewelement.positionViewAtBeginning(); }
130
PropertyChanges { target: listviewelementtest; hivis: true }
131
PropertyChanges { target: listviewelementtest
132
testtext: "The ListView should now be showing a highlight on the first item.\n"+
133
"Next, let's move to an item down the list." }
135
State { name: "highlight7"; when: statenum == 4
136
PropertyChanges { target: listviewelement; currentIndex: 6 }
137
PropertyChanges { target: listviewelementtest; hivis: true }
138
PropertyChanges { target: listviewelementtest
139
testtext: "The ListView should now be showing the highlight over item 7 - the N95\n"+
140
"Next let's add some space between them." }
142
State { name: "sections"; when: statenum == 5
143
PropertyChanges { target: listviewelement; currentIndex: 6 }
144
PropertyChanges { target: listviewelement; spacing: 5 }
145
PropertyChanges { target: listviewelementtest; hivis: true }
146
PropertyChanges { target: listviewelementtest
147
testtext: "The ListView should now be showing a space between each list item,\n"+
148
"but not after the header and sections, or before the footer.\n"+
149
"Advance to restart the test." }
155
ListElement { name: "N900"; os: "Maemo" }
156
ListElement { name: "N810"; os: "Maemo" }
157
ListElement { name: "N9"; os: "Meego" }
158
ListElement { name: "N-Gage QD"; os: "S60 1.2" }
159
ListElement { name: "E90"; os: "S60 2nd" }
160
ListElement { name: "E72"; os: "S60 3.2" }
161
ListElement { name: "N95"; os: "S60 5.0" }
162
ListElement { name: "X6"; os: "S60 5.0" }
163
ListElement { name: "N97"; os: "Symbian^1" }
164
ListElement { name: "5800"; os: "Symbian^1" }
165
ListElement { name: "E7"; os: "Symbian^3" }
166
ListElement { name: "N8"; os: "Symbian^3" }
167
ListElement { name: "C7"; os: "Symbian^3" }
168
ListElement { name: "X7"; os: "Symbian Anna" }