blob: f6cc3009bed14cc5e9fbb28647826484c1a43dcb [file] [log] [blame]
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
window.jsTestIsAsync = true;
var givenScrollTop = 0;
var givenScrollLeft = 2; // When paging, this is ignored. Every event is one page.
var expectedScrollTop = 0;
var expectedScrollLeft = 700; // Window is 800x600. Scroll 87.5% of visible.
var event;
var div;
function runTest()
{
document.body.addEventListener("mousewheel", mousewheelHandler, false);
if (window.eventSender) {
eventSender.mouseMoveTo(100, 110);
eventSender.continuousMouseScrollBy(-window.givenScrollLeft, -window.givenScrollTop, true);
}
// This test expects failure on mac: crbug.com/552694.
shouldBecomeEqual("document.scrollingElement.scrollTop == window.expectedScrollTop && " +
"document.scrollingElement.scrollLeft == window.expectedScrollLeft", "true", finishJSTest);
}
function mousewheelHandler(e)
{
event = e;
shouldBe("event.wheelDeltaY", "0");
shouldBe("event.wheelDeltaX", "window.givenScrollLeft * -3");
if (e.wheelDeltaY)
shouldBe("event.wheelDelta", "0");
else
shouldBe("event.wheelDelta", "window.givenScrollLeft * -3");
}
</script>
</head>
<body style="margin:0;padding:0" onload="runTest()">
<div style="margin:0;padding:0;height:200px;width:2400px">
<div style="margin:0;padding:0;background-color:red;height:200px;width:1200px;position:relative;left:0px;top:0px"></div>
<div style="margin:0;padding:0;background-color:green;height:200px;width:1200px;position:relative;left:1200px;top:-200px"></div>
</div>
<div style="margin:0;padding:0;height:200px;width:2400px">
<div style="margin:0;padding:0;background-color:blue;height:200px;width:1200px;position:relative;left:0px;top:0px"></div>
<div style="margin:0;padding:0;background-color:yellow;height:200px;width:1200px;position:relative;left:1200px;top:-200px"></div>
</div>
<div id="console"></div>
</body>
</html>