254
name: "Drag and Drop"
255
when: windowShown && initTestCase.completed
257
function test_dragndrop_data() {
259
{tag: "startDrag", fullDrag: false},
260
{tag: "fullDrag", fullDrag: true},
264
function test_dragndrop(data) {
265
revealer.dragLauncherIntoView();
266
var draggedItem = findChild(launcher, "launcherDelegate5")
267
var item0 = findChild(launcher, "launcherDelegate0")
268
var fakeDragItem = findChild(launcher, "fakeDragItem")
269
var initialItemHeight = draggedItem.height
270
var item5Name = LauncherModel.get(5).iconName
271
var item4Name = LauncherModel.get(4).iconName
274
compare(draggedItem.itemOpacity, 1, "Item's opacity is not 1 at beginning")
275
compare(fakeDragItem.visible, false, "FakeDragItem isn't invisible at the beginning")
276
tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 0)
279
mousePress(draggedItem, draggedItem.width / 2, draggedItem.height / 2)
280
// DraggedItem needs to hide and fakeDragItem become visible
281
tryCompare(draggedItem, "itemOpacity", 0)
282
tryCompare(fakeDragItem, "visible", true)
284
// Dragging a bit (> 1.5 gu)
285
mouseMove(draggedItem, -units.gu(2), draggedItem.height / 2)
286
// Other items need to expand and become 0.6 opaque
287
tryCompare(item0, "angle", 0)
288
tryCompare(item0, "itemOpacity", 0.6)
291
// Dragging a bit more
292
mouseMove(draggedItem, -units.gu(15), draggedItem.height / 2, 100)
293
tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 1)
294
tryCompare(draggedItem, "height", units.gu(1))
296
// Dragging downwards. Item needs to move in the model
297
mouseMove(draggedItem, -units.gu(15), -initialItemHeight)
298
waitForRendering(draggedItem)
299
compare(LauncherModel.get(5).iconName, item4Name)
300
compare(LauncherModel.get(5).iconName, item5Name)
303
// Releasing and checking if initial values are restored
304
mouseRelease(draggedItem)
305
tryCompare(findChild(draggedItem, "dropIndicator"), "opacity", 0)
306
tryCompare(draggedItem, "itemOpacity", 1)
307
tryCompare(fakeDragItem, "visible", false)