on xenial help sign in
Stabilize Launcher DND test

Approved by: Albert Astals Cid

commit967a24960cab029c7a40224776d2584ddf82d6fb authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 30 Sep 2015, 10:09 (11 years ago) parentcb37a0142038d5
1 file changed+20−12
tests/qmltests/Launcher/tst_Launcher.qml+20−12
tests/qmltests/Launcher/tst_Launcher.qml+20−12
@@ -479,16 +479,21 @@ Item {
479479 tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 0)
480480
481481 // Doing longpress
482− var currentMouseX = draggedItem.width / 2
483− var currentMouseY = draggedItem.height / 2
484− mousePress(draggedItem, currentMouseX, currentMouseY)
482+ var mouseOnLauncher = launcher.mapFromItem(draggedItem, draggedItem.width / 2, draggedItem.height / 2)
483+ var currentMouseX = mouseOnLauncher.x
484+ var currentMouseY = mouseOnLauncher.y
485+ var newMouseX = currentMouseX
486+ var newMouseY = currentMouseY
487+ mousePress(launcher, currentMouseX, currentMouseY)
485488 // DraggedItem needs to hide and fakeDragItem become visible
486489 tryCompare(draggedItem, "itemOpacity", 0)
487490 tryCompare(fakeDragItem, "visible", true)
488491
489492 // Dragging a bit (> 1.5 gu)
490− currentMouseX -= units.gu(2)
491− mouseMove(draggedItem, currentMouseX, currentMouseY)
493+ newMouseX -= units.gu(2)
494+ mouseFlick(launcher, currentMouseX, currentMouseY, newMouseX, newMouseY, false, false, 100)
495+ currentMouseX = newMouseX
496+
492497 // Other items need to expand and become 0.6 opaque
493498 tryCompare(item0, "angle", 0)
494499 tryCompare(item0, "itemOpacity", 0.6)
@@ -496,18 +501,21 @@ Item {
496501 if (data.fullDrag) {
497502 // Dragging a bit more
498503 if (data.orientation == ListView.Horizontal) {
499− currentMouseX -= units.gu(15)
500− mouseMove(draggedItem, currentMouseX, currentMouseY, 100)
504+ newMouseX += units.gu(15)
505+ mouseFlick(launcher, currentMouseX, currentMouseY, newMouseX, newMouseY, false, false, 100)
506+ currentMouseX = newMouseX
501507
502508 tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 1)
503509 tryCompare(draggedItem, "height", units.gu(1))
504510
505511 // Dragging downwards. Item needs to move in the model
506− currentMouseY -= initialItemHeight * 1.5
507− mouseMove(draggedItem, currentMouseX, currentMouseY)
512+ newMouseY -= initialItemHeight * 1.5
513+ mouseFlick(launcher, currentMouseX, currentMouseY, newMouseX, newMouseY, false, false, 100)
514+ currentMouseY = newMouseY
508515 } else if (data.orientation == ListView.Vertical) {
509− currentMouseY -= initialItemHeight * 1.5
510− mouseMove(draggedItem, currentMouseX, currentMouseY, 100)
516+ newMouseY -= initialItemHeight * 1.5
517+ mouseFlick(launcher, currentMouseX, currentMouseY, newMouseX, newMouseY, false, false, 100)
518+ currentMouseY = newMouseY
511519
512520 tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 1)
513521 tryCompare(draggedItem, "height", units.gu(1))
@@ -519,7 +527,7 @@ Item {
519527 }
520528
521529 // Releasing and checking if initial values are restored
522− mouseRelease(draggedItem)
530+ mouseRelease(launcher)
523531 tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 0)
524532 tryCompare(draggedItem, "itemOpacity", 1)
525533 tryCompare(fakeDragItem, "visible", false)