on xenial help sign in
Add a regression test for lp:1388359
c735225Daniel d'Andrada
qml/Greeter/Infographics.qml+20−15
@@ -26,8 +26,15 @@ Item {
26
26
27 property int animDuration: 10
27 property int animDuration: 10
28
28
29+ QtObject {
30+ id: d
31+ objectName: "infographicPrivate"
29− property bool __useDotAnimation: true
32+ property bool useDotAnimation: true
30− property int __circleModifier: __useDotAnimation ? 1 : 2
33+ property int circleModifier: useDotAnimation ? 1 : 2
34+ property bool animating: dotHideAnimTimer.running
35+ || dotShowAnimTimer.running
36+ || circleChangeAnimTimer.running
37+ }
31
38
32 Connections {
39 Connections {
33 target: model
40 target: model
@@ -46,7 +53,7 @@ Item {
46 dotHideAnimTimer.stop()
53 dotHideAnimTimer.stop()
47 notification.hideAnim.stop()
54 notification.hideAnim.stop()
48
55
49− if (__useDotAnimation) {
56+ if (d.useDotAnimation) {
50 dotShowAnimTimer.startFromBeginning()
57 dotShowAnimTimer.startFromBeginning()
51 }
58 }
52 notification.showAnim.start()
59 notification.showAnim.start()
@@ -57,7 +64,7 @@ Item {
57 circleChangeAnimTimer.stop()
64 circleChangeAnimTimer.stop()
58 notification.showAnim.stop()
65 notification.showAnim.stop()
59
66
60− if (__useDotAnimation) {
67+ if (d.useDotAnimation) {
61 dotHideAnimTimer.startFromBeginning()
68 dotHideAnimTimer.startFromBeginning()
62 } else {
69 } else {
63 circleChangeAnimTimer.startFromBeginning()
70 circleChangeAnimTimer.startFromBeginning()
@@ -148,21 +155,21 @@ Item {
148 property: "opacity"
155 property: "opacity"
149 to: pastCircle.circleOpacity
156 to: pastCircle.circleOpacity
150 easing.type: Easing.OutCurve
157 easing.type: Easing.OutCurve
151− duration: circleChangeAnimTimer.interval * __circleModifier
158+ duration: circleChangeAnimTimer.interval * d.circleModifier
152 }
159 }
153 PropertyAnimation {
160 PropertyAnimation {
154 target: pastCircle
161 target: pastCircle
155 property: "scale"
162 property: "scale"
156 to: modelData
163 to: modelData
157 easing.type: Easing.OutCurve
164 easing.type: Easing.OutCurve
158− duration: circleChangeAnimTimer.interval * __circleModifier
165+ duration: circleChangeAnimTimer.interval * d.circleModifier
159 }
166 }
160 ColorAnimation {
167 ColorAnimation {
161 target: pastCircle
168 target: pastCircle
162 property: "color"
169 property: "color"
163 to: Gradient.threeColorByIndex(index, count, infographic.model.secondColor)
170 to: Gradient.threeColorByIndex(index, count, infographic.model.secondColor)
164 easing.type: Easing.OutCurve
171 easing.type: Easing.OutCurve
165− duration: circleChangeAnimTimer.interval * __circleModifier
172+ duration: circleChangeAnimTimer.interval * d.circleModifier
166 }
173 }
167 }
174 }
168 }
175 }
@@ -209,21 +216,21 @@ Item {
209 property: "opacity"
216 property: "opacity"
210 to: presentCircle.circleOpacity
217 to: presentCircle.circleOpacity
211 easing.type: Easing.OutCurve
218 easing.type: Easing.OutCurve
212− duration: circleChangeAnimTimer.interval * __circleModifier
219+ duration: circleChangeAnimTimer.interval * d.circleModifier
213 }
220 }
214 PropertyAnimation {
221 PropertyAnimation {
215 target: presentCircle
222 target: presentCircle
216 property: "scale"
223 property: "scale"
217 to: modelData
224 to: modelData
218 easing.type: Easing.OutCurve
225 easing.type: Easing.OutCurve
219− duration: circleChangeAnimTimer.interval * __circleModifier
226+ duration: circleChangeAnimTimer.interval * d.circleModifier
220 }
227 }
221 ColorAnimation {
228 ColorAnimation {
222 target: presentCircle
229 target: presentCircle
223 property: "color"
230 property: "color"
224 to: Gradient.threeColorByIndex(index, infographic.model.currentDay, infographic.model.firstColor)
231 to: Gradient.threeColorByIndex(index, infographic.model.currentDay, infographic.model.firstColor)
225 easing.type: Easing.OutCurve
232 easing.type: Easing.OutCurve
226− duration: circleChangeAnimTimer.interval * __circleModifier
233+ duration: circleChangeAnimTimer.interval * d.circleModifier
227 }
234 }
228 }
235 }
229 }
236 }
@@ -385,7 +392,7 @@ Item {
385 from: notification.baseOpacity
392 from: notification.baseOpacity
386 to: 0.0
393 to: 0.0
387 duration: notification.duration * dots.count
394 duration: notification.duration * dots.count
388− onStopped: if (!__useDotAnimation) infographic.model.readyForDataChange()
395+ onStopped: if (!d.useDotAnimation) infographic.model.readyForDataChange()
389 }
396 }
390 }
397 }
391 }
398 }
@@ -394,10 +401,8 @@ Item {
394 anchors.fill: dataCircle
401 anchors.fill: dataCircle
395
402
396 onDoubleClicked: {
403 onDoubleClicked: {
397− if (!dotHideAnimTimer.running &&
404+ if (!d.animating) {
398− !dotShowAnimTimer.running &&
405+ d.useDotAnimation = false
399− !circleChangeAnimTimer.running) {
400− __useDotAnimation = false
401 infographic.model.nextDataSource()
406 infographic.model.nextDataSource()
402 }
407 }
403 }
408 }
tests/qmltests/Greeter/tst_SingleGreeter.qml+29
@@ -69,6 +69,12 @@ Item {
69 signalName: "tease"
69 signalName: "tease"
70 }
70 }
71
71
72+ SignalSpy {
73+ id: infographicDataChangedSpy
74+ target: LightDM.Infographic
75+ signalName: "dataChanged"
76+ }
77+
72 UT.UnityTestCase {
78 UT.UnityTestCase {
73 name: "SingleGreeter"
79 name: "SingleGreeter"
74 when: windowShown
80 when: windowShown
@@ -123,5 +129,28 @@ Item {
123 selectedSpy.wait();
129 selectedSpy.wait();
124 tryCompare(selectedSpy, "count", 1);
130 tryCompare(selectedSpy, "count", 1);
125 }
131 }
132+
133+ /*
134+ Regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1388359
135+ "User metrics can no longer be changed by double tap"
136+ */
137+ function test_doubleTapSwitchesToNextInfographic() {
138+ infographicDataChangedSpy.clear();
139+
140+ var infographicPrivate = findInvisibleChild(greeter, "infographicPrivate");
141+ verify(infographicPrivate);
142+
143+ // wait for the UI to settle down before double tapping it
144+ tryCompare(infographicPrivate, "animating", false);
145+
146+ var dataCircle = findChild(greeter, "dataCircle");
147+ verify(dataCircle);
148+
149+ tap(dataCircle);
150+ wait(1);
151+ tap(dataCircle);
152+
153+ tryCompare(infographicDataChangedSpy, "count", 1);
154+ }
126 }
155 }
127}
156}