@@ -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,