62 lines
2.4 KiB
HTML
62 lines
2.4 KiB
HTML
<html>
|
|
<head>
|
|
<script src="../../../resources/js-test-pre.js"></script>
|
|
<script>
|
|
var givenScrollTop = 2; // Only page is scrolled per event, regardless of this number.
|
|
var givenScrollLeft = 0;
|
|
var expectedScrollTop = 525; // Window is 800x600. Scroll 87.5% of visible.
|
|
var expectedScrollLeft = 0;
|
|
var event;
|
|
var div;
|
|
|
|
if (window.testRunner)
|
|
testRunner.waitUntilDone();
|
|
|
|
function dispatchWheelEvent()
|
|
{
|
|
document.body.addEventListener("mousewheel", mousewheelHandler, false);
|
|
|
|
if (window.eventSender) {
|
|
eventSender.mouseMoveTo(100, 110);
|
|
eventSender.continuousMouseScrollBy(-window.givenScrollLeft, -window.givenScrollTop, true);
|
|
}
|
|
|
|
setTimeout('checkOffsets();', 100);
|
|
}
|
|
|
|
function checkOffsets()
|
|
{
|
|
shouldBe("document.scrollingElement.scrollTop", "window.expectedScrollTop");
|
|
shouldBe("document.scrollingElement.scrollLeft", "window.expectedScrollLeft");
|
|
|
|
if (window.testRunner)
|
|
window.testRunner.notifyDone();
|
|
}
|
|
|
|
function mousewheelHandler(e)
|
|
{
|
|
event = e;
|
|
shouldBe("event.wheelDeltaY", "window.givenScrollTop * -3");
|
|
shouldBe("event.wheelDeltaX", "0");
|
|
|
|
if (e.wheelDeltaY)
|
|
shouldBe("event.wheelDelta", "window.givenScrollTop * -3");
|
|
else
|
|
shouldBe("event.wheelDelta", "0");
|
|
}
|
|
</script>
|
|
</head>
|
|
|
|
<body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)">
|
|
<div style="height:900px;width:400px">
|
|
<div style="background-color:red;height:900px;width:200px;position:relative;left:0px;top:0px"></div>
|
|
<div style="background-color:green;height:900px;width:200px;position:relative;left:200px;top:-900px"></div>
|
|
</div>
|
|
<div style="height:900px;width:400px">
|
|
<div style="background-color:blue;height:900px;width:200px;position:relative;left:0px;top:0px"></div>
|
|
<div style="background-color:yellow;height:900px;width:200px;position:relative;left:200px;top:-900px"></div>
|
|
</div>
|
|
<div id="console"></div>
|
|
</body>
|
|
</html>
|