blob: 8136d07f25406cf96a9dfa76d46a35da2ab8d287 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script>
var radiusX;
var radiusY;
function touchHandler(e) {
var touch = e.touches[0];
radiusX = touch.radiusX;
radiusY = touch.radiusY;
}
function endTest()
{
isSuccessfullyParsed();
testRunner.notifyDone();
}
function sendTouchStart(x, y, radiusX, radiusY)
{
eventSender.clearTouchPoints();
eventSender.addTouchPoint(x, y, radiusX, radiusY);
eventSender.touchStart();
}
function runTest() {
if (window.testRunner)
testRunner.waitUntilDone();
if (window.testRunner) {
description("This tests makes sure the touch event's radius "
+ "property is scaled to account for browser zoom.");
document.body.addEventListener("touchstart", touchHandler);
debug("===Initial Zoom===");
sendTouchStart(100, 100, 4, 10);
shouldBe("radiusX", "4");
shouldBe("radiusY", "10");
testRunner.setPageZoomFactor(2.0);
debug("===Zoom 2X===");
sendTouchStart(100, 100, 4, 10);
shouldBe("radiusX", "2");
shouldBe("radiusY", "5");
testRunner.setPageZoomFactor(0.5);
debug("===Zoom 0.5X===");
sendTouchStart(100, 100, 4, 10);
shouldBe("radiusX", "8");
shouldBe("radiusY", "20");
endTest();
} else {
debug("This test requires DumpRenderTree. Tap on the blue rect to log.")
}
}
</script>
</head>
<body onload="runTest()">
<div id="console"></div>
</body>
</html>