on xenial help sign in
And add test
commit08736db673af6bad8fa7a244a00a6c0f06fa2781 authorMichael Terry <michael.terry@canonical.com> dateThu 14 May 2015, 11:01 (11 years ago) parente059c2f
2 files changed+33−1
qml/Tutorial/TutorialLeft.qml+3−1 tests/qmltests/Tutorial/tst_Tutorial.qml+30
qml/Tutorial/TutorialLeft.qml+3−1
@@ -46,15 +46,17 @@ TutorialPage {
4646
4747 SequentialAnimation {
4848 id: teaseAnimation
49+ objectName: "teaseAnimation"
4950 paused: running && root.paused
5051 running: !slider.active && root.launcher.visibleWidth === 0 && root.shown
5152 loops: Animation.Infinite
5253 property real bounce: 0
54+ readonly property real maxBounce: units.gu(2)
5355
5456 UbuntuNumberAnimation {
5557 target: teaseAnimation
5658 property: "bounce"
57− to: units.gu(2)
59+ to: teaseAnimation.maxBounce
5860 duration: UbuntuAnimation.SleepyDuration
5961 }
6062 UbuntuNumberAnimation {
tests/qmltests/Tutorial/tst_Tutorial.qml+30
@@ -325,6 +325,36 @@ Item {
325325 tryCompare(left, "shown", true); // and we should still be on left
326326 }
327327
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+
328358 function test_spread() {
329359 // Unfortunately, most of what we want to test of the spread is
330360 // "did it render correctly?" but that's hard to test. So instead,