1 <p>This tests for a drag select crasher.
</p>
2 <div id=
"div" contenteditable=
"true"><span id=
"start">Start here.
</span> <input id=
"end" type=
"text"></div>
7 var li
= document
.createElement("li");
8 li
.appendChild(document
.createTextNode(str
));
9 var console
= document
.getElementById("console");
10 console
.appendChild(li
);
12 function shouldBe(expected
, actual
) {
13 if (expected
!= actual
)
14 log("Failure. Expected: " + expected
+ ", Actual: " + actual
);
19 if (window
.testRunner
) {
21 var div
= document
.getElementById("div");
22 var sel
= window
.getSelection();
25 var start
= document
.getElementById("start");
26 var startx
= -8 + start
.offsetLeft
+ start
.offsetWidth
/ 2;
27 var starty
= start
.offsetTop
+ start
.offsetHeight
/ 2;
28 eventSender
.mouseMoveTo(startx
, starty
);
29 eventSender
.mouseDown();
31 var end
= document
.getElementById("end");
32 endx
= -8 + end
.offsetLeft
+ end
.offsetWidth
/ 2;
33 endy
= end
.offsetTop
+ end
.offsetHeight
/ 2;
36 for (var i
= 1; i
<= steps
; i
++) {
37 eventSender
.mouseMoveTo(startx
+ Math
.abs(startx
- endx
) * (i
/ steps
), starty
+ Math
.abs(starty
- endy
) * (i
/ steps
));
40 eventSender
.mouseMoveTo(endx
, endy
);
41 eventSender
.mouseUp();
45 log("This uses the eventSender to perform a drag select. To run it manually, mouse down over 'start here' and drag to the left, over the input field.");