1 description("Test that the rendering context's lineWidth is intact after calling strokeRect()");
2 var ctx = document.createElement('canvas').getContext('2d');
5 ctx.fillRect(0, 0, 1, 1);
7 var imageData = ctx.getImageData(0, 0, 2, 1);
8 var imgdata = imageData.data;
9 shouldBe("ctx.fillStyle", "'#ff0000'");
10 shouldBe("imgdata[0]", "255");
11 shouldBe("imgdata[1]", "0");
12 shouldBe("imgdata[2]", "0");
13 shouldBe("imgdata[3]", "255");
14 shouldBe("imgdata[4]", "0");
15 shouldBe("imgdata[5]", "0");
16 shouldBe("imgdata[6]", "0");
17 shouldBe("imgdata[7]", "0");
19 ctx.strokeStyle = 'red';
21 // NOTE: This version of strokeRect() is WebKit-specific and not part of the standard API.
22 ctx.strokeRect(0, 0, 10, 10, 1);
23 shouldBe("ctx.lineWidth", "100");
25 ctx.strokeStyle = 'green';
31 imageData = ctx.getImageData(2, 2, 1, 1);
32 imgdata = imageData.data;
33 shouldBe("imgdata[0]", "0");
34 shouldBe("imgdata[1]", "128");
35 shouldBe("imgdata[2]", "0");
36 shouldBe("imgdata[3]", "255");
38 document.body.appendChild(ctx.canvas)