blob: c83fc61eb60db8bf702a79d18d5ae42904f02df2 [file] [log] [blame]
<p>This tests for a drag select crasher.</p>
<div id="div" contenteditable="true"><span id="start">Start here.</span> <input id="end" type="text"></div>
<ul id="console"></ul>
<script>
function log(str) {
var li = document.createElement("li");
li.appendChild(document.createTextNode(str));
var console = document.getElementById("console");
console.appendChild(li);
}
function shouldBe(expected, actual) {
if (expected != actual)
log("Failure. Expected: " + expected + ", Actual: " + actual);
else
log("Passed");
}
alert( 5 / 29);
if (window.layoutTestController) {
var div = document.getElementById("div");
var sel = window.getSelection();
sel.setPosition(div, 0);
var start = document.getElementById("start");
var startx = -8 + start.offsetLeft + start.offsetWidth / 2;
var starty = start.offsetTop + start.offsetHeight / 2;
eventSender.mouseMoveTo(startx, starty);
eventSender.mouseDown();
var end = document.getElementById("end");
endx = -8 + end.offsetLeft + end.offsetWidth / 2;
endy = end.offsetTop + end.offsetHeight / 2;
var steps = 20;
for (var i = 1; i <= steps; i++) {
eventSender.mouseMoveTo(startx + Math.abs(startx - endx) * (i / steps), starty + Math.abs(starty - endy) * (i / steps));
}
eventSender.mouseMoveTo(endx, endy);
eventSender.mouseUp();
} else {
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.");
}
</script>