@@ -200,7 +200,10 @@ Item {
200 verify(!!panel);
200 verify(!!panel);
202 // wait until it gets fully extended
202 // wait until it gets fully extended
203− tryCompare(panel, "x", 0);
203+ // a tryCompare doesn't work since
204+ // compare(-0.000005917593600024418, 0);
205+ // is true and in this case we want exactly 0 or will have pain later on
206+ tryCompareFunction( function(){ return panel.x === 0; }, true );
204 tryCompare(launcher, "state", "visible");
207 tryCompare(launcher, "state", "visible");
@@ -479,16 +482,21 @@ Item {
479 tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 0)
482 tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 0)
481 // Doing longpress
484 // Doing longpress
482− var currentMouseX = draggedItem.width / 2
485+ var mouseOnLauncher = launcher.mapFromItem(draggedItem, draggedItem.width / 2, draggedItem.height / 2)
483− var currentMouseY = draggedItem.height / 2
486+ var currentMouseX = mouseOnLauncher.x
487+ var currentMouseY = mouseOnLauncher.y
488+ var newMouseX = currentMouseX
489+ var newMouseY = currentMouseY
484− mousePress(draggedItem, currentMouseX, currentMouseY)
490+ mousePress(launcher, currentMouseX, currentMouseY)
485 // DraggedItem needs to hide and fakeDragItem become visible
491 // DraggedItem needs to hide and fakeDragItem become visible
486 tryCompare(draggedItem, "itemOpacity", 0)
492 tryCompare(draggedItem, "itemOpacity", 0)
487 tryCompare(fakeDragItem, "visible", true)
493 tryCompare(fakeDragItem, "visible", true)
489 // Dragging a bit (> 1.5 gu)
495 // Dragging a bit (> 1.5 gu)
490− currentMouseX -= units.gu(2)
496+ newMouseX -= units.gu(2)
491− mouseMove(draggedItem, currentMouseX, currentMouseY)
497+ mouseFlick(launcher, currentMouseX, currentMouseY, newMouseX, newMouseY, false, false, 100)
498+ currentMouseX = newMouseX
492 // Other items need to expand and become 0.6 opaque
500 // Other items need to expand and become 0.6 opaque
493 tryCompare(item0, "angle", 0)
501 tryCompare(item0, "angle", 0)
494 tryCompare(item0, "itemOpacity", 0.6)
502 tryCompare(item0, "itemOpacity", 0.6)
@@ -496,18 +504,21 @@ Item {
496 if (data.fullDrag) {
504 if (data.fullDrag) {
497 // Dragging a bit more
505 // Dragging a bit more
498 if (data.orientation == ListView.Horizontal) {
506 if (data.orientation == ListView.Horizontal) {
499− currentMouseX -= units.gu(15)
507+ newMouseX += units.gu(15)
500− mouseMove(draggedItem, currentMouseX, currentMouseY, 100)
508+ mouseFlick(launcher, currentMouseX, currentMouseY, newMouseX, newMouseY, false, false, 100)
509+ currentMouseX = newMouseX
502 tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 1)
511 tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 1)
503 tryCompare(draggedItem, "height", units.gu(1))
512 tryCompare(draggedItem, "height", units.gu(1))
505 // Dragging downwards. Item needs to move in the model
514 // Dragging downwards. Item needs to move in the model
506− currentMouseY -= initialItemHeight * 1.5
515+ newMouseY -= initialItemHeight * 1.5
507− mouseMove(draggedItem, currentMouseX, currentMouseY)
516+ mouseFlick(launcher, currentMouseX, currentMouseY, newMouseX, newMouseY, false, false, 100)
517+ currentMouseY = newMouseY
508 } else if (data.orientation == ListView.Vertical) {
518 } else if (data.orientation == ListView.Vertical) {
509− currentMouseY -= initialItemHeight * 1.5
519+ newMouseY -= initialItemHeight * 1.5
510− mouseMove(draggedItem, currentMouseX, currentMouseY, 100)
520+ mouseFlick(launcher, currentMouseX, currentMouseY, newMouseX, newMouseY, false, false, 100)
521+ currentMouseY = newMouseY
512 tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 1)
523 tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 1)
513 tryCompare(draggedItem, "height", units.gu(1))
524 tryCompare(draggedItem, "height", units.gu(1))
@@ -519,7 +530,7 @@ Item {
521 // Releasing and checking if initial values are restored
532 // Releasing and checking if initial values are restored
522− mouseRelease(draggedItem)
533+ mouseRelease(launcher)
523 tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 0)
534 tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 0)
524 tryCompare(draggedItem, "itemOpacity", 1)
535 tryCompare(draggedItem, "itemOpacity", 1)
525 tryCompare(fakeDragItem, "visible", false)
536 tryCompare(fakeDragItem, "visible", false)