6 image-rendering: pixelated;
10 <!-- Draw the expected 20x20 checkerboards using canvases. -->
11 <canvas width=
"20" height=
"20"></canvas>
12 <canvas width=
"20" height=
"20"></canvas>
13 <canvas width=
"20" height=
"20"></canvas>
16 function drawImageToCanvas() {
17 [0, 1, 2].forEach(function (canvasIndex
) {
18 var context
= document
.getElementsByTagName("canvas")[canvasIndex
].getContext("2d");
21 var imageHandle
= context
.createImageData(20, 20);
25 imageHandle
.data
[index
++] = 255;
26 imageHandle
.data
[index
++] = 255;
27 imageHandle
.data
[index
++] = 255;
28 imageHandle
.data
[index
++] = 255;
32 imageHandle
.data
[index
++] = 0;
33 imageHandle
.data
[index
++] = 0;
34 imageHandle
.data
[index
++] = 0;
35 imageHandle
.data
[index
++] = 255;
38 // Each black or white block should be 2x2.
39 for (var j
= 0; j
< 5; j
++) {
40 for (var k
= 0; k
< 10; k
++) {
46 for (var k
= 0; k
< 10; k
++) {
54 context
.putImageData(imageHandle
, 0, 0);
59 if (!window
.testRunner
)
62 // Ignore the render tree.
63 testRunner
.dumpAsTextWithPixelResults();
65 testRunner
.waitUntilDone();
66 testRunner
.setBackingScaleFactor(2, function () {
68 testRunner
.notifyDone();
72 window
.onload
= runTest
;