1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
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: doublevalidatorelementtest
47 property string testtext: ""
50 id: doublevalidatorelement
51 top: 30.06; bottom: 30.02
52 //Behavior on top { NumberAnimation { duration: 1000 } }
56 id: doublevalidatorelementbackground
57 color: doublevalidatorelementinput.acceptableInput ? "green" : "red"; height: 50; width: parent.width *.8
58 border.color: "gray"; opacity: 0.7; radius: 5
59 anchors.centerIn: parent
62 id: doublevalidatorelementinput
63 font.pointSize: 12; width: parent.width; text: "0"; horizontalAlignment: Text.AlignHCenter; validator: doublevalidatorelement
64 anchors.centerIn: parent
65 Behavior on font.pointSize { NumberAnimation { duration: 1000 } }
66 Behavior on color { ColorAnimation { duration: 1000 } }
71 anchors.top: doublevalidatorelementbackground.bottom; anchors.topMargin: 50; anchors.horizontalCenter: parent.horizontalCenter
72 text: "Top: " + doublevalidatorelement.top + " Bottom: " + doublevalidatorelement.bottom
75 SystemTestHelp { id: helpbubble; visible: statenum != 0
76 anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
78 BugPanel { id: bugpanel }
83 State { name: "start"; when: statenum == 1
84 PropertyChanges { target: doublevalidatorelementinput; text: "30.03" }
85 PropertyChanges { target: doublevalidatorelementtest
86 testtext: "This is a TextInput element using an DoubleValidator for input masking. At present it should be indicating 30.03.\n"+
87 "Next, let's attempt to enter a number smaller than the lowest allowable value: 30.01" }
89 State { name: "lowerthan"; when: statenum == 2
90 PropertyChanges { target: doublevalidatorelementinput; text: "30.01" }
91 PropertyChanges { target: doublevalidatorelementtest
92 testtext: "The TextInput background should be showing red - input is not acceptable.\n"+
93 "Next, let's enter a value equal to the lowest allowable value: 30.02." }
95 State { name: "equaltobottom"; when: statenum == 3
96 PropertyChanges { target: doublevalidatorelementinput; text: "30.02" }
97 PropertyChanges { target: doublevalidatorelementtest
98 testtext: "The TextInput background should be showing green - input is acceptable.\n"+
99 "Next, let's attempt to enter a number greater than the highest allowable value: 30.08" }
101 State { name: "greaterthan"; when: statenum == 4
102 PropertyChanges { target: doublevalidatorelementinput; text: "30.08" }
103 PropertyChanges { target: doublevalidatorelementtest
104 testtext: "The TextInput background should be showing red - input is not acceptable.\n"+
105 "Next, let's change the value of top to be greater than the entered number." }
107 State { name: "increasedtop"; when: statenum == 5
108 PropertyChanges { target: doublevalidatorelementinput; text: "30.08" }
109 PropertyChanges { target: doublevalidatorelement; top: 30.09 }
110 PropertyChanges { target: doublevalidatorelementtest
111 testtext: "The highest value should have increased to 30.09, thus making the number valid and turning the input background green.\n"+
112 "Next, let's change the value of bottom to be greater than the entered number." }
113 PropertyChanges { target: bugpanel; bugnumber: "19956" }
115 State { name: "increasedbottom"; when: statenum == 6
116 PropertyChanges { target: doublevalidatorelementinput; text: "30.08" }
117 PropertyChanges { target: doublevalidatorelement; top: 30.09; bottom: 40.05 }
118 PropertyChanges { target: doublevalidatorelementtest
119 testtext: "The lowest value should have increased to 36, thus making the validator invalid and turning the input background red.\n"+
120 "Press advance to restart the test." }