1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../../../resources/js-test.js"></script>
7 <p>This test checks long press behavior when both touch drag/drop and touch editing are enabled.
<br>
8 1. Check that long press on a draggable element starts drag.
<br>
9 2. Check that long press on non-draggable text selects the text.
<br>
10 3. Check that long press on selected text starts drag.
</p>
11 <div id=
"text">Testing
</div>
12 <div id=
"draggableDivResult">FAIL
</div>
13 <div id=
"selectTextResult">FAIL
</div>
14 <div id=
"draggableTextResult">FAIL
</div>
15 <div id=
"draggableDiv" draggable='true'
>Drag me
</div>
16 <div id=
"textDiv">Some text
</div>
20 if (window
.testRunner
)
21 testRunner
.dumpAsText();
23 if (window
.internals
) {
24 internals
.settings
.setTouchDragDropEnabled(true);
25 internals
.settings
.setTouchEditingEnabled(true);
28 var draggableDiv
= document
.getElementById("draggableDiv");
29 draggableDiv
.ondragstart = function() { document
.getElementById("draggableDivResult").innerHTML
= "PASS"; }
31 var textDiv
= document
.getElementById("textDiv");
32 textDiv
.ondragstart = function() { document
.getElementById("draggableTextResult").innerHTML
= "PASS"; }
34 if (!window
.eventSender
)
36 if (eventSender
.gestureLongPress
) {
37 var x
= draggableDiv
.offsetParent
.offsetLeft
+ draggableDiv
.offsetLeft
+ 4;
38 var y
= draggableDiv
.offsetParent
.offsetTop
+ draggableDiv
.offsetTop
+ draggableDiv
.offsetHeight
/ 2;
39 eventSender
.gestureLongPress(x
, y
);
41 x
= textDiv
.offsetParent
.offsetLeft
+ textDiv
.offsetLeft
+ 4;
42 y
= textDiv
.offsetParent
.offsetTop
+ textDiv
.offsetTop
+ textDiv
.offsetHeight
/ 2;
44 eventSender
.gestureLongPress(x
, y
);
45 if (document
.getSelection().toString().length
> 0)
46 document
.getElementById("selectTextResult").innerHTML
= "PASS";
48 eventSender
.gestureLongPress(x
, y
);
50 debug("gestureLongPress not implemented by this platform");