on xenial help sign in
And add test
08736dbMichael Terry
qml/Tutorial/TutorialLeft.qml+3−1
@@ -46,15 +46,17 @@ TutorialPage {
46
46
47 SequentialAnimation {
47 SequentialAnimation {
48 id: teaseAnimation
48 id: teaseAnimation
49+ objectName: "teaseAnimation"
49 paused: running && root.paused
50 paused: running && root.paused
50 running: !slider.active && root.launcher.visibleWidth === 0 && root.shown
51 running: !slider.active && root.launcher.visibleWidth === 0 && root.shown
51 loops: Animation.Infinite
52 loops: Animation.Infinite
52 property real bounce: 0
53 property real bounce: 0
54+ readonly property real maxBounce: units.gu(2)
53
55
54 UbuntuNumberAnimation {
56 UbuntuNumberAnimation {
55 target: teaseAnimation
57 target: teaseAnimation
56 property: "bounce"
58 property: "bounce"
57− to: units.gu(2)
59+ to: teaseAnimation.maxBounce
58 duration: UbuntuAnimation.SleepyDuration
60 duration: UbuntuAnimation.SleepyDuration
59 }
61 }
60 UbuntuNumberAnimation {
62 UbuntuNumberAnimation {
tests/qmltests/Tutorial/tst_Tutorial.qml+30
@@ -325,6 +325,36 @@ Item {
325 tryCompare(left, "shown", true); // and we should still be on left
325 tryCompare(left, "shown", true); // and we should still be on left
326 }
326 }
327
327
328+ function test_launcherNoDragGap() {
329+ // See bug 1454882, where if you dragged the launcher while it was
330+ // visible, you could pull it further than the edge of the screen.
331+
332+ var left = goToPage("tutorialLeft");
333+ var launcher = findChild(shell, "launcher");
334+ var teaseAnimation = findInvisibleChild(left, "teaseAnimation");
335+
336+ // Wait for launcher to be really out there
337+ tryCompareFunction(function() {return launcher.x > teaseAnimation.maxBounce/2}, true);
338+ verify(teaseAnimation.running);
339+
340+ // Start a drag, make sure animation stops
341+ touchFlick(shell, 0, halfHeight, units.gu(3), halfHeight, true, false);
342+ verify(!teaseAnimation.running);
343+ verify(launcher.visibleWidth > 0);
344+ verify(launcher.x > 0);
345+ compare(launcher.x, teaseAnimation.bounce);
346+
347+ // Continue drag, make sure we don't create a gap on the left hand side
348+ touchFlick(shell, units.gu(1), halfHeight, shell.width, halfHeight, false, false);
349+ verify(!teaseAnimation.running);
350+ compare(launcher.visibleWidth, launcher.panelWidth);
351+ compare(launcher.x, 0);
352+
353+ // Finish and make sure we continue animation
354+ touchFlick(shell, shell.width, halfHeight, shell.width, halfHeight, false, true);
355+ tryCompare(teaseAnimation, "running", true);
356+ }
357+
328 function test_spread() {
358 function test_spread() {
329 // Unfortunately, most of what we want to test of the spread is
359 // Unfortunately, most of what we want to test of the spread is
330 // "did it render correctly?" but that's hard to test. So instead,
360 // "did it render correctly?" but that's hard to test. So instead,