@@ -421,5 +421,28 @@ StyledItem {
421421
422422 tryCompare(searchField, "focus", false);
423423 }
424+
425+ function test_dragDistanceReset() {
426+ // Regression test: If the user dragged the Drawer open further than
427+ // necessary, dragging the Drawer closed would take an equal amount
428+ // of distance to start the animation as the original overshoot.
429+
430+ var drawer = dragDrawerIntoView();
431+ var dragY = drawer.height / 2;
432+ // Drag the Drawer most of the way closed, then *way* open
433+ mousePress(root, drawer.width - units.gu(1), dragY);
434+ mouseMove(root, 10, dragY, 500);
435+ mouseMove(root, units.gu(100), dragY, 500);
436+ mouseRelease(root, units.gu(100), dragY);
437+
438+ // Ensure the Drawer's margin changes correctly on the next drag closed
439+ mousePress(root, drawer.width - units.gu(1), dragY);
440+ mouseMove(root, 1, dragY);
441+ // If the Drawer's position is within 2gu of hidden, it's probably okay.
442+ tryVerify(function () {return drawer.x < -(drawer.width - units.gu(2))});
443+ // But it should not be completely hidden.
444+ tryCompare(drawer, "visible", true);
445+ mouseRelease(root, 1, dragY);
446+ }
424447 }
425448}