on xenial help sign in
Merge lp:~mterry/unity8/tutorial-launcher-gap
commited940028664128bc8fabe03d5d684dc1451b83d6 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateTue 16 Jun 2015, 17:46 (11 years ago) parent52bbdcef058d72
2 files changed+46−7
qml/Tutorial/TutorialLeft.qml+15−6 tests/qmltests/Tutorial/tst_Tutorial.qml+31−1
qml/Tutorial/TutorialLeft.qml+15−6
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014,2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -46,24 +46,33 @@ 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
53+ property real bounce: 0
54+ readonly property real maxBounce: units.gu(2)
5255
5356 UbuntuNumberAnimation {
54− target: root.launcher
55− property: "x"
56− to: units.gu(2)
57+ target: teaseAnimation
58+ property: "bounce"
59+ to: teaseAnimation.maxBounce
5760 duration: UbuntuAnimation.SleepyDuration
5861 }
5962 UbuntuNumberAnimation {
60− target: root.launcher
61− property: "x"
63+ target: teaseAnimation
64+ property: "bounce"
6265 to: 0
6366 duration: UbuntuAnimation.SleepyDuration
6467 }
6568 }
6669
70+ Binding {
71+ target: root.launcher
72+ property: "x"
73+ value: Math.min(root.launcher.panelWidth - root.launcher.visibleWidth, teaseAnimation.bounce)
74+ }
75+
6776 Timer {
6877 id: finishTimer
6978 interval: 1
tests/qmltests/Tutorial/tst_Tutorial.qml+31−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013,2014 Canonical, Ltd.
2+ * Copyright (C) 2013,2014,2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -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(3), 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,