on xenial help sign in
update tests
commita33874a98e48e12801a71d10a22a22db8840f0e1 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 2 Aug 2016, 11:50 (10 years ago) parent851c462
2 files changed+50−9
qml/Components/VirtualTouchPad.qml+14−2 tests/qmltests/tst_DisabledScreenNotice.qml+36−7
qml/Components/VirtualTouchPad.qml+14−2
@@ -188,6 +188,7 @@ Item {
188188
189189 MouseArea {
190190 id: leftButton
191+ objectName: "leftButton"
191192 Layout.fillWidth: true
192193 Layout.fillHeight: true
193194 onPressed: uinput.pressMouse(UInput.ButtonLeft);
@@ -202,6 +203,7 @@ Item {
202203
203204 MouseArea {
204205 id: rightButton
206+ objectName: "rightButton"
205207 Layout.fillWidth: true
206208 Layout.fillHeight: true
207209 onPressed: uinput.pressMouse(UInput.ButtonRight);
@@ -217,6 +219,7 @@ Item {
217219
218220 AbstractButton {
219221 id: oskButton
222+ objectName: "oskButton"
220223 anchors { right: parent.right; top: parent.top; margins: internalGu * 2 }
221224 height: internalGu * 6
222225 width: height
@@ -252,29 +255,35 @@ Item {
252255
253256 Label {
254257 id: tutorialLabel
258+ objectName: "tutorialLabel"
255259 anchors { left: parent.left; top: parent.top; right: parent.right; margins: internalGu * 4; topMargin: internalGu * 10 }
256260 opacity: 0
257− font.pixelSize: 2.5 * internalGu
261+ visible: opacity > 0
262+ font.pixelSize: 2 * internalGu
258263 color: "white"
259264 wrapMode: Text.WordWrap
260265 }
261266
262267 Icon {
263268 id: tutorialImage
269+ objectName: "tutorialImage"
264270 height: internalGu * 8
265271 width: height
266272 name: "input-touchpad-symbolic"
267273 color: "white"
268274 opacity: 0
275+ visible: opacity > 0
269276 anchors { top: tutorialLabel.bottom; horizontalCenter: parent.horizontalCenter; margins: internalGu * 2 }
270277 }
271278
272279 Item {
273280 id: tutorialFinger1
281+ objectName: "tutorialFinger1"
274282 width: internalGu * 5
275283 height: width
276284 property real scale: 1
277285 opacity: 0
286+ visible: opacity > 0
278287 Rectangle {
279288 width: parent.width * parent.scale
280289 height: width
@@ -286,10 +295,12 @@ Item {
286295
287296 Item {
288297 id: tutorialFinger2
298+ objectName: "tutorialFinger2"
289299 width: internalGu * 5
290300 height: width
291301 property real scale: 1
292302 opacity: 0
303+ visible: opacity > 0
293304 Rectangle {
294305 width: parent.width * parent.scale
295306 height: width
@@ -301,13 +312,14 @@ Item {
301312
302313 SequentialAnimation {
303314 id: tutorial
315+ objectName: "tutorialAnimation"
304316
305317 PropertyAction { targets: [leftButton, rightButton, oskButton]; property: "enabled"; value: false }
306318 PropertyAction { targets: [leftButton, rightButton, oskButton]; property: "opacity"; value: 0 }
307319 PropertyAction { target: tutorialLabel; property: "text"; value: i18n.tr("Your device is now connected to an external display. Use this screen as a touch pad to interact with the pointer.") }
308320 UbuntuNumberAnimation { targets: [tutorialLabel, tutorialImage]; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
309321 PropertyAction { target: tutorial; property: "paused"; value: true }
310− PauseAnimation { duration: 100 } // it takes a bit until pausing actually takes effect
322+ PauseAnimation { duration: 500 } // it takes a bit until pausing actually takes effect
311323 UbuntuNumberAnimation { targets: [tutorialLabel, tutorialImage]; property: "opacity"; to: 0; duration: UbuntuAnimation.FastDuration }
312324
313325 UbuntuNumberAnimation { target: leftButton; property: "opacity"; to: 1 }
tests/qmltests/tst_DisabledScreenNotice.qml+36−7
@@ -101,13 +101,6 @@ Item {
101101 name: "DisabledScreenNotice"
102102 when: windowShown
103103
104− function test_mouseAreaHidesOnFirstTap() {
105− var noticeArea = findChild(touchScreenPad, "infoNoticeArea")
106− compare(noticeArea.visible, true)
107− tap(root)
108− tryCompare(noticeArea, "visible", false)
109− }
110−
111104 function test_rotation_data() {
112105 return [
113106 {tag: "portrait", selectedOrientation: 0, expectedAngle: 0},
@@ -138,5 +131,41 @@ Item {
138131 // And make sure it catches up to the expected angle
139132 tryCompare(content, "rotation", data.expectedAngle);
140133 }
134+
135+ function test_tutorial() {
136+ var oskButton = findChild(touchScreenPad, "oskButton");
137+ var leftButton = findChild(touchScreenPad, "leftButton");
138+ var rightButton = findChild(touchScreenPad, "rightButton");
139+ var touchPad = findChild(touchScreenPad, "virtualTouchPad")
140+ var tutorial = findInvisibleChild(touchScreenPad, "tutorialAnimation")
141+ var tutorialFinger1 = findChild(touchScreenPad, "tutorialFinger1");
142+ var tutorialFinger2 = findChild(touchScreenPad, "tutorialFinger2");
143+ var tutorialLabel = findChild(touchScreenPad, "tutorialLabel");
144+ var tutorialImage = findChild(touchScreenPad, "tutorialImage");
145+
146+ // run the tutorial
147+ touchPad.runTutorial();
148+ tryCompare(tutorial, "running", true)
149+
150+ // Wait for it to pause
151+ tryCompare(tutorial, "paused", true)
152+
153+ // Click somewhere to make it continue
154+ mouseClick(root, root.width / 2, root.height /2)
155+ tryCompare(tutorial, "paused", false)
156+
157+ // Wait for it to finish
158+ tryCompare(tutorial, "running", false, 60000)
159+
160+ // Make sure after the tutorial, all the visible states are proper
161+ tryCompare(oskButton, "visible", true)
162+ tryCompare(leftButton, "visible", true)
163+ tryCompare(rightButton, "visible", true)
164+
165+ tryCompare(tutorialFinger1, "visible", false)
166+ tryCompare(tutorialFinger2, "visible", false)
167+ tryCompare(tutorialImage, "visible", false)
168+ tryCompare(tutorialLabel, "visible", false)
169+ }
141170 }
142171}