on xenial help sign in
Add a regression test for lp:1388359
commitc73522596aa2da1d11ea21633a984a15ebdf8ef7 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateMon 3 Nov 2014, 11:56 (12 years ago) parent6f67c3f
2 files changed+49−15
qml/Greeter/Infographics.qml+20−15 tests/qmltests/Greeter/tst_SingleGreeter.qml+29
qml/Greeter/Infographics.qml+20−15
@@ -26,8 +26,15 @@ Item {
2626
2727 property int animDuration: 10
2828
29− property bool __useDotAnimation: true
30− property int __circleModifier: __useDotAnimation ? 1 : 2
29+ QtObject {
30+ id: d
31+ objectName: "infographicPrivate"
32+ property bool useDotAnimation: true
33+ property int circleModifier: useDotAnimation ? 1 : 2
34+ property bool animating: dotHideAnimTimer.running
35+ || dotShowAnimTimer.running
36+ || circleChangeAnimTimer.running
37+ }
3138
3239 Connections {
3340 target: model
@@ -46,7 +53,7 @@ Item {
4653 dotHideAnimTimer.stop()
4754 notification.hideAnim.stop()
4855
49− if (__useDotAnimation) {
56+ if (d.useDotAnimation) {
5057 dotShowAnimTimer.startFromBeginning()
5158 }
5259 notification.showAnim.start()
@@ -57,7 +64,7 @@ Item {
5764 circleChangeAnimTimer.stop()
5865 notification.showAnim.stop()
5966
60− if (__useDotAnimation) {
67+ if (d.useDotAnimation) {
6168 dotHideAnimTimer.startFromBeginning()
6269 } else {
6370 circleChangeAnimTimer.startFromBeginning()
@@ -148,21 +155,21 @@ Item {
148155 property: "opacity"
149156 to: pastCircle.circleOpacity
150157 easing.type: Easing.OutCurve
151− duration: circleChangeAnimTimer.interval * __circleModifier
158+ duration: circleChangeAnimTimer.interval * d.circleModifier
152159 }
153160 PropertyAnimation {
154161 target: pastCircle
155162 property: "scale"
156163 to: modelData
157164 easing.type: Easing.OutCurve
158− duration: circleChangeAnimTimer.interval * __circleModifier
165+ duration: circleChangeAnimTimer.interval * d.circleModifier
159166 }
160167 ColorAnimation {
161168 target: pastCircle
162169 property: "color"
163170 to: Gradient.threeColorByIndex(index, count, infographic.model.secondColor)
164171 easing.type: Easing.OutCurve
165− duration: circleChangeAnimTimer.interval * __circleModifier
172+ duration: circleChangeAnimTimer.interval * d.circleModifier
166173 }
167174 }
168175 }
@@ -209,21 +216,21 @@ Item {
209216 property: "opacity"
210217 to: presentCircle.circleOpacity
211218 easing.type: Easing.OutCurve
212− duration: circleChangeAnimTimer.interval * __circleModifier
219+ duration: circleChangeAnimTimer.interval * d.circleModifier
213220 }
214221 PropertyAnimation {
215222 target: presentCircle
216223 property: "scale"
217224 to: modelData
218225 easing.type: Easing.OutCurve
219− duration: circleChangeAnimTimer.interval * __circleModifier
226+ duration: circleChangeAnimTimer.interval * d.circleModifier
220227 }
221228 ColorAnimation {
222229 target: presentCircle
223230 property: "color"
224231 to: Gradient.threeColorByIndex(index, infographic.model.currentDay, infographic.model.firstColor)
225232 easing.type: Easing.OutCurve
226− duration: circleChangeAnimTimer.interval * __circleModifier
233+ duration: circleChangeAnimTimer.interval * d.circleModifier
227234 }
228235 }
229236 }
@@ -385,7 +392,7 @@ Item {
385392 from: notification.baseOpacity
386393 to: 0.0
387394 duration: notification.duration * dots.count
388− onStopped: if (!__useDotAnimation) infographic.model.readyForDataChange()
395+ onStopped: if (!d.useDotAnimation) infographic.model.readyForDataChange()
389396 }
390397 }
391398 }
@@ -394,10 +401,8 @@ Item {
394401 anchors.fill: dataCircle
395402
396403 onDoubleClicked: {
397− if (!dotHideAnimTimer.running &&
398− !dotShowAnimTimer.running &&
399− !circleChangeAnimTimer.running) {
400− __useDotAnimation = false
404+ if (!d.animating) {
405+ d.useDotAnimation = false
401406 infographic.model.nextDataSource()
402407 }
403408 }
tests/qmltests/Greeter/tst_SingleGreeter.qml+29
@@ -69,6 +69,12 @@ Item {
6969 signalName: "tease"
7070 }
7171
72+ SignalSpy {
73+ id: infographicDataChangedSpy
74+ target: LightDM.Infographic
75+ signalName: "dataChanged"
76+ }
77+
7278 UT.UnityTestCase {
7379 name: "SingleGreeter"
7480 when: windowShown
@@ -123,5 +129,28 @@ Item {
123129 selectedSpy.wait();
124130 tryCompare(selectedSpy, "count", 1);
125131 }
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+ }
126155 }
127156}