on xenial help sign in
Add a couple tests
4faebb7Michael Terry
qml/Tutorial/TutorialRight.qml+1
@@ -72,6 +72,7 @@ TutorialPage {
72 // tutorial is still being spec'd by the design team.
72 // tutorial is still being spec'd by the design team.
73 PhoneStage {
73 PhoneStage {
74 id: stage
74 id: stage
75+ objectName: "stage"
75 anchors.top: parent.top
76 anchors.top: parent.top
76 width: parent.width
77 width: parent.width
77 height: parent.height
78 height: parent.height
tests/qmltests/Tutorial/tst_Tutorial.qml+34
@@ -293,6 +293,40 @@ Item {
293 tryCompare(left, "shown", true); // and we should still be on left
293 tryCompare(left, "shown", true); // and we should still be on left
294 }
294 }
295
295
296+ function test_spread() {
297+ // Unfortunately, most of what we want to test of the spread is
298+ // "did it render correctly?" but that's hard to test. So instead,
299+ // just poke and prod it a little bit to see if some of the values
300+ // we'd expect to be correct, are so.
301+
302+ var right = goToPage("tutorialRight");
303+ var stage = findChild(right, "stage");
304+ var delegate0 = findChild(right, "appDelegate0");
305+
306+ tryCompare(stage, "dragProgress", 0);
307+ touchFlick(shell, shell.width, halfHeight, shell.width * 0.8, halfHeight, true, false);
308+ verify(stage.dragProgress > 0);
309+ compare(stage.dragProgress, -delegate0.xTranslate);
310+ touchFlick(shell, shell.width * 0.8, halfHeight, shell.width, halfHeight, false, true);
311+ tryCompare(stage, "dragProgress", 0);
312+
313+ tryCompare(delegate0, "x", shell.width);
314+
315+ var screenshotImage = findChild(right, "screenshotImage");
316+ tryCompare(screenshotImage, "source", Qt.resolvedUrl("../../../qml/Tutorial/graphics/facebook.png"));
317+ tryCompare(screenshotImage, "visible", true);
318+ }
319+
320+ function test_bottomShortDrag() {
321+ var bottom = goToPage("tutorialBottom");
322+
323+ touchFlick(shell, halfWidth, shell.height, halfWidth, shell.height * 0.8);
324+
325+ var errorLabel = findChild(bottom, "errorLabel");
326+ tryCompare(bottom, "shown", true); // still on bottom page
327+ tryCompare(errorLabel, "opacity", 1); // show error
328+ }
329+
296 function test_interrupted() {
330 function test_interrupted() {
297 goToPage("tutorialLeft");
331 goToPage("tutorialLeft");
298 ApplicationManager.startApplication("dialer-app");
332 ApplicationManager.startApplication("dialer-app");