5 if (window
.testRunner
) {
6 testRunner
.dumpAsText();
7 testRunner
.waitUntilDone();
9 var dragIcon
= document
.createElementNS("http://www.w3.org/2000/svg", "img");
11 <p>Tests dragging an SVG image. Test passes if the test does not crash.
</p>
12 <img id=
"elementToDrag" src=
"resources/abe.png" draggable=
"true" ondragstart=
"dragStart(event);" onload=
"runTest()"/>
13 <div id=
"dragTarget" ondragenter=
"dragEnter(this);" style=
"width: 300px; height: 300px; border: 1px solid gray;"></div>
15 function dragStart(event
)
17 event
.dataTransfer
.setDragImage(dragIcon
, -10, -10);
20 function dragEnter(div
)
22 div
.innerText
= "Success - drag entered";
23 if (window
.testRunner
)
24 testRunner
.notifyDone();
29 var elementToDrag
= document
.getElementById("elementToDrag");
30 var x1
= elementToDrag
.offsetLeft
+ elementToDrag
.offsetWidth
/ 2;
31 var y1
= elementToDrag
.offsetTop
+ elementToDrag
.offsetHeight
/ 2;
33 eventSender
.mouseMoveTo(x1
, y1
);
34 eventSender
.mouseDown();
36 var dragTarget
= document
.getElementById("dragTarget");
37 var x2
= dragTarget
.offsetLeft
+ dragTarget
.offsetWidth
/ 2;
38 var y2
= dragTarget
.offsetTop
+ dragTarget
.offsetHeight
/ 2;
40 eventSender
.mouseMoveTo(x2
, y2
);
41 eventSender
.mouseUp();