on xenial help sign in
move and improve tests
commit41608f39e28539e08f4af13c06e7829f1c7fd9ab authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 2 Aug 2016, 11:59 (10 years ago) parenta33874a
2 files changed+50−37
tests/qmltests/Components/tst_VirtualTouchPad.qml+50−1 tests/qmltests/tst_DisabledScreenNotice.qml−36
tests/qmltests/Components/tst_VirtualTouchPad.qml+50−1
@@ -21,10 +21,11 @@ import UInput 0.1
2121import "../../../qml/Components"
2222
2323
24−Item {
24+Rectangle {
2525 id: root
2626 width: units.gu(70)
2727 height: units.gu(70)
28+ color: "black"
2829
2930 VirtualTouchPad {
3031 id: touchScreenPad
@@ -140,5 +141,53 @@ Item {
140141 event.release(1, startX2, startY + units.gu(11));
141142 event.commit();
142143 }
144+
145+ function test_tutorial() {
146+ var oskButton = findChild(touchScreenPad, "oskButton");
147+ var leftButton = findChild(touchScreenPad, "leftButton");
148+ var rightButton = findChild(touchScreenPad, "rightButton");
149+ var touchPad = findChild(touchScreenPad, "virtualTouchPad")
150+ var tutorial = findInvisibleChild(touchScreenPad, "tutorialAnimation")
151+ var tutorialFinger1 = findChild(touchScreenPad, "tutorialFinger1");
152+ var tutorialFinger2 = findChild(touchScreenPad, "tutorialFinger2");
153+ var tutorialLabel = findChild(touchScreenPad, "tutorialLabel");
154+ var tutorialImage = findChild(touchScreenPad, "tutorialImage");
155+
156+ mouseEventSpy1.signalName = "mousePressed"
157+ mouseEventSpy2.signalName = "mouseReleased"
158+
159+ mouseEventSpy1.clear();
160+ mouseEventSpy2.clear();
161+
162+ // run the tutorial
163+ touchScreenPad.runTutorial();
164+ tryCompare(tutorial, "running", true)
165+
166+ // Wait for it to pause
167+ tryCompare(tutorial, "paused", true)
168+
169+ // Click somewhere to make it continue
170+ mouseClick(root, root.width / 2, root.height /2)
171+ tryCompare(tutorial, "paused", false)
172+
173+ // Verify that the touchpad does NOT accept input while the tutorial is running
174+ mouseClick(root, root.width / 2, root.height /2)
175+ compare(mouseEventSpy1.count, 0)
176+ compare(mouseEventSpy2.count, 0)
177+
178+ // Wait for it to finish
179+ tryCompare(tutorial, "running", false, 60000)
180+
181+ // Make sure after the tutorial, all the visible states are proper
182+ tryCompare(oskButton, "visible", true)
183+ tryCompare(leftButton, "visible", true)
184+ tryCompare(rightButton, "visible", true)
185+
186+ tryCompare(tutorialFinger1, "visible", false)
187+ tryCompare(tutorialFinger2, "visible", false)
188+ tryCompare(tutorialImage, "visible", false)
189+ tryCompare(tutorialLabel, "visible", false)
190+ }
191+
143192 }
144193}
tests/qmltests/tst_DisabledScreenNotice.qml−36
@@ -131,41 +131,5 @@ Item {
131131 // And make sure it catches up to the expected angle
132132 tryCompare(content, "rotation", data.expectedAngle);
133133 }
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− }
170134 }
171135}