1 description("Series of tests to ensure correct behavior of canvas.fillRect().");
2 var ctx = document.createElement('canvas').getContext('2d');
4 // Fill rect with height = width = 0.
5 debug("Test canvas.fillRect() with height = width = 0.");
7 ctx.fillRect(0, 0, 0, 0);
9 var imageData = ctx.getImageData(0, 0, 1, 1);
10 var imgdata = imageData.data;
11 shouldBe("imgdata[0]", "0");
12 shouldBe("imgdata[1]", "0");
13 shouldBe("imgdata[2]", "0");
15 ctx.clearRect(0, 0, 1, 1);
17 // Fill rect with height = 0, width = 1.
18 debug("Test canvas.fillRect() with height = 0, width = 1.");
19 ctx.fillStyle = 'red';
20 ctx.fillRect(0, 0, 1, 0);
22 var imageData = ctx.getImageData(0, 0, 1, 1);
23 var imgdata = imageData.data;
24 shouldBe("imgdata[0]", "0");
25 shouldBe("imgdata[1]", "0");
26 shouldBe("imgdata[2]", "0");
28 ctx.clearRect(0, 0, 1, 1);
30 // Fill rect with height = 1, width = 0.
31 debug("Test canvas.fillRect() with height = 1, width = 0.");
32 ctx.fillStyle = 'red';
33 ctx.fillRect(0, 0, 0, 1);
35 var imageData = ctx.getImageData(0, 0, 1, 1);
36 var imgdata = imageData.data;
37 shouldBe("imgdata[0]", "0");
38 shouldBe("imgdata[1]", "0");
39 shouldBe("imgdata[2]", "0");
41 ctx.clearRect(0, 0, 1, 1);