on xenial help sign in
Add a couple tests
commit4faebb75b66d0b9f97ad3816567997c1544d78d5 authorMichael Terry <michael.terry@canonical.com> dateThu 8 Jan 2015, 10:37 (12 years ago) parent18edf3a
2 files changed+35
qml/Tutorial/TutorialRight.qml+1 tests/qmltests/Tutorial/tst_Tutorial.qml+34
qml/Tutorial/TutorialRight.qml+1
@@ -72,6 +72,7 @@ TutorialPage {
7272 // tutorial is still being spec'd by the design team.
7373 PhoneStage {
7474 id: stage
75+ objectName: "stage"
7576 anchors.top: parent.top
7677 width: parent.width
7778 height: parent.height
tests/qmltests/Tutorial/tst_Tutorial.qml+34
@@ -293,6 +293,40 @@ Item {
293293 tryCompare(left, "shown", true); // and we should still be on left
294294 }
295295
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+
296330 function test_interrupted() {
297331 goToPage("tutorialLeft");
298332 ApplicationManager.startApplication("dialer-app");