blob: ce4c761d203e44f438edf9a244edb9cd35baa3cc [file] [log] [blame]
<!DOCTYPE html>
<title>Canvas test: 2d.transformation.scale.zero</title>
<script src="../tests.js"></script>
<link rel="stylesheet" href="../tests.css">
<link rel="prev" href="2d.transformation.scale.basic.html" title="2d.transformation.scale.basic">
<link rel="next" href="2d.transformation.scale.negative.html" title="2d.transformation.scale.negative">
<body class="show_output">
<p>
<a href="2d.transformation.scale.basic.html" accesskey="p" title="[p] 2d.transformation.scale.basic">&lt;</a>
<a href="index.html">[index]</a>
<a href="2d.transformation.scale.negative.html" accesskey="n" title="[n] 2d.transformation.scale.negative">&gt;</a>
<h1><a href="index.2d.html">2d</a>.<a href="index.2d.transformation.html">transformation</a>.<a href="index.2d.transformation.scale.html">scale</a>.zero</h1>
<p class="desc">scale() with a scale factor of zero works</p>
<div class="refs">References:
<ul>
<li><a href="spec.html#testrefs.2d.transformation.scale">2d.transformation.scale</a>
</ul>
</div>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="green-100x50.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
_addTest(function(canvas, ctx) {
ctx.fillStyle = '#0f0';
ctx.fillRect(0, 0, 100, 50);
ctx.save();
ctx.translate(50, 0);
ctx.scale(0, 1);
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.restore();
ctx.save();
ctx.translate(0, 25);
ctx.scale(1, 0);
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.restore();
// Firefox has a bug where it renders the canvas as empty and toDataURL throws an exception
canvas.toDataURL();
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
});
</script>