on xenial help sign in
Merge trunk.
edd1e52Michał Sawicz
cmake/modules/QmlTest.cmake+4−4
@@ -51,7 +51,7 @@ macro(add_manual_qml_test SUBPATH COMPONENT_NAME)
51
51
52 set(qmlscene_command
52 set(qmlscene_command
53 env ${qmltest_ENVIRONMENT}
53 env ${qmltest_ENVIRONMENT}
54− ${qmlscene_exe} ${CMAKE_CURRENT_SOURCE_DIR}/${qmltest_FILE}.qml
54+ ${qmlscene_exe} -qmljsdebugger=port:3768 ${CMAKE_CURRENT_SOURCE_DIR}/${qmltest_FILE}.qml
55 ${qmlscene_imports}
55 ${qmlscene_imports}
56 )
56 )
57 add_custom_target(${qmlscene_TARGET} ${qmlscene_command})
57 add_custom_target(${qmlscene_TARGET} ${qmlscene_command})
@@ -111,9 +111,9 @@ macro(add_qml_test_internal SUBPATH COMPONENT_NAME ITERATIONS)
111 -o -,txt
111 -o -,txt
112 ${function_ARGS}
112 ${function_ARGS}
113 )
113 )
114− find_program( HAVE_GCC gcc )
114+ find_program(DPKG dpkg-architecture)
115− if (NOT ${HAVE_GCC} STREQUAL "")
115+ if(DPKG)
116− exec_program( gcc ARGS "-dumpmachine" OUTPUT_VARIABLE ARCH_TRIPLET )
116+ exec_program(${DPKG} ARGS "-qDEB_BUILD_MULTIARCH" OUTPUT_VARIABLE ARCH_TRIPLET )
117 set(LD_PRELOAD_PATH "LD_PRELOAD=/usr/lib/${ARCH_TRIPLET}/mesa/libGL.so.1")
117 set(LD_PRELOAD_PATH "LD_PRELOAD=/usr/lib/${ARCH_TRIPLET}/mesa/libGL.so.1")
118 endif()
118 endif()
119 set(qmltest_xvfb_command
119 set(qmltest_xvfb_command
debian/changelog+41
@@ -1,3 +1,44 @@
1+unity8 (7.86+14.10.20140527-0ubuntu1) utopic; urgency=low
2+
3+ [ Andrea Cimitan ]
4+ * Passes to make tryCommand -qmljsdebugger=port:3768 to enable
5+ debug/profiling test apps
6+ * Fixes carousel shadow
7+
8+ [ Michał Sawicz ]
9+ * Use dpkg-architecture, not gcc, to determine the machine triplet.
10+
11+ [ Ying-Chun Liu ]
12+ * Fix ZoomableImage test failure. (LP: #1317254)
13+
14+ [ Albert Astals ]
15+ * We don't need iconutils in this mock
16+ * Don't reserve space for mascot if no mascot is specified (LP:
17+ #1319343)
18+ * CardHeader is no more, remove stale line in CMakeLists.txt
19+ * GenericScopeViewTest: Wait a bit more Otherwise sometimes we end
20+ getting up the wrong delegate (maybe one that will be garbage
21+ collected?) (LP: #1322279)
22+ * Fix crash in organicgridtest
23+
24+ [ Daniel d'Andrada ]
25+ * Remove Shell's underlay background image as it cannot be seen
26+ anymore Now that the Dash has its own, opaque, background, the
27+ underlay's background image can no longer be seen. So it's just a
28+ waste of resources to have it.
29+
30+ [ Michael Terry ]
31+ * Use the same animation when dismissing a greeter slide from the
32+ launcher as from a normal greeter drag. (LP: #1316513)
33+
34+ [ Michael Zanetti ]
35+ * enhance lockscreen add a retry indication label (e.g. 3 attempts
36+ left). add an additional label (e.g. phone number for multi sim).
37+ add a infoPopup (e.g. to display a warning for last retry). add min
38+ and max limit values. add tests for the above (LP: #1302050)
39+
40+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 27 May 2014 07:47:11 +0000
41+
1unity8 (7.86+14.10.20140522-0ubuntu1) utopic; urgency=low
42unity8 (7.86+14.10.20140522-0ubuntu1) utopic; urgency=low
2
43
3 [ Albert Astals ]
44 [ Albert Astals ]
plugins/Dash/CardCreator.js+3−3
@@ -70,10 +70,9 @@ var kArtShapeHolderCode = 'Item { \n\
70 radius: "medium"; \n\
70 radius: "medium"; \n\
71 readonly property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
71 readonly property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
72 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect; \n\
72 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect; \n\
73− Component.onCompleted: updateWidthHeightBindings(); \n\
73+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } \n\
74 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings(); \n\
74 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings(); \n\
75 visible: image.status == Image.Ready; \n\
75 visible: image.status == Image.Ready; \n\
76− borderSource: artShapeBorderSource; \n\
77 function updateWidthHeightBindings() { \n\
76 function updateWidthHeightBindings() { \n\
78 if (aspectSmallerThanImageAspect) { \n\
77 if (aspectSmallerThanImageAspect) { \n\
79 width = Qt.binding(function() { return !visible ? 0 : image.width }); \n\
78 width = Qt.binding(function() { return !visible ? 0 : image.width }); \n\
@@ -281,7 +280,7 @@ function cardString(template, components) {
281 property var template; \n\
280 property var template; \n\
282 property var components; \n\
281 property var components; \n\
283 property var cardData; \n\
282 property var cardData; \n\
284− property var artShapeBorderSource; \n\
283+ property var artShapeBorderSource: undefined; \n\
285 property real fontScale: 1.0; \n\
284 property real fontScale: 1.0; \n\
286 property int headerAlignment: Text.AlignLeft; \n\
285 property int headerAlignment: Text.AlignLeft; \n\
287 property int fixedHeaderHeight: -1; \n\
286 property int fixedHeaderHeight: -1; \n\
@@ -307,6 +306,7 @@ function cardString(template, components) {
307 }
306 }
308
307
309 if (hasArt) {
308 if (hasArt) {
309+ code += 'onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; } \n';
310 code += 'readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);\n';
310 code += 'readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);\n';
311
311
312 var widthCode, heightCode;
312 var widthCode, heightCode;
plugins/Dash/abstractdashview.cpp+3
@@ -176,6 +176,9 @@ void AbstractDashView::refill()
176
176
177bool AbstractDashView::addVisibleItems(qreal fillFromY, qreal fillToY, bool asynchronous)
177bool AbstractDashView::addVisibleItems(qreal fillFromY, qreal fillToY, bool asynchronous)
178{
178{
179+ if (fillToY <= fillFromY)
180+ return false;
181+
179 if (!delegate())
182 if (!delegate())
180 return false;
183 return false;
181
184
po/unity8.pot+11−7
@@ -8,7 +8,7 @@ msgid ""
8msgstr ""
8msgstr ""
9"Project-Id-Version: unity8\n"
9"Project-Id-Version: unity8\n"
10"Report-Msgid-Bugs-To: \n"
10"Report-Msgid-Bugs-To: \n"
11−"POT-Creation-Date: 2014-05-27 14:52+0200\n"
11+"POT-Creation-Date: 2014-05-27 22:48+0200\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -117,24 +117,28 @@ msgstr ""
117msgid "Swipe to unlock"
117msgid "Swipe to unlock"
118msgstr ""
118msgstr ""
119
119
120−#: qml/Greeter/Lockscreen.qml:149
120+#: qml/Greeter/Lockscreen.qml:215
121msgid "Emergency Call"
121msgid "Emergency Call"
122msgstr ""
122msgstr ""
123
123
124+#: qml/Greeter/Lockscreen.qml:232
125+msgid "OK"
126+msgstr ""
127+
124−#: qml/Greeter/PassphraseLockscreen.qml:59
128+#: qml/Greeter/PassphraseLockscreen.qml:60
125#, qt-format
129#, qt-format
126msgid "Hello %1"
130msgid "Hello %1"
127msgstr ""
131msgstr ""
128
132
129−#: qml/Greeter/PassphraseLockscreen.qml:59
133+#: qml/Greeter/PassphraseLockscreen.qml:60
130msgid "Hello"
134msgid "Hello"
131msgstr ""
135msgstr ""
132
136
133−#: qml/Greeter/PinLockscreen.qml:180
137+#: qml/Greeter/PinLockscreen.qml:198
134msgid "CANCEL"
138msgid "CANCEL"
135msgstr ""
139msgstr ""
136
140
137−#: qml/Greeter/PinLockscreen.qml:198
141+#: qml/Greeter/PinLockscreen.qml:216
138msgid "DONE"
142msgid "DONE"
139msgstr ""
143msgstr ""
140
144
@@ -170,7 +174,7 @@ msgstr ""
170msgid "Search"
174msgid "Search"
171msgstr ""
175msgstr ""
172
176
173−#: qml/Shell.qml:342
177+#: qml/Shell.qml:334
174#, qt-format
178#, qt-format
175msgid "Please enter %1"
179msgid "Please enter %1"
176msgstr ""
180msgstr ""
qml/Components/PinPadButton.qml+2−1
@@ -19,6 +19,7 @@ import Ubuntu.Components 0.1
19
19
20Item {
20Item {
21 id: root
21 id: root
22+ opacity: enabled ? 1 : 0.6
22
23
23 property alias text: label.text
24 property alias text: label.text
24 property alias subText: subTextLabel.text
25 property alias subText: subTextLabel.text
@@ -62,7 +63,7 @@ Item {
62 Label {
63 Label {
63 id: subTextLabel
64 id: subTextLabel
64 fontSize: "small"
65 fontSize: "small"
65− color: "grey"
66+ color: "#f3f3e7"
66 anchors.horizontalCenter: parent.horizontalCenter
67 anchors.horizontalCenter: parent.horizontalCenter
67 visible: text.length > 0
68 visible: text.length > 0
68 }
69 }
qml/Dash/CardCarousel.qml+1−1
@@ -34,7 +34,7 @@ DashRenderer {
34 Carousel {
34 Carousel {
35 id: carousel
35 id: carousel
36 anchors.fill: parent
36 anchors.fill: parent
37− tileAspectRatio: cardCarousel.components && cardCarousel.components["art"]["aspect-ratio"] || 1.0
37+ tileAspectRatio: cardTool.components && cardTool.components["art"]["aspect-ratio"] || 1.0
38 // FIXME we need to "reverse" the carousel to make the selected item the size
38 // FIXME we need to "reverse" the carousel to make the selected item the size
39 // and push others back.
39 // and push others back.
40 minimumTileWidth: cardTool.cardWidth / selectedItemScaleFactor
40 minimumTileWidth: cardTool.cardWidth / selectedItemScaleFactor
qml/Dash/GenericScopeView.qml+1−1
@@ -128,7 +128,7 @@ FocusScope {
128
128
129 CardTool {
129 CardTool {
130 id: cardTool
130 id: cardTool
131−
131+ objectName: "cardTool"
132 count: results.count
132 count: results.count
133 template: model.renderer
133 template: model.renderer
134 components: model.components
134 components: model.components
qml/Dash/Previews/PreviewHeader.qml+3
@@ -56,6 +56,9 @@ PreviewWidget {
56
56
57 Loader {
57 Loader {
58 id: mascotShapeLoader
58 id: mascotShapeLoader
59+ objectName: "mascotShapeLoader"
60+ active: headerRoot.mascot != ""
61+ visible: active
59
62
60 anchors.verticalCenter: parent.verticalCenter
63 anchors.verticalCenter: parent.verticalCenter
61 // TODO karni: Icon aspect-ratio is 8:7.5. Revisit these values to avoid fraction of pixels.
64 // TODO karni: Icon aspect-ratio is 8:7.5. Revisit these values to avoid fraction of pixels.
qml/Greeter/Lockscreen.qml+91−7
@@ -15,7 +15,8 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18−import Ubuntu.Components 0.1
18+import Ubuntu.Components 1.0
19+import Ubuntu.Components.Popups 1.0
19import "../Components"
20import "../Components"
20
21
21Showable {
22Showable {
@@ -26,19 +27,34 @@ Showable {
26
27
27 // Placeholder text
28 // Placeholder text
28 property string placeholderText: ""
29 property string placeholderText: ""
30+ // Placeholder text while shaking (e.g. Incorrect passprase)
31+ property string wrongPlaceholderText: ""
32+ // Retries text (e.g. 3 retries left)
33+ property string retryText: ""
34+
35+ // Informational text. (e.g. some text to tell which domain this is pin is entered for.
36+ property string infoText: ""
29
37
30 // In case the Lockscreen can show a greeter message, this is the username
38 // In case the Lockscreen can show a greeter message, this is the username
31 property string username: ""
39 property string username: ""
32
40
33− // Set this to a value greater 0 to enable auto-confirm behavior for the lockscreen.
41+ // Set those to a value greater 0 to restrict the pin length.
42+ // If both are unset, the Lockscreen will show a confirm button and allow typing any length of pin before
43+ // confirming. If minPinLength is set to a value > 0, the confirm button will only become active when the
44+ // entered pin is at least that long. If maxPinLength is set, the lockscreen won't allow entering any
45+ // more numbers than that. If both are set to the same value, the lockscreen will enter auto confirming
46+ // behavior, hiding the confirmation button and triggering that automatically when the entered pin reached
34− // This is ignored by the alphaNumeric lockscreen as that one is confirmed with pressing enter on the OSK.
47+ // that length. This is ignored by the alphaNumeric lockscreen as that one is always confirmed by pressing
48+ // enter on the OSK.
35− property int pinLength: -1
49+ property int minPinLength: -1
50+ property int maxPinLength: -1
36
51
37 property url background: ""
52 property url background: ""
38
53
39 signal entered(string passphrase)
54 signal entered(string passphrase)
40 signal cancel()
55 signal cancel()
41 signal emergencyCall()
56 signal emergencyCall()
57+ signal infoPopupConfirmed()
42
58
43 onRequiredChanged: {
59 onRequiredChanged: {
44 if (required && pinPadLoader.item) {
60 if (required && pinPadLoader.item) {
@@ -56,6 +72,10 @@ Showable {
56 pinPadLoader.item.clear(showAnimation);
72 pinPadLoader.item.clear(showAnimation);
57 }
73 }
58
74
75+ function showInfoPopup(title, text) {
76+ PopupUtils.open(infoPopupComponent, root, {title: title, text: text})
77+ }
78+
59 Rectangle {
79 Rectangle {
60 // In case background fails to load or is undefined
80 // In case background fails to load or is undefined
61 id: backgroundBackup
81 id: backgroundBackup
@@ -68,7 +88,6 @@ Showable {
68 objectName: "lockscreenBackground"
88 objectName: "lockscreenBackground"
69 anchors {
89 anchors {
70 fill: parent
90 fill: parent
71− topMargin: backgroundTopMargin
72 }
91 }
73 source: root.required ? root.background : ""
92 source: root.required ? root.background : ""
74 fillMode: Image.PreserveAspectCrop
93 fillMode: Image.PreserveAspectCrop
@@ -78,6 +97,43 @@ Showable {
78 anchors.fill: root
97 anchors.fill: root
79 }
98 }
80
99
100+ Column {
101+ spacing: units.gu(2)
102+ anchors {
103+ left: parent.left
104+ right: parent.right
105+ bottom: pinPadLoader.top
106+ bottomMargin: units.gu(2)
107+ }
108+ Label {
109+ objectName: "retryCountLabel"
110+ anchors {
111+ left: parent.left
112+ right: parent.right
113+ }
114+ text: root.retryText
115+ horizontalAlignment: Text.AlignHCenter
116+ color: "#f3f3e7"
117+ opacity: 0.6
118+ visible: root.retryText.length > 0
119+ }
120+ Label {
121+ id: infoTextLabel
122+ objectName: "infoTextLabel"
123+ anchors {
124+ left: parent.left
125+ right: parent.right
126+ }
127+ text: root.infoText
128+ horizontalAlignment: Text.AlignHCenter
129+ color: "#f3f3e7"
130+ opacity: 0.6
131+ visible: root.infoText.length > 0
132+ }
133+ }
134+
135+
136+
81 Loader {
137 Loader {
82 id: pinPadLoader
138 id: pinPadLoader
83 objectName: "pinPadLoader"
139 objectName: "pinPadLoader"
@@ -105,14 +161,24 @@ Showable {
105
161
106 Binding {
162 Binding {
107 target: pinPadLoader.item
163 target: pinPadLoader.item
108− property: "pinLength"
164+ property: "minPinLength"
165+ value: root.minPinLength
166+ }
167+ Binding {
168+ target: pinPadLoader.item
169+ property: "maxPinLength"
109− value: root.pinLength
170+ value: root.maxPinLength
110 }
171 }
111 Binding {
172 Binding {
112 target: pinPadLoader.item
173 target: pinPadLoader.item
113 property: "placeholderText"
174 property: "placeholderText"
114 value: root.placeholderText
175 value: root.placeholderText
115 }
176 }
177+ Binding {
178+ target: pinPadLoader.item
179+ property: "wrongPlaceholderText"
180+ value: root.wrongPlaceholderText
181+ }
116 Binding {
182 Binding {
117 target: pinPadLoader.item
183 target: pinPadLoader.item
118 property: "username"
184 property: "username"
@@ -153,4 +219,22 @@ Showable {
153 anchors.horizontalCenter: parent.horizontalCenter
219 anchors.horizontalCenter: parent.horizontalCenter
154 }
220 }
155 }
221 }
222+
223+ Component {
224+ id: infoPopupComponent
225+ Dialog {
226+ id: dialog
227+ objectName: "infoPopup"
228+ modal: true
229+
230+ Button {
231+ objectName: "infoPopupOkButton"
232+ text: i18n.tr("OK")
233+ onClicked: {
234+ PopupUtils.close(dialog)
235+ root.infoPopupConfirmed();
236+ }
237+ }
238+ }
239+ }
156}
240}
qml/Greeter/PassphraseLockscreen.qml+6−2
@@ -22,7 +22,8 @@ Item {
22 id: root
22 id: root
23 height: highlightItem.height
23 height: highlightItem.height
24
24
25− property alias placeholderText: pinentryField.placeholderText
25+ property string placeholderText
26+ property string wrongPlaceholderText
26 property string username: ""
27 property string username: ""
27
28
28 signal entered(string passphrase)
29 signal entered(string passphrase)
@@ -73,9 +74,12 @@ Item {
73 echoMode: TextInput.Password
74 echoMode: TextInput.Password
74 opacity: 0.9
75 opacity: 0.9
75 hasClearButton: false
76 hasClearButton: false
77+ placeholderText: wrongPasswordAnimation.running ? root.wrongPlaceholderText : root.placeholderText
76
78
77 onAccepted: {
79 onAccepted: {
80+ if (pinentryField.text) {
78− root.entered(pinentryField.text);
81+ root.entered(pinentryField.text);
82+ }
79 }
83 }
80 }
84 }
81 }
85 }
qml/Greeter/PinLockscreen.qml+29−11
@@ -25,9 +25,11 @@ Column {
25 spacing: units.gu(3.5)
25 spacing: units.gu(3.5)
26
26
27 property alias placeholderText: pinentryField.placeholderText
27 property alias placeholderText: pinentryField.placeholderText
28+ property alias wrongPlaceholderText: pinentryField.wrongPlaceholderText
28 property int padWidth: units.gu(34)
29 property int padWidth: units.gu(34)
29 property int padHeight: units.gu(28)
30 property int padHeight: units.gu(28)
30− property int pinLength: -1
31+ property int minPinLength: -1
32+ property int maxPinLength: -1
31
33
32 signal entered(string passphrase)
34 signal entered(string passphrase)
33 signal cancel()
35 signal cancel()
@@ -41,6 +43,10 @@ Column {
41 }
43 }
42 }
44 }
43
45
46+ QtObject {
47+ id: priv
48+ property bool autoConfirm: root.minPinLength == root.maxPinLength && root.minPinLength != -1
49+ }
44
50
45 UbuntuShape {
51 UbuntuShape {
46 id: pinentryField
52 id: pinentryField
@@ -52,12 +58,20 @@ Column {
52 radius: "medium"
58 radius: "medium"
53 property string text: ""
59 property string text: ""
54 property string placeholderText: ""
60 property string placeholderText: ""
61+ property string wrongPlaceholderText: ""
62+
63+ function appendChar(character) {
64+ if (root.maxPinLength == -1 || pinentryField.text.length < root.maxPinLength) {
65+ pinentryField.text = pinentryField.text + character;
66+ }
67+ }
68+
55 onTextChanged: {
69 onTextChanged: {
56 pinentryFieldLabel.text = "";
70 pinentryFieldLabel.text = "";
57 for (var i = 0; i < text.length; ++i) {
71 for (var i = 0; i < text.length; ++i) {
58 pinentryFieldLabel.text += "•";
72 pinentryFieldLabel.text += "•";
59 }
73 }
60− if (text.length === root.pinLength) {
74+ if (priv.autoConfirm && text.length === root.maxPinLength) {
61 root.entered(text);
75 root.entered(text);
62 }
76 }
63 }
77 }
@@ -74,9 +88,11 @@ Column {
74 }
88 }
75 Label {
89 Label {
76 id: pinentryFieldPlaceHolder
90 id: pinentryFieldPlaceHolder
91+ objectName: "pinentryFieldPlaceHolder"
77 anchors.centerIn: parent
92 anchors.centerIn: parent
78− color: "grey"
93+ color: "#f3f3e7"
94+ opacity: 0.6
79− text: parent.placeholderText
95+ text: wrongPasswordAnimation.running ? parent.wrongPlaceholderText : parent.placeholderText
80 visible: pinentryFieldLabel.text.length == 0
96 visible: pinentryFieldLabel.text.length == 0
81 }
97 }
82
98
@@ -91,9 +107,11 @@ Column {
91 bottom: parent.bottom
107 bottom: parent.bottom
92 bottomMargin: units.gu(1)
108 bottomMargin: units.gu(1)
93 }
109 }
94− visible: root.pinLength == -1
110+ visible: !priv.autoConfirm
95 width: height
111 width: height
96 name: "erase"
112 name: "erase"
113+ color: "#f3f3e7"
114+ opacity: 0.6
97 MouseArea {
115 MouseArea {
98 anchors.fill: parent
116 anchors.fill: parent
99 onClicked: pinentryField.text = pinentryField.text.substring(0, pinentryField.text.length-1);
117 onClicked: pinentryField.text = pinentryField.text.substring(0, pinentryField.text.length-1);
@@ -168,7 +186,7 @@ Column {
168 enabled: entryEnabled
186 enabled: entryEnabled
169
187
170 onClicked: {
188 onClicked: {
171− pinentryField.text = pinentryField.text + text;
189+ pinentryField.appendChar(text);
172 }
190 }
173 }
191 }
174 }
192 }
@@ -186,7 +204,7 @@ Column {
186 width: root.padWidth / 3
204 width: root.padWidth / 3
187 height: root.padHeight / 4
205 height: root.padHeight / 4
188 text: "0"
206 text: "0"
189− onClicked: pinentryField.text = pinentryField.text + text
207+ onClicked: pinentryField.appendChar(text);
190 enabled: entryEnabled
208 enabled: entryEnabled
191 }
209 }
192
210
@@ -194,16 +212,16 @@ Column {
194 objectName: "pinPadButtonErase"
212 objectName: "pinPadButtonErase"
195 width: root.padWidth / 3
213 width: root.padWidth / 3
196 height: root.padHeight / 4
214 height: root.padHeight / 4
197− iconName: root.pinLength == -1 ? "" : "erase"
215+ iconName: priv.autoConfirm ? "erase" : ""
198− subText: root.pinLength == -1 ? i18n.tr("DONE") : ""
216+ subText: priv.autoConfirm ? "" : i18n.tr("DONE")
199 onClicked: {
217 onClicked: {
200− if (root.pinLength !== -1) {
218+ if (priv.autoConfirm) {
201 pinentryField.text = pinentryField.text.substring(0, pinentryField.text.length-1);
219 pinentryField.text = pinentryField.text.substring(0, pinentryField.text.length-1);
202 } else {
220 } else {
203 root.entered(pinentryField.text);
221 root.entered(pinentryField.text);
204 }
222 }
205 }
223 }
206− enabled: entryEnabled
224+ enabled: priv.autoConfirm ? entryEnabled : pinentryField.text.length >= root.minPinLength
207 }
225 }
208 }
226 }
209 }
227 }
qml/Shell.qml+6−11
@@ -117,15 +117,6 @@ FocusScope {
117 // through the translucent parts of the shell surface.
117 // through the translucent parts of the shell surface.
118 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
118 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
119
119
120− CrossFadeImage {
121− id: backgroundImage
122− objectName: "backgroundImage"
123−
124− anchors.fill: parent
125− source: shell.background
126− fillMode: Image.PreserveAspectCrop
127− }
128−
129 Rectangle {
120 Rectangle {
130 anchors.fill: parent
121 anchors.fill: parent
131 color: "black"
122 color: "black"
@@ -316,7 +307,8 @@ FocusScope {
316 width: parent.width
307 width: parent.width
317 height: parent.height - panel.panelHeight
308 height: parent.height - panel.panelHeight
318 background: shell.background
309 background: shell.background
319− pinLength: 4
310+ minPinLength: 4
311+ maxPinLength: 4
320
312
321 onEntered: LightDM.Greeter.respond(passphrase);
313 onEntered: LightDM.Greeter.respond(passphrase);
322 onCancel: greeter.show()
314 onCancel: greeter.show()
@@ -370,7 +362,10 @@ FocusScope {
370 width: parent.width
362 width: parent.width
371 height: parent.height - panel.panelHeight
363 height: parent.height - panel.panelHeight
372
364
373− Behavior on x {SmoothedAnimation{velocity: 600}}
365+ Behavior on x {
366+ enabled: !launcher.dashSwipe
367+ StandardAnimation {}
368+ }
374
369
375 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
370 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
376
371
tests/autopilot/unity8/shell/emulators/main_window.py−4
@@ -114,10 +114,6 @@ class QQuickView(emulators.UnityEmulatorBase):
114 self.wait_select_single('Indicators', fullyOpened=True)
114 self.wait_select_single('Indicators', fullyOpened=True)
115 return self._get_indicator_page(indicator_name)
115 return self._get_indicator_page(indicator_name)
116
116
117− def get_shell_background(self):
118− return self.select_single(
119− "CrossFadeImage", objectName="backgroundImage")
120−
121 @autopilot_logging.log_action(logger.info)
117 @autopilot_logging.log_action(logger.info)
122 def show_dash_swiping(self):
118 def show_dash_swiping(self):
123 """Show the dash swiping from the left."""
119 """Show the dash swiping from the left."""
tests/mocks/Unity/CMakeLists.txt−1
@@ -19,7 +19,6 @@ include_directories(
19add_definitions(-DQT_NO_KEYWORDS)
19add_definitions(-DQT_NO_KEYWORDS)
20
20
21set(UnityQML_SOURCES
21set(UnityQML_SOURCES
22− iconutils.cpp
23 fake_scope.cpp
22 fake_scope.cpp
24 fake_scopes.cpp
23 fake_scopes.cpp
25 fake_categories.cpp
24 fake_categories.cpp
tests/mocks/Unity/fake_categories.cpp+5−1
@@ -152,7 +152,11 @@ Categories::data(const QModelIndex& index, int role) const
152 case RoleComponents:
152 case RoleComponents:
153 {
153 {
154 QVariantMap map, artMap;
154 QVariantMap map, artMap;
155+ if (index.row() % 2 != 0) {
155− artMap["aspect-ratio"] = "1.0";
156+ artMap["aspect-ratio"] = QString("1.%1").arg(index.row());
157+ } else {
158+ artMap["aspect-ratio"] = "1.0";
159+ }
156 artMap["field"] = "art";
160 artMap["field"] = "art";
157 map["art"] = artMap;
161 map["art"] = artMap;
158 map["title"] = "HOLA";
162 map["title"] = "HOLA";
tests/mocks/Unity/iconutils.cppdeleted−124
@@ -1,124 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Michal Hruby <michal.hruby@canonical.com>
18− */
19−
20−#include "iconutils.h"
21−
22−#include <gio/gio.h>
23−
24−#include <QStringList>
25−#include <QUrl>
26−#include <QUrlQuery>
27−
28−#define BASE_THEME_ICON_URI "image://theme/"
29−#define BASE_THUMBNAILER_URI "image://thumbnailer/"
30−#define BASE_ALBUMART_URI "image://albumart/"
31−
32−QString gIconToDeclarativeImageProviderString(QString const &giconString)
33−{
34− if (giconString.isEmpty()) return giconString;
35−
36− if (giconString.startsWith('/') || giconString.startsWith(QLatin1String("http")) ||
37− giconString.startsWith(QLatin1String("file:")) || giconString.startsWith(QLatin1String("image:"))) {
38− return giconString;
39− }
40−
41− if (!giconString.startsWith(QLatin1String(". "))) {
42− // must be a themed icon
43− QString themedIcon(BASE_THEME_ICON_URI);
44− themedIcon.append(giconString);
45− return themedIcon;
46− }
47−
48− // special case annotated icon
49− if (giconString.startsWith(QLatin1String(". UnityProtocolAnnotatedIcon "))) {
50− QString annotatedIcon;
51− QString serializedData(QUrl::fromPercentEncoding(giconString.mid(29).toUtf8()));
52− GVariant *variant = g_variant_parse(G_VARIANT_TYPE_VARDICT, serializedData.toUtf8().constData(), NULL, NULL, NULL);
53− gchar *baseUri;
54− if (variant != NULL && g_variant_lookup(variant, "base-icon", "&s", &baseUri)) {
55− annotatedIcon = gIconToDeclarativeImageProviderString(QString(baseUri));
56− // FIXME: enclose in image://annotated/... once unity supports that
57− }
58− if (variant != NULL) g_variant_unref(variant);
59−
60− return annotatedIcon;
61− }
62−
63− // handle real gicon strings
64− QString result;
65− GError *error = NULL;
66− GIcon *icon = g_icon_new_for_string(giconString.toLocal8Bit().constData(), &error);
67− if (error != NULL || icon == NULL) {
68− qWarning("Unable to deserialize icon: %s", giconString.toLocal8Bit().constData());
69− g_clear_error(&error);
70− return result;
71− }
72−
73− if (G_IS_THEMED_ICON(icon)) {
74− QString themedIcon(BASE_THEME_ICON_URI);
75− QStringList list;
76− const char* const *iconNames = g_themed_icon_get_names(G_THEMED_ICON(icon));
77− if (iconNames != NULL) {
78− for (const char * const *iter = iconNames; *iter != NULL; ++iter) {
79− list << QLatin1String(*iter);
80− }
81− }
82− themedIcon.append(list.join(QString(",")));
83− result = themedIcon;
84− } else if (G_IS_FILE_ICON(icon)) {
85− GFile *file = g_file_icon_get_file(G_FILE_ICON(icon));
86− gchar *uri = g_file_get_uri(file);
87− QString iconUri(uri);
88− g_free(uri);
89− result = iconUri;
90− }
91−
92− g_object_unref(icon);
93−
94− return result;
95−}
96−
97−QString uriToThumbnailerProviderString(QString const &uri, QString const &mimetype, QVariantHash const &metadata)
98−{
99− if (uri.startsWith(QLatin1String("file:///"))) {
100− bool isAudio = mimetype.startsWith(QLatin1String("audio/"));
101− QString thumbnailerUri;
102− if (isAudio) {
103− thumbnailerUri = BASE_ALBUMART_URI;
104− if (metadata.contains("content")) {
105− QVariantHash contentHash = metadata["content"].toHash();
106− if (contentHash.contains("content")) { // nested content in Home?
107− contentHash = contentHash["content"].toHash();
108− }
109− if (contentHash.contains("album") && contentHash.contains("artist")) {
110− QUrlQuery query;
111− query.addQueryItem(QStringLiteral("artist"), contentHash["artist"].toString());
112− query.addQueryItem(QStringLiteral("album"), contentHash["album"].toString());
113− thumbnailerUri.append(query.toString());
114− }
115− }
116− } else {
117− thumbnailerUri = BASE_THUMBNAILER_URI;
118− thumbnailerUri.append(uri.midRef(7));
119− }
120− return thumbnailerUri;
121− }
122−
123− return QString::null;
124−}
tests/mocks/Unity/iconutils.hdeleted−29
@@ -1,29 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Michal Hruby <michal.hruby@canonical.com>
18− */
19−
20−#ifndef ICONUTILS_H
21−#define ICONUTILS_H
22−
23−#include <QString>
24−#include <QVariant>
25−
26−QString gIconToDeclarativeImageProviderString(QString const &giconString);
27−QString uriToThumbnailerProviderString(QString const &uri, QString const &mimetype, QVariantHash const &metadata);
28−
29−#endif
tests/plugins/Dash/cardcreator/1.res+3−3
@@ -3,7 +3,7 @@ AbstractButton {
3 property var template;
3 property var template;
4 property var components;
4 property var components;
5 property var cardData;
5 property var cardData;
6− property var artShapeBorderSource;
6+ property var artShapeBorderSource: undefined;
7 property real fontScale: 1.0;
7 property real fontScale: 1.0;
8 property int headerAlignment: Text.AlignLeft;
8 property int headerAlignment: Text.AlignLeft;
9 property int fixedHeaderHeight: -1;
9 property int fixedHeaderHeight: -1;
@@ -12,6 +12,7 @@ AbstractButton {
12 property bool asynchronous: true;
12 property bool asynchronous: true;
13 property bool showHeader: true;
13 property bool showHeader: true;
14 implicitWidth: childrenRect.width;
14 implicitWidth: childrenRect.width;
15+onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
15readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
16readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
16Item {
17Item {
17 id: artShapeHolder;
18 id: artShapeHolder;
@@ -30,10 +31,9 @@ Item {
30 radius: "medium";
31 radius: "medium";
31 readonly property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1;
32 readonly property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1;
32 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
33 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
33− Component.onCompleted: updateWidthHeightBindings();
34+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
34 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
35 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
35 visible: image.status == Image.Ready;
36 visible: image.status == Image.Ready;
36− borderSource: artShapeBorderSource;
37 function updateWidthHeightBindings() {
37 function updateWidthHeightBindings() {
38 if (aspectSmallerThanImageAspect) {
38 if (aspectSmallerThanImageAspect) {
39 width = Qt.binding(function() { return !visible ? 0 : image.width });
39 width = Qt.binding(function() { return !visible ? 0 : image.width });
tests/plugins/Dash/cardcreator/2.res+1−1
@@ -3,7 +3,7 @@ AbstractButton {
3 property var template;
3 property var template;
4 property var components;
4 property var components;
5 property var cardData;
5 property var cardData;
6− property var artShapeBorderSource;
6+ property var artShapeBorderSource: undefined;
7 property real fontScale: 1.0;
7 property real fontScale: 1.0;
8 property int headerAlignment: Text.AlignLeft;
8 property int headerAlignment: Text.AlignLeft;
9 property int fixedHeaderHeight: -1;
9 property int fixedHeaderHeight: -1;
tests/plugins/Dash/cardcreator/3.res+3−3
@@ -3,7 +3,7 @@ AbstractButton {
3 property var template;
3 property var template;
4 property var components;
4 property var components;
5 property var cardData;
5 property var cardData;
6− property var artShapeBorderSource;
6+ property var artShapeBorderSource: undefined;
7 property real fontScale: 1.0;
7 property real fontScale: 1.0;
8 property int headerAlignment: Text.AlignLeft;
8 property int headerAlignment: Text.AlignLeft;
9 property int fixedHeaderHeight: -1;
9 property int fixedHeaderHeight: -1;
@@ -12,6 +12,7 @@ AbstractButton {
12 property bool asynchronous: true;
12 property bool asynchronous: true;
13 property bool showHeader: true;
13 property bool showHeader: true;
14 implicitWidth: childrenRect.width;
14 implicitWidth: childrenRect.width;
15+onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
15readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
16readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
16Item {
17Item {
17 id: artShapeHolder;
18 id: artShapeHolder;
@@ -30,10 +31,9 @@ Item {
30 radius: "medium";
31 radius: "medium";
31 readonly property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1;
32 readonly property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1;
32 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
33 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
33− Component.onCompleted: updateWidthHeightBindings();
34+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
34 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
35 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
35 visible: image.status == Image.Ready;
36 visible: image.status == Image.Ready;
36− borderSource: artShapeBorderSource;
37 function updateWidthHeightBindings() {
37 function updateWidthHeightBindings() {
38 if (aspectSmallerThanImageAspect) {
38 if (aspectSmallerThanImageAspect) {
39 width = Qt.binding(function() { return !visible ? 0 : image.width });
39 width = Qt.binding(function() { return !visible ? 0 : image.width });
tests/plugins/Dash/cardcreator/4.res+1−1
@@ -3,7 +3,7 @@ AbstractButton {
3 property var template;
3 property var template;
4 property var components;
4 property var components;
5 property var cardData;
5 property var cardData;
6− property var artShapeBorderSource;
6+ property var artShapeBorderSource: undefined;
7 property real fontScale: 1.0;
7 property real fontScale: 1.0;
8 property int headerAlignment: Text.AlignLeft;
8 property int headerAlignment: Text.AlignLeft;
9 property int fixedHeaderHeight: -1;
9 property int fixedHeaderHeight: -1;
tests/plugins/Dash/cardcreator/5.res+3−3
@@ -3,7 +3,7 @@ AbstractButton {
3 property var template;
3 property var template;
4 property var components;
4 property var components;
5 property var cardData;
5 property var cardData;
6− property var artShapeBorderSource;
6+ property var artShapeBorderSource: undefined;
7 property real fontScale: 1.0;
7 property real fontScale: 1.0;
8 property int headerAlignment: Text.AlignLeft;
8 property int headerAlignment: Text.AlignLeft;
9 property int fixedHeaderHeight: -1;
9 property int fixedHeaderHeight: -1;
@@ -12,6 +12,7 @@ AbstractButton {
12 property bool asynchronous: true;
12 property bool asynchronous: true;
13 property bool showHeader: true;
13 property bool showHeader: true;
14 implicitWidth: childrenRect.width;
14 implicitWidth: childrenRect.width;
15+onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
15readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
16readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
16Item {
17Item {
17 id: artShapeHolder;
18 id: artShapeHolder;
@@ -30,10 +31,9 @@ Item {
30 radius: "medium";
31 radius: "medium";
31 readonly property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1;
32 readonly property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1;
32 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
33 readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
33− Component.onCompleted: updateWidthHeightBindings();
34+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
34 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
35 onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
35 visible: image.status == Image.Ready;
36 visible: image.status == Image.Ready;
36− borderSource: artShapeBorderSource;
37 function updateWidthHeightBindings() {
37 function updateWidthHeightBindings() {
38 if (aspectSmallerThanImageAspect) {
38 if (aspectSmallerThanImageAspect) {
39 width = Qt.binding(function() { return !visible ? 0 : image.width });
39 width = Qt.binding(function() { return !visible ? 0 : image.width });
tests/plugins/Dash/organicgridtest.cpp+5
@@ -514,6 +514,11 @@ private Q_SLOTS:
514
514
515 model->setCount(21);
515 model->setCount(21);
516
516
517+ QTRY_COMPARE(grid->m_visibleItems.count(), 0);
518+
519+ grid->setDisplayMarginBeginning(0);
520+ grid->setDisplayMarginEnd(0);
521+
517 // This is exactly the same block as the first again
522 // This is exactly the same block as the first again
518 checkInitialPositions();
523 checkInitialPositions();
519 }
524 }
tests/qmltests/CMakeLists.txt−1
@@ -36,7 +36,6 @@ add_qml_test(Dash Dash IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAUL
36add_qml_test(Dash DashContent IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
36add_qml_test(Dash DashContent IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
37add_qml_test(Dash Card IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
37add_qml_test(Dash Card IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
38add_qml_benchmark(Dash CardBenchmark 1000 IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
38add_qml_benchmark(Dash CardBenchmark 1000 IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
39−add_qml_test(Dash CardHeader)
40add_qml_test(Dash CardTool IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
39add_qml_test(Dash CardTool IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
41add_qml_test(Dash GenericScopeView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
40add_qml_test(Dash GenericScopeView IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
42add_qml_test(Dash/Apps RunningApplicationsGrid IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS}
41add_qml_test(Dash/Apps RunningApplicationsGrid IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS}
tests/qmltests/Components/tst_ZoomableImage.qml+21−19
@@ -98,22 +98,23 @@ Rectangle {
98 // move mouse to center
98 // move mouse to center
99 mouseMove(zoomableImage, zoomableImage.width / 2, zoomableImage.height / 2);
99 mouseMove(zoomableImage, zoomableImage.width / 2, zoomableImage.height / 2);
100
100
101+ var oldScale = image.scale;
101 // Test Zoom-in Zoom-out twice.
102 // Test Zoom-in Zoom-out twice.
102 for (var c=0; c<2; c++) {
103 for (var c=0; c<2; c++) {
103 // zoom in
104 // zoom in
104 for (var i=0; i<10; i++) {
105 for (var i=0; i<10; i++) {
105 mouseWheel(zoomableImage, zoomableImage.width / 2, zoomableImage.height / 2, 0, 10);
106 mouseWheel(zoomableImage, zoomableImage.width / 2, zoomableImage.height / 2, 0, 10);
106− tryCompare(image, "scale", 1.0 + (i + 1) * 0.1);
107+ tryCompare(image, "scale", oldScale + (i + 1) * 0.1);
107− compare(flickable.contentWidth, lazyImage.width * image.scale);
108+ compare(flickable.contentWidth, Math.max(lazyImage.width * image.scale, flickable.width));
108− compare(flickable.contentHeight, lazyImage.height * image.scale);
109+ compare(flickable.contentHeight, Math.max(lazyImage.height * image.scale, flickable.height));
109 }
110 }
110
111
111 // zoom out
112 // zoom out
112 for (var i=0; i<10; i++) {
113 for (var i=0; i<10; i++) {
113 mouseWheel(zoomableImage, zoomableImage.width / 2, zoomableImage.height / 2, 0, -10);
114 mouseWheel(zoomableImage, zoomableImage.width / 2, zoomableImage.height / 2, 0, -10);
114− tryCompare(image, "scale", 2.0 - (i + 1) * 0.1);
115+ tryCompare(image, "scale", oldScale + 1.0 - (i + 1) * 0.1);
115− compare(flickable.contentWidth, lazyImage.width * image.scale);
116+ compare(flickable.contentWidth, Math.max(lazyImage.width * image.scale, flickable.width));
116− compare(flickable.contentHeight, lazyImage.height * image.scale);
117+ compare(flickable.contentHeight, Math.max(lazyImage.height * image.scale, flickable.height));
117 }
118 }
118 }
119 }
119 }
120 }
@@ -123,16 +124,12 @@ Rectangle {
123 zoomable:false,
124 zoomable:false,
124 answer1: true,
125 answer1: true,
125 answer2: false,
126 answer2: false,
126− answer3: true,
127+ answer3: true },
127− answer4: 1.0,
128− answer5: 1.0 },
129 { source:widgetData2["source"],
128 { source:widgetData2["source"],
130 zoomable:true,
129 zoomable:true,
131 answer1: false,
130 answer1: false,
132 answer2: true,
131 answer2: true,
133− answer3: false,
132+ answer3: false }
134− answer4: 1.7740461882048026,
135− answer5: 1.0 }
136 ]
133 ]
137 }
134 }
138
135
@@ -163,7 +160,7 @@ Rectangle {
163 var y2End = zoomableImage.height * 5 / 6;
160 var y2End = zoomableImage.height * 5 / 6;
164
161
165 var oldScale = image.scale;
162 var oldScale = image.scale;
166−
163+ var newScale = -1;
167 // move mouse to center
164 // move mouse to center
168 mouseMove(zoomableImage, zoomableImage.width / 2, zoomableImage.height / 2);
165 mouseMove(zoomableImage, zoomableImage.width / 2, zoomableImage.height / 2);
169
166
@@ -172,20 +169,25 @@ Rectangle {
172 wait(3000); // have to delay between two consequent pinch event.
169 wait(3000); // have to delay between two consequent pinch event.
173 // pinch zoom-in
170 // pinch zoom-in
174 touchPinch(zoomableImage, x1Start, y1Start, x1End, y1End, x2Start, y2Start, x2End, y2End);
171 touchPinch(zoomableImage, x1Start, y1Start, x1End, y1End, x2Start, y2Start, x2End, y2End);
172+ waitForRendering(image);
175
173
176− tryCompare(image, "scale", data.answer4);
174+ if (newScale == -1) {
177− var newScale = image.scale;
175+ newScale = image.scale;
176+ }
177+ tryCompare(image, "scale", newScale);
178 compare(newScale == oldScale, data.answer1, "scale factor not equal: "+ oldScale + "=?" + newScale);
178 compare(newScale == oldScale, data.answer1, "scale factor not equal: "+ oldScale + "=?" + newScale);
179 compare(newScale > oldScale, data.answer2, "scale factor didn't changed");
179 compare(newScale > oldScale, data.answer2, "scale factor didn't changed");
180 compare(signalSpy.count == 0, data.answer3, "scale signal count error");
180 compare(signalSpy.count == 0, data.answer3, "scale signal count error");
181− compare(newScale, data.answer4, "scale factor error");
181+ compare(image.scale, newScale, "scale factor error");
182− compare(flickable.contentWidth, lazyImage.width * image.scale);
182+ compare(flickable.contentWidth, Math.max(lazyImage.width * image.scale, flickable.width));
183− compare(flickable.contentHeight, lazyImage.height * image.scale);
183+ compare(flickable.contentHeight, Math.max(lazyImage.height * image.scale, flickable.height));
184
184
185 wait(3000); // have to delay between two consequent pinch event.
185 wait(3000); // have to delay between two consequent pinch event.
186 // pinch zoom-out
186 // pinch zoom-out
187 touchPinch(zoomableImage, x1End, y1End, x1Start, y1Start, x2End, y2End, x2Start, y2Start);
187 touchPinch(zoomableImage, x1End, y1End, x1Start, y1Start, x2End, y2End, x2Start, y2Start);
188− tryCompare(image, "scale", data.answer5);
188+ tryCompare(image, "scale", oldScale);
189+ compare(flickable.contentWidth, Math.max(lazyImage.width * image.scale, flickable.width));
190+ compare(flickable.contentHeight, Math.max(lazyImage.height * image.scale, flickable.height));
189 }
191 }
190 }
192 }
191 }
193 }
tests/qmltests/Dash/Previews/tst_PreviewHeader.qml+12−7
@@ -53,12 +53,12 @@ Rectangle {
53 name: "PreviewHeaderTest"
53 name: "PreviewHeaderTest"
54 when: windowShown
54 when: windowShown
55
55
56− property Item mascot: findChild(previewHeader, "mascotShape")
56+ property Item mascotShapeLoader: findChild(previewHeader, "mascotShapeLoader")
57 property Item outerRow: findChild(previewHeader, "outerRow")
57 property Item outerRow: findChild(previewHeader, "outerRow")
58 property Item column: findChild(previewHeader, "column")
58 property Item column: findChild(previewHeader, "column")
59
59
60 function initTestCase() {
60 function initTestCase() {
61− verify(typeof testCase.mascot === "object", "Couldn't find mascot object.");
61+ verify(typeof testCase.mascotShapeLoader === "object", "Couldn't find mascot loader object.");
62 verify(typeof testCase.outerRow === "object", "Couldn't find outerRow object.");
62 verify(typeof testCase.outerRow === "object", "Couldn't find outerRow object.");
63 verify(typeof testCase.column === "object", "Couldn't find column object.");
63 verify(typeof testCase.column === "object", "Couldn't find column object.");
64
64
@@ -70,9 +70,9 @@ Rectangle {
70
70
71 function test_mascot_data() {
71 function test_mascot_data() {
72 return [
72 return [
73− { tag: "Empty", source: "", visible: false },
73+ { tag: "Empty", source: "", loaderVisible: false, visible: false },
74− { tag: "Invalid", source: "bad_path", visible: false },
74+ { tag: "Invalid", source: "bad_path", loaderVisible: true, visible: false },
75− { tag: "Valid", source: "../graphics/play_button.png", visible: true },
75+ { tag: "Valid", source: "../graphics/play_button.png", loaderVisible: true, visible: true },
76 ]
76 ]
77 }
77 }
78
78
@@ -80,12 +80,17 @@ Rectangle {
80 headerjson.mascot = data.source;
80 headerjson.mascot = data.source;
81 previewHeader.widgetData = headerjson;
81 previewHeader.widgetData = headerjson;
82
82
83+ tryCompare(testCase.mascotShapeLoader, "visible", data.loaderVisible);
84+ if (data.loaderVisible) {
85+ tryCompareFunction(function() { return findChild(previewHeader, "mascotShape") != null }, true);
86+ var mascot = findChild(previewHeader, "mascotShape")
83− tryCompare(testCase.mascot, "visible", data.visible);
87+ tryCompare(mascot, "visible", data.visible);
88+ }
84 }
89 }
85
90
86 function test_dimensions_data() {
91 function test_dimensions_data() {
87 return [
92 return [
88− { tag: "Column width with mascot", object: column, width: previewHeader.width - mascot.width - outerRow.margins * 3, mascot: "artwork/avatar.png" },
93+ { tag: "Column width with mascot", object: column, width: previewHeader.width - mascotShapeLoader.width - outerRow.margins * 3, mascot: "artwork/avatar.png" },
89 { tag: "Header height", object: previewHeader, height: function() { return outerRow.height + outerRow.margins * 2 } },
94 { tag: "Header height", object: previewHeader, height: function() { return outerRow.height + outerRow.margins * 2 } },
90 ]
95 ]
91 }
96 }
tests/qmltests/Dash/Previews/tst_PreviewZoomableImage.qml+7−5
@@ -26,12 +26,12 @@ Rectangle {
26 color: "lightgrey"
26 color: "lightgrey"
27
27
28 property var widgetData0: {
28 property var widgetData0: {
29− "source": ""
29+ "source": Qt.resolvedUrl("../artwork/checkers.png"),
30+ "zoomable": false
30 }
31 }
31
32
32 property var widgetData1: {
33 property var widgetData1: {
33− "source": Qt.resolvedUrl("../artwork/checkers.png"),
34+ "source": ""
34− "zoomable": false
35 }
35 }
36
36
37 PreviewZoomableImage {
37 PreviewZoomableImage {
@@ -49,11 +49,13 @@ Rectangle {
49
49
50 zoomableImage.widgetData = widgetData0;
50 zoomableImage.widgetData = widgetData0;
51 waitForRendering(zoomableImage);
51 waitForRendering(zoomableImage);
52+ waitForRendering(image);
52− tryCompare(image, "imageState", "default");
53+ tryCompare(image, "imageState", "ready");
53
54
54 zoomableImage.widgetData = widgetData1;
55 zoomableImage.widgetData = widgetData1;
55 waitForRendering(zoomableImage);
56 waitForRendering(zoomableImage);
57+ waitForRendering(image);
56− tryCompare(image, "imageState", "ready");
58+ tryCompare(image, "imageState", "default");
57 }
59 }
58 }
60 }
59}
61}
tests/qmltests/Dash/tst_DashContent.qml+29−14
@@ -67,13 +67,17 @@ Item {
67 name: "DashContent"
67 name: "DashContent"
68 when: scopesModel.loaded && windowShown
68 when: scopesModel.loaded && windowShown
69
69
70− function init() {
70+ function loadScopes() {
71− scopesModel.clear();
72 scopeLoadedSpy.clear();
71 scopeLoadedSpy.clear();
73 scopesModel.load();
72 scopesModel.load();
74 tryCompare(scopeLoadedSpy, "count", 4);
73 tryCompare(scopeLoadedSpy, "count", 4);
75 }
74 }
76
75
76+ function init() {
77+ scopesModel.clear();
78+ loadScopes();
79+ }
80+
77 function cleanup() {
81 function cleanup() {
78 movementStartedSpy.clear();
82 movementStartedSpy.clear();
79 dashContent.visible = true;
83 dashContent.visible = true;
@@ -93,9 +97,7 @@ Item {
93 compare(dashContentList.count, 0, "DashContent should have 0 items when it starts");
97 compare(dashContentList.count, 0, "DashContent should have 0 items when it starts");
94 tryCompare(dashContentList, "currentIndex", -1);
98 tryCompare(dashContentList, "currentIndex", -1);
95
99
96− scopeLoadedSpy.clear();
100+ loadScopes();
97− scopesModel.load();
98− tryCompare(scopeLoadedSpy, "count", 4);
99
101
100 verify(dashContentList.currentIndex >= 0);
102 verify(dashContentList.currentIndex >= 0);
101 }
103 }
@@ -109,9 +111,7 @@ Item {
109 // pretend we're running after a model reset
111 // pretend we're running after a model reset
110 dashContentList.currentIndex = 27;
112 dashContentList.currentIndex = 27;
111
113
112− scopeLoadedSpy.clear();
114+ loadScopes();
113− scopesModel.load();
114− tryCompare(scopeLoadedSpy, "count", 4);
115
115
116 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < 5);
116 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < 5);
117 }
117 }
@@ -326,8 +326,6 @@ Item {
326 }
326 }
327
327
328 function test_previewOpenClose() {
328 function test_previewOpenClose() {
329− tryCompare(scopeLoadedSpy, "count", 4);
330−
331 var previewListView = findChild(dashContent, "dashContentPreviewList");
329 var previewListView = findChild(dashContent, "dashContentPreviewList");
332 tryCompare(previewListView, "open", false);
330 tryCompare(previewListView, "open", false);
333
331
@@ -352,8 +350,6 @@ Item {
352 },
350 },
353 true);
351 true);
354
352
355− tryCompare(scopeLoadedSpy, "count", 4);
356−
357 var previewListView = findChild(dashContent, "dashContentPreviewList");
353 var previewListView = findChild(dashContent, "dashContentPreviewList");
358 tryCompare(previewListView, "open", false);
354 tryCompare(previewListView, "open", false);
359
355
@@ -368,8 +364,6 @@ Item {
368 }
364 }
369
365
370 function test_previewCycle() {
366 function test_previewCycle() {
371− tryCompare(scopeLoadedSpy, "count", 4);
372−
373 var categoryListView = findChild(dashContent, "categoryListView");
367 var categoryListView = findChild(dashContent, "categoryListView");
374 categoryListView.positionAtBeginning();
368 categoryListView.positionAtBeginning();
375
369
@@ -392,5 +386,26 @@ Item {
392 }
386 }
393 closePreview();
387 closePreview();
394 }
388 }
389+
390+ function test_carouselAspectRatio() {
391+ tryCompareFunction(function() {
392+ var scope = findChild(dashContent, "MockScope1 loader");
393+ if (scope != null) {
394+ var dashCategory1 = findChild(scope, "dashCategory1");
395+ if (dashCategory1 != null) {
396+ var tile = findChild(dashCategory1, "carouselDelegate1");
397+ return tile != null;
398+ }
399+ }
400+ return false;
401+ },
402+ true);
403+
404+ var scope = findChild(dashContent, "MockScope1 loader");
405+ var dashCategory1 = findChild(scope, "dashCategory1");
406+ var cardTool = findChild(dashCategory1, "cardTool");
407+ var carouselLV = findChild(dashCategory1, "listView");
408+ verify(carouselLV.tileWidth / carouselLV.tileHeight == cardTool.components["art"]["aspect-ratio"]);
409+ }
395 }
410 }
396}
411}
tests/qmltests/Dash/tst_GenericScopeView.qml+1
@@ -126,6 +126,7 @@ Item {
126
126
127 function test_filter_expand_collapse() {
127 function test_filter_expand_collapse() {
128 // wait for the item to be there
128 // wait for the item to be there
129+ waitForRendering(genericScopeView);
129 tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader0") != null; }, true);
130 tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader0") != null; }, true);
130
131
131 var header = findChild(genericScopeView, "dashSectionHeader0")
132 var header = findChild(genericScopeView, "dashSectionHeader0")
tests/qmltests/Greeter/tst_Lockscreen.qml+208−30
@@ -23,25 +23,34 @@ import LightDM 0.1 as LightDM
23import Unity.Test 0.1 as UT
23import Unity.Test 0.1 as UT
24
24
25Rectangle {
25Rectangle {
26+ id: root
26− width: units.gu(60)
27+ width: units.gu(80)
27 height: units.gu(80)
28 height: units.gu(80)
28 color: "orange"
29 color: "orange"
29
30
30 Lockscreen {
31 Lockscreen {
31 id: lockscreen
32 id: lockscreen
32 anchors.fill: parent
33 anchors.fill: parent
33− anchors.rightMargin: units.gu(18)
34+ anchors.rightMargin: units.gu(30)
34 placeholderText: "Please enter your PIN"
35 placeholderText: "Please enter your PIN"
36+ wrongPlaceholderText: "Incorrect PIN"
37+ retryText: retryCountTextField.text
35 alphaNumeric: pinPadCheckBox.checked
38 alphaNumeric: pinPadCheckBox.checked
36− pinLength: pinLengthTextField.text
39+ minPinLength: minPinLengthTextField.text
40+ maxPinLength: maxPinLengthTextField.text
37 username: "Lola"
41 username: "Lola"
42+ background: "../../../qml/graphics/phone_background.jpg"
43+ infoText: infoTextTextField.text
38 }
44 }
39
45
40 Connections {
46 Connections {
41 target: lockscreen
47 target: lockscreen
42
48
43 onEmergencyCall: emergencyCheckBox.checked = true
49 onEmergencyCall: emergencyCheckBox.checked = true
50+ onEntered: {
44− onEntered: enteredLabel.text = passphrase
51+ enteredLabel.text = passphrase
52+ lockscreen.clear(true)
53+ }
45 }
54 }
46
55
47 Connections {
56 Connections {
@@ -49,9 +58,9 @@ Rectangle {
49
58
50 onShowPrompt: {
59 onShowPrompt: {
51 if (text.indexOf("PIN") >= 0) {
60 if (text.indexOf("PIN") >= 0) {
52− lockscreen.alphaNumeric = false
61+ pinPadCheckBox.checked = false
53 } else {
62 } else {
54− lockscreen.alphaNumeric = true
63+ pinPadCheckBox.checked = true
55 }
64 }
56 lockscreen.placeholderText = text;
65 lockscreen.placeholderText = text;
57 }
66 }
@@ -65,6 +74,7 @@ Rectangle {
65 Column {
74 Column {
66 anchors.fill: parent
75 anchors.fill: parent
67 anchors.margins: units.gu(1)
76 anchors.margins: units.gu(1)
77+ spacing: units.gu(1)
68
78
69 Row {
79 Row {
70 CheckBox {
80 CheckBox {
@@ -86,12 +96,32 @@ Rectangle {
86 }
96 }
87 Row {
97 Row {
88 TextField {
98 TextField {
89− id: pinLengthTextField
99+ id: minPinLengthTextField
90 width: units.gu(7)
100 width: units.gu(7)
91 text: "4"
101 text: "4"
92 }
102 }
93 Label {
103 Label {
104+ text: "Min PIN length"
105+ }
106+ }
107+ Row {
108+ TextField {
109+ id: maxPinLengthTextField
110+ width: units.gu(7)
111+ text: "4"
112+ }
113+ Label {
94− text: "PIN length"
114+ text: "Max PIN length"
115+ }
116+ }
117+ Row {
118+ TextField {
119+ id: retryCountTextField
120+ width: units.gu(7)
121+ text: "3 retries left"
122+ }
123+ Label {
124+ text: "Retries left"
95 }
125 }
96 }
126 }
97 Label {
127 Label {
@@ -108,12 +138,40 @@ Rectangle {
108 }
138 }
109 Button {
139 Button {
110 text: "start auth (1234)"
140 text: "start auth (1234)"
141+ width: parent.width
111 onClicked: LightDM.Greeter.authenticate("has-pin")
142 onClicked: LightDM.Greeter.authenticate("has-pin")
112 }
143 }
113 Button {
144 Button {
114 text: "start auth (password)"
145 text: "start auth (password)"
146+ width: parent.width
115 onClicked: LightDM.Greeter.authenticate("has-password")
147 onClicked: LightDM.Greeter.authenticate("has-password")
116 }
148 }
149+
150+ TextField {
151+ id: infoTextTextField
152+ width: parent.width
153+ placeholderText: "Infotext"
154+ text: "+49 179 3253553"
155+ }
156+
157+ TextField {
158+ id: infoPopupTitleTextField
159+ width: parent.width
160+ placeholderText: "Popup title"
161+ text: "This will be the last attempt"
162+ }
163+
164+ TextArea {
165+ id: infoPopupTextArea
166+ width: parent.width
167+ text: "If the SIM PIN is entered incorrectly, your SIM will be blocked and would require the PUK code to unlock."
168+ }
169+
170+ Button {
171+ text: "open info popup"
172+ width: parent.width
173+ onClicked: lockscreen.showInfoPopup(infoPopupTitleTextField.text, infoPopupTextArea.text)
174+ }
117 }
175 }
118 }
176 }
119
177
@@ -121,6 +179,16 @@ Rectangle {
121 name: "Lockscreen"
179 name: "Lockscreen"
122 when: windowShown
180 when: windowShown
123
181
182+ function cleanup() {
183+ lockscreen.clear(false);
184+ }
185+
186+ function waitForLockscreenReady() {
187+ var pinPadLoader = findChild(lockscreen, "pinPadLoader");
188+ tryCompare(pinPadLoader, "status", Loader.Ready)
189+ waitForRendering(lockscreen)
190+ }
191+
124 function test_loading_data() {
192 function test_loading_data() {
125 return [
193 return [
126 {tag: "numeric", alphanumeric: false, pinPadAvailable: true },
194 {tag: "numeric", alphanumeric: false, pinPadAvailable: true },
@@ -129,8 +197,8 @@ Rectangle {
129 }
197 }
130
198
131 function test_loading(data) {
199 function test_loading(data) {
132− lockscreen.alphaNumeric = data.alphanumeric
200+ pinPadCheckBox.checked = data.alphanumeric
133− waitForRendering(lockscreen)
201+ waitForLockscreenReady();
134 if (data.pinPadAvailable) {
202 if (data.pinPadAvailable) {
135 compare(findChild(lockscreen, "pinPadButton8").text, "8", "Could not find number 8 on PinPad")
203 compare(findChild(lockscreen, "pinPadButton8").text, "8", "Could not find number 8 on PinPad")
136 } else {
204 } else {
@@ -147,8 +215,8 @@ Rectangle {
147
215
148 function test_emergency_call(data) {
216 function test_emergency_call(data) {
149 emergencyCheckBox.checked = false
217 emergencyCheckBox.checked = false
150− lockscreen.alphaNumeric = data.alphanumeric
218+ pinPadCheckBox.checked = data.alphanumeric
151− waitForRendering(lockscreen)
219+ waitForLockscreenReady();
152 var emergencyButton = findChild(lockscreen, "emergencyCallIcon")
220 var emergencyButton = findChild(lockscreen, "emergencyCallIcon")
153 mouseClick(emergencyButton, units.gu(1), units.gu(1))
221 mouseClick(emergencyButton, units.gu(1), units.gu(1))
154 tryCompare(emergencyCheckBox, "checked", true)
222 tryCompare(emergencyCheckBox, "checked", true)
@@ -163,9 +231,9 @@ Rectangle {
163 }
231 }
164
232
165 function test_labels(data) {
233 function test_labels(data) {
166− lockscreen.alphaNumeric = data.alphanumeric
234+ pinPadCheckBox.checked = data.alphanumeric
167 lockscreen.placeholderText = data.placeholderText
235 lockscreen.placeholderText = data.placeholderText
168− waitForRendering(lockscreen)
236+ waitForLockscreenReady();
169 compare(findChild(lockscreen, "pinentryField").placeholderText, data.placeholderText, "Placeholdertext is not what it should be")
237 compare(findChild(lockscreen, "pinentryField").placeholderText, data.placeholderText, "Placeholdertext is not what it should be")
170 if (data.alphanumeric) {
238 if (data.alphanumeric) {
171 compare(findChild(lockscreen, "greeterLabel").text, "Hello " + data.username, "Greeter is not set correctly")
239 compare(findChild(lockscreen, "greeterLabel").text, "Hello " + data.username, "Greeter is not set correctly")
@@ -175,23 +243,25 @@ Rectangle {
175
243
176 function test_unlock_data() {
244 function test_unlock_data() {
177 return [
245 return [
178− {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", pinLength: 4},
246+ {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", minPinLength: 4, maxPinLength: 4},
179− {tag: "alphanumeric", alphanumeric: true, username: "has-password", password: "password", pinLength: -1},
247+ {tag: "alphanumeric", alphanumeric: true, username: "has-password", password: "password", minPinLength: -1, maxPinLength: -1},
180− {tag: "numeric (wrong)", alphanumeric: false, username: "has-pin", password: "4321", pinLength: 4},
248+ {tag: "numeric (wrong)", alphanumeric: false, username: "has-pin", password: "4321", minPinLength: 4, maxPinLength: 4},
181− {tag: "alphanumeric (wrong)", alphanumeric: true, username: "has-password", password: "drowssap", pinLength: -1},
249+ {tag: "alphanumeric (wrong)", alphanumeric: true, username: "has-password", password: "drowssap", minPinLength: -1, maxPinLength: -1},
182− {tag: "flexible length", alphanumeric: false, username: "has-pin", password: "1234", pinLength: -1},
250+ {tag: "flexible length", alphanumeric: false, username: "has-pin", password: "1234", minPinLength: -1, maxPinLength: -1},
183 ]
251 ]
184 }
252 }
185
253
186 function test_unlock(data) {
254 function test_unlock(data) {
187 enteredLabel.text = ""
255 enteredLabel.text = ""
188− pinLengthTextField.text = data.pinLength
256+ minPinLengthTextField.text = data.minPinLength
257+ maxPinLengthTextField.text = data.maxPinLength
189 LightDM.Greeter.authenticate(data.username)
258 LightDM.Greeter.authenticate(data.username)
190− waitForRendering(lockscreen)
259+ waitForLockscreenReady();
191
260
192 var inputField = findChild(lockscreen, "pinentryField")
261 var inputField = findChild(lockscreen, "pinentryField")
193 if (data.alphanumeric) {
262 if (data.alphanumeric) {
194 mouseClick(inputField, units.gu(1), units.gu(1))
263 mouseClick(inputField, units.gu(1), units.gu(1))
264+ tryCompare(inputField, "focus", true);
195 typeString(data.password)
265 typeString(data.password)
196 keyClick(Qt.Key_Enter)
266 keyClick(Qt.Key_Enter)
197 } else {
267 } else {
@@ -200,7 +270,7 @@ Rectangle {
200 var button = findChild(lockscreen, "pinPadButton" + character)
270 var button = findChild(lockscreen, "pinPadButton" + character)
201 mouseClick(button, units.gu(1), units.gu(1))
271 mouseClick(button, units.gu(1), units.gu(1))
202 }
272 }
203− if (data.pinLength == -1) {
273+ if (data.minPinLength !== data.maxPinLength || data.minPinLength == -1) {
204 var pinPadButtonErase = findChild(lockscreen, "pinPadButtonErase");
274 var pinPadButtonErase = findChild(lockscreen, "pinPadButtonErase");
205 mouseClick(pinPadButtonErase, units.gu(1), units.gu(1));
275 mouseClick(pinPadButtonErase, units.gu(1), units.gu(1));
206 }
276 }
@@ -219,11 +289,12 @@ Rectangle {
219
289
220 function test_clear(data) {
290 function test_clear(data) {
221 pinPadCheckBox.checked = data.alphanumeric
291 pinPadCheckBox.checked = data.alphanumeric
222− waitForRendering(lockscreen)
292+ waitForLockscreenReady();
223
293
224 var inputField = findChild(lockscreen, "pinentryField")
294 var inputField = findChild(lockscreen, "pinentryField")
225 if (data.alphanumeric) {
295 if (data.alphanumeric) {
226 mouseClick(inputField, units.gu(1), units.gu(1))
296 mouseClick(inputField, units.gu(1), units.gu(1))
297+ tryCompare(inputField, "activeFocus", true);
227 typeString("1")
298 typeString("1")
228 } else {
299 } else {
229 var button = findChild(lockscreen, "pinPadButton1")
300 var button = findChild(lockscreen, "pinPadButton1")
@@ -239,6 +310,16 @@ Rectangle {
239
310
240 wait(0) // Trigger event loop to make sure the animation would start running
311 wait(0) // Trigger event loop to make sure the animation would start running
241 compare(animation.running, data.animation)
312 compare(animation.running, data.animation)
313+ if (data.animation) {
314+ if (data.alphanumeric) {
315+ tryCompare(inputField, "placeholderText", lockscreen.wrongPlaceholderText)
316+ tryCompare(inputField, "placeholderText", lockscreen.placeholderText)
317+ } else {
318+ var label = findChild(lockscreen, "pinentryFieldPlaceHolder");
319+ tryCompare(label, "text", lockscreen.wrongPlaceholderText)
320+ tryCompare(label, "text", lockscreen.placeholderText)
321+ }
322+ }
242
323
243 // wait for animation to finish to not disturb other tests
324 // wait for animation to finish to not disturb other tests
244 tryCompare(animation, "running", false)
325 tryCompare(animation, "running", false)
@@ -246,33 +327,130 @@ Rectangle {
246
327
247 function test_backspace_data() {
328 function test_backspace_data() {
248 return [
329 return [
249− {tag: "fixed length", pinLength: 4},
330+ {tag: "fixed length", minPinLength: 4, maxPinLength: 4},
250− {tag: "variable length", pinLength: -1}
331+ {tag: "variable undefined length", minPinLength: -1, maxPinLength: -1},
332+ {tag: "variable restricted length", minPinLength: 4, maxPinLength: 8}
251 ];
333 ];
252 }
334 }
253
335
254 function test_backspace(data) {
336 function test_backspace(data) {
255 pinPadCheckBox.checked = false
337 pinPadCheckBox.checked = false
256− pinLengthTextField.text = data.pinLength
338+ minPinLengthTextField.text = data.minPinLength
257− waitForRendering(lockscreen);
339+ maxPinLengthTextField.text = data.maxPinLength
340+ waitForLockscreenReady();
258
341
259 var pinPadButtonErase = findChild(lockscreen, "pinPadButtonErase");
342 var pinPadButtonErase = findChild(lockscreen, "pinPadButtonErase");
260 var backspaceIcon = findChild(lockscreen, "backspaceIcon");
343 var backspaceIcon = findChild(lockscreen, "backspaceIcon");
261 var pinEntryField = findChild(lockscreen, "pinentryField");
344 var pinEntryField = findChild(lockscreen, "pinentryField");
262
345
346+ var autoConfirmEnabled = data.minPinLength === data.maxPinLength && data.minPinLength !== -1;
263− compare(pinPadButtonErase.iconName, data.pinLength == -1 ? "" : "erase");
347+ compare(pinPadButtonErase.iconName, autoConfirmEnabled ? "erase" : "");
264− compare(backspaceIcon.visible, data.pinLength == -1);
348+ compare(backspaceIcon.visible, !autoConfirmEnabled);
265
349
266 var pinPadButton5 = findChild(lockscreen, "pinPadButton5");
350 var pinPadButton5 = findChild(lockscreen, "pinPadButton5");
267 mouseClick(pinPadButton5, units.gu(1), units.gu(1));
351 mouseClick(pinPadButton5, units.gu(1), units.gu(1));
268 compare(pinEntryField.text, "5");
352 compare(pinEntryField.text, "5");
269
353
270− if (data.pinLength == -1) {
354+ if (data.minPinLength !== data.maxPinLength) {
271 mouseClick(backspaceIcon, units.gu(1), units.gu(1));
355 mouseClick(backspaceIcon, units.gu(1), units.gu(1));
272 } else {
356 } else {
273 mouseClick(pinPadButtonErase, units.gu(1), units.gu(1));
357 mouseClick(pinPadButtonErase, units.gu(1), units.gu(1));
274 }
358 }
275 compare(pinEntryField.text, "");
359 compare(pinEntryField.text, "");
276 }
360 }
361+
362+ function test_minMaxLength_data() {
363+ return [
364+ {tag: "undefined", minPinLength: -1, maxPinLength: -1},
365+ {tag: "fixed", minPinLength: 4, maxPinLength: 4},
366+ {tag: "variable, limited", minPinLength: 4, maxPinLength: 8},
367+ ];
368+ }
369+
370+ function test_minMaxLength(data) {
371+ pinPadCheckBox.checked = false
372+ minPinLengthTextField.text = data.minPinLength
373+ maxPinLengthTextField.text = data.maxPinLength
374+ waitForLockscreenReady();
375+
376+ var pinPadButton5 = findChild(lockscreen, "pinPadButton5");
377+ var pinPadButtonErase = findChild(lockscreen, "pinPadButtonErase");
378+ var inputField = findChild(lockscreen, "pinentryField")
379+
380+ for (var i = 0; i < 10; i++) {
381+ mouseClick(pinPadButton5, units.gu(1), units.gu(1));
382+
383+ if (data.minPinLength == data.maxPinLength && data.minPinLength != -1) {
384+ // auto confirm mode...
385+ compare(inputField.text.length, (i+1) % data.minPinLength);
386+ } else {
387+ // manual confirm mode
388+ tryCompare(pinPadButtonErase, "enabled", (i+1) >= data.minPinLength)
389+ if (data.maxPinLength == -1) {
390+ compare(inputField.text.length, i+1);
391+ } else {
392+ compare(inputField.text.length, Math.min(data.maxPinLength, i+1));
393+ }
394+
395+ }
396+ }
397+ }
398+
399+ function test_retryDisplay_data() {
400+ return [
401+ {tag: "empty", retryText: "", shown: false},
402+ {tag: "3 retries left", retryText: "3 retries left", shown: true},
403+ ]
404+ }
405+
406+ function test_retryDisplay(data) {
407+ pinPadCheckBox.checked = false
408+ waitForLockscreenReady();
409+
410+ retryCountTextField.text = data.retryText;
411+ var label = findChild(lockscreen, "retryCountLabel")
412+ compare(label.visible, data.shown);
413+ }
414+
415+ function test_infoPopup() {
416+ verify(findChild(root, "infoPopup") === null);
417+ lockscreen.showInfoPopup("foo", "bar");
418+ tryCompareFunction(function() { return findChild(root, "infoPopup") !== null}, true);
419+
420+ var infoPopup = findChild(root, "infoPopup");
421+ compare(infoPopup.title, "foo");
422+ compare(infoPopup.text, "bar");
423+
424+ signalSpy.signalName = "infoPopupConfirmed"
425+ signalSpy.clear();
426+
427+ var okButton = findChild(root, "infoPopupOkButton");
428+ mouseClick(okButton, okButton.width / 2, okButton.height / 2);
429+
430+ tryCompareFunction(function() { return findChild(root, "infoPopup") === null}, true);
431+
432+ tryCompare(signalSpy, "count", 1);
433+ }
434+
435+ function test_infoTextDisplay_data() {
436+ return [
437+ {tag: "empty string", text: "", shown: false},
438+ {tag: "hello world", text: "hello world", shown: true},
439+ ]
440+ }
441+
442+ function test_infoTextDisplay(data) {
443+ pinPadCheckBox.checked = false
444+ waitForLockscreenReady();
445+
446+ infoTextTextField.text = data.text;
447+ var label = findChild(lockscreen, "infoTextLabel")
448+ compare(label.visible, data.shown);
449+ }
450+ }
451+
452+ SignalSpy {
453+ id: signalSpy
454+ target: lockscreen
277 }
455 }
278}
456}
tests/qmltests/tst_Shell.qml−9
@@ -475,15 +475,6 @@ Item {
475 } while (!isStill);
475 } while (!isStill);
476 }
476 }
477
477
478− function test_background_data() {
479− return [
480− {tag: "red", url: Qt.resolvedUrl("../data/unity/backgrounds/red.png"), expectedUrl: "tests/data/unity/backgrounds/red.png"},
481− {tag: "blue", url: Qt.resolvedUrl("../data/unity/backgrounds/blue.png"), expectedUrl: "tests/data/unity/backgrounds/blue.png"},
482− {tag: "invalid", url: "invalid", expectedUrl: shell.defaultBackground},
483− {tag: "empty", url: "", expectedUrl: shell.defaultBackground}
484− ]
485− }
486−
487 function test_DashShown_data() {
478 function test_DashShown_data() {
488 return [
479 return [
489 {tag: "in focus", greeter: false, app: false, launcher: false, indicators: false, expectedShown: true},
480 {tag: "in focus", greeter: false, app: false, launcher: false, indicators: false, expectedShown: true},