@@ -38,6 +38,7 @@ Item {
3838 property string lastSelectedApplication
3939
4040 onLauncherApplicationSelected: {
41+ print("sleected", appId)
4142 lastSelectedApplication = appId
4243 }
4344
@@ -363,25 +364,60 @@ Item {
363364 var draggedItem = findChild(launcher, "launcherDelegate5")
364365 var item0 = findChild(launcher, "launcherDelegate0")
365366 var fakeDragItem = findChild(launcher, "fakeDragItem")
366− var dndArea = findChild(launcher, "dndArea")
367+ var quickListShape = findChild(launcher, "quickListShape")
367368
368369 // Initial state
369− compare(dndArea.quickListPopover, null)
370+ compare(quickListShape.visible, false)
370371
371372 // Doing longpress
372373 mousePress(draggedItem, draggedItem.width / 2, draggedItem.height / 2)
373374 tryCompare(fakeDragItem, "visible", true) // Wait longpress happening
374− verify(dndArea.quickListPopover != null)
375+ tryCompare(quickListShape, "visible", true)
375376
376377 // Dragging a bit (> 1.5 gu)
377378 mouseMove(draggedItem, -units.gu(2), draggedItem.height / 2)
378379
379380 // QuickList needs to be closed when a drag operation starts
380− tryCompare(dndArea, "quickListPopover", null)
381+ tryCompare(quickListShape, "visible", false)
381382
382383 mouseRelease(draggedItem);
383384 }
384385
386+ function test_quicklist_positioning_data() {
387+ return [
388+ {tag: "top", flickTo: "top", itemIndex: 0},
389+ {tag: "bottom", flickTo: "bottom", itemIndex: 9}
390+ ];
391+ }
392+
393+ function test_quicklist_positioning(data) {
394+ revealer.dragLauncherIntoView();
395+ var quickList = findChild(launcher, "quickList")
396+ var draggedItem = findChild(launcher, "launcherDelegate" + data.itemIndex)
397+ var quickListShape = findChild(launcher, "quickListShape")
398+
399+ // Position launcher to where we need it
400+ var listView = findChild(launcher, "launcherListView");
401+ listView.flick(0, units.gu(200) * (data.flickTo === "top" ? 1 : -1));
402+ tryCompare(listView, "flicking", false);
403+
404+ // Doing longpress
405+ mousePress(draggedItem, draggedItem.width / 2, draggedItem.height / 2)
406+ tryCompare(quickListShape, "opacity", 0.8)
407+ mouseRelease(draggedItem);
408+
409+ verify(quickList.y >= units.gu(1))
410+ verify(quickList.y + quickList.height + units.gu(1) <= launcher.height)
411+
412+ // Click somewhere in the empty space to dismiss the quicklist
413+ mouseClick(launcher, launcher.width - units.gu(1), units.gu(1));
414+ tryCompare(quickListShape, "visible", false)
415+
416+ // Click somewhere in the empty space to dismiss the launcher
417+ mouseClick(launcher, launcher.width - units.gu(1), units.gu(1));
418+ revealer.waitUntilLauncherDisappears()
419+ }
420+
385421 function test_quicklist_click_data() {
386422 return [
387423 {tag: "non-clickable", index: 1, clickable: false },
@@ -392,19 +428,20 @@ Item {
392428 function test_quicklist_click(data) {
393429 revealer.dragLauncherIntoView();
394430 var clickedItem = findChild(launcher, "launcherDelegate5")
395− var dndArea = findChild(launcher, "dndArea")
431+ var quickList = findChild(launcher, "quickList")
432+ var quickListShape = findChild(launcher, "quickListShape")
396433
397434 // Initial state
398− compare(dndArea.quickListPopover, null)
435+ tryCompare(quickListShape, "visible", false)
399436
400437 // Doing longpress
401438 mousePress(clickedItem, clickedItem.width / 2, clickedItem.height / 2)
402439 tryCompare(clickedItem, "itemOpacity", 0) // Wait for longpress to happen
403− verify(dndArea.quickListPopover != null)
440+ verify(quickListShape.visible, "QuickList must be visible")
404441
405442 mouseRelease(clickedItem);
406443
407− var quickListEntry = findChild(dndArea.quickListPopover, "quickListEntry" + data.index)
444+ var quickListEntry = findChild(quickList, "quickListEntry" + data.index)
408445
409446 signalSpy.clear();
410447 signalSpy.signalName = "quickListTriggered"
@@ -413,7 +450,7 @@ Item {
413450
414451 if (data.clickable) {
415452 // QuickList needs to be closed when some clickable item is clicked
416− tryCompare(dndArea, "quickListPopover", null)
453+ tryCompare(quickListShape, "visible", false)
417454
418455 compare(signalSpy.count, 1, "Quicklist signal wasn't triggered")
419456 compare(signalSpy.signalArguments[0][0], LauncherModel.get(5).appId)
@@ -422,13 +459,13 @@ Item {
422459 } else {
423460
424461 // QuickList must not be closed when a non-clickable item is clicked
425− verify(dndArea.quickListPopover != null)
462+ verify(quickListShape.visible, "QuickList must be visible")
426463
427464 compare(signalSpy.count, 0, "Quicklist signal must NOT be triggered when clicking a non-clickable item")
428465
429466 // Click somewhere in the empty space to dismiss the quicklist
430467 mouseClick(launcher, launcher.width - units.gu(1), units.gu(1));
431− tryCompare(dndArea, "quickListPopover", null)
468+ tryCompare(quickListShape, "visible", false)
432469 }
433470 }
434471 }