Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / tests / testapplications / elements / content / DoubleValidatorElement.qml
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the test suite of the Qt Toolkit.
7 **
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.
16 **
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.
20 **
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.
28 **
29 ** Other Usage
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.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 import QtQuick 2.0
43
44 Item {
45     id: doublevalidatorelementtest
46     anchors.fill: parent
47     property string testtext: ""
48
49     DoubleValidator {
50         id: doublevalidatorelement
51         top: 30.06; bottom: 30.02
52         //Behavior on top { NumberAnimation { duration: 1000 } }
53     }
54
55     Rectangle {
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
60
61         TextInput {
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 } }
67         }
68     }
69
70     Text{
71         anchors.top: doublevalidatorelementbackground.bottom; anchors.topMargin: 50; anchors.horizontalCenter: parent.horizontalCenter
72         text: "Top: " + doublevalidatorelement.top + " Bottom: " + doublevalidatorelement.bottom
73     }
74
75     SystemTestHelp { id: helpbubble; visible: statenum != 0
76         anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
77     }
78     BugPanel { id: bugpanel }
79
80
81
82     states: [
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" }
88         },
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." }
94         },
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" }
100         },
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." }
106         },
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" }
114         },
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." }
121         }
122     ]
123
124 }