1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
3 <script src=
"../../resources/js-test.js"></script>
5 #dropTarget, #dragMe { text-align: center; display: table-cell; vertical-align: middle }
6 #dropTarget {width:
256px; height:
256px; border:
1px dashed}
7 #dragMe {-webkit-user-drag: element; -webkit-user-select: none; background: #ff0000; width:
64px; height:
64px; color: white}
16 window
.onload = function()
18 dragMe
= document
.getElementById("dragMe");
19 dropTarget
= document
.getElementById("dropTarget");
20 dropEffectElem
= document
.getElementById("dropEffect");
21 consoleElm
= document
.getElementById("console");
23 if (!dragMe
|| !dropTarget
|| !dropEffectElem
|| !consoleElm
)
26 dropEffectElem
.onclick
= changeDropZone
;
28 dropTarget
.ondrop
= drop
;
33 function changeDropZone()
35 dropTarget
.setAttribute("webkitdropzone", " StRinG:tExT/pLaIn sTrING:TeXt/UrI-lIsT " + dropEffectElem
.options
[dropEffectElem
.selectedIndex
].value
);
38 function printDropEvent(e
)
40 chosenDropEffect
= dropEffectElem
.options
[dropEffectElem
.selectedIndex
].value
;
41 debug("Received drop event when chosenDropEffect is " + chosenDropEffect
);
46 if (!window
.eventSender
)
49 if (window
.testRunner
)
50 testRunner
.dumpAsText();
52 var startX
= dragMe
.offsetLeft
+ 10;
53 var startY
= dragMe
.offsetTop
+ dragMe
.offsetHeight
/ 2;
54 var endX
= dropTarget
.offsetLeft
+ 10;
55 var endY
= dropTarget
.offsetTop
+ dropTarget
.offsetHeight
/ 2
57 var numEffects
= dropEffectElem
.options
.length
;
59 for (var j
= 0; j
< numEffects
; ++j
) {
60 dropEffectElem
.options
[j
].selected
= true;
63 eventSender
.mouseMoveTo(startX
, startY
);
64 eventSender
.mouseDown();
65 eventSender
.leapForward(100);
66 eventSender
.mouseMoveTo(endX
, endY
);
67 eventSender
.mouseUp();
70 var testContainer
= document
.getElementById("test-container");
72 document
.body
.removeChild(testContainer
);
73 debug('<br /><span class="pass">TEST COMPLETE</span>');
76 <script src=
"resources/dropzone.js"></script>
79 <p id=
"description"></p>
80 <div id=
"test-container">
81 <div id=
"dropTarget">Drop the image onto me.
<br/><br/>
82 <label for=
"dropEffect">Expects dropEffect
</label> <select id=
"dropEffect">
83 <option value=
"copy">Copy
</option>
84 <option value=
"move">Move
</option>
85 <option value=
"link">Link
</option>
86 <option value=
"dummy">Nonexistent (Dummy) Effect should be converted to copy
</option>
90 <p>Items that can be dragged to the drop target:
</p>
91 <img id=
"dragMe" src=
"resources/greenbox.png">
94 <div id=
"console"></div>
96 description("This test checks that drag-and-drop support works with images.<br/>");