@@ -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}