blob: 02679d8296fa1454abe55d46c0f23f091713dbb6 [file] [log] [blame]
<p>
Test that fixed integral lengths round-trip correctly through zooming.
</p>
<p>
The test queries <tt>offsetWidth</tt> and <tt>offsetHeight</tt> of a 1&times;10-pixel rectangle under zooming by a factor of <i>k</i>/100 for 100 &le; <i>k</i> &le; 200.
</p>
<pre id="console"></pre>
<div id="container">
<div id="target" style="width: 1px; height: 10px;"></div>
</div>
<script>
function log(message)
{
var console = document.getElementById("console");
console.appendChild(document.createTextNode(message + "\n"));
}
if (window.layoutTestController)
layoutTestController.dumpAsText();
var target = document.getElementById("target");
var containerStyle = document.getElementById("container").style;
var zoom;
var failed = false;
for (zoom = 100; zoom <= 200; zoom += 1) {
containerStyle.setProperty("zoom", zoom / 100);
var width = target.offsetWidth;
var height = target.offsetHeight;
if (width !== 1 || height !== 10) {
failed = true;
log("FAIL at " + zoom + "% magnification: 1 mapped to " + target.offsetWidth + " and 10 mapped to " + target.offsetHeight + ".");
}
}
if (!failed)
log("PASS");
</script>