blob: 3a37461bb8ddefc37023a469500d13fa9126f9f3 [file] [log] [blame]
<!DOCTYPE html>
<title>Canvas test: 2d.coordinatespace</title>
<meta name="author" content="Philip Taylor">
<script src="../common/canvas-tests.js"></script>
<link rel="stylesheet" href="../common/canvas-tests.css">
<body class="show_output">
<h1><a href="index.2d.html">2d</a>.coordinatespace</h1>
<p class="desc">Coordinate space goes from top-left to bottom-right</p>
<div class="refs">Spec references:
<ul>
<li><a href="../annotated-spec/canvas.html#testrefs.2d.coordinatespace">2d.coordinatespace</a>
</ul>
</div>
<p class="notes">This should not be upside down.
<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="resources/2d.coordinatespace.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
_addTest(function(canvas, ctx) {
ctx.fillStyle = '#00f';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0ff';
ctx.fillRect(0, 0, 50, 25);
_assertPixel(canvas, 25,12, 0,255,255,255, "25,12", "0,255,255,255");
_assertPixel(canvas, 75,12, 0,0,255,255, "75,12", "0,0,255,255");
_assertPixel(canvas, 25,37, 0,0,255,255, "25,37", "0,0,255,255");
_assertPixel(canvas, 75,37, 0,0,255,255, "75,37", "0,0,255,255");
_requireManualCheck(); // because we can't tell that getPixelData isn't using the wrong coordinate space too
});
</script>