1 description("Test different constructors of Path.");
2 var ctx = document.createElement('canvas').getContext('2d');
4 debug("Test constructor Path().")
8 ctx.fillStyle = 'yellow';
11 var imageData = ctx.getImageData(0, 0, 100, 100);
12 var imgdata = imageData.data;
13 shouldBe("imgdata[4]", "255");
14 shouldBe("imgdata[5]", "255");
15 shouldBe("imgdata[6]", "0");
16 shouldBe("imgdata[7]", "255");
19 debug("Test constructor Path(DOMString) which takes a SVG data string.")
21 var p2 = new Path2D("M100,0L200,0L200,100L100,100z");
23 ctx.fillStyle = 'blue';
25 imageData = ctx.getImageData(100, 0, 100, 100);
26 imgdata = imageData.data;
27 shouldBe("imgdata[4]", "0");
28 shouldBe("imgdata[5]", "0");
29 shouldBe("imgdata[6]", "255");
30 shouldBe("imgdata[7]", "255");
33 debug("Test constructor Path(Path) which takes another Path object.")
35 var p3 = new Path2D(p1);
38 ctx.fillStyle = 'green';
39 ctx.translate(-200,0);
41 imageData = ctx.getImageData(200, 0, 100, 100);
42 imgdata = imageData.data;
43 shouldBe("imgdata[4]", "0");
44 shouldBe("imgdata[5]", "128");
45 shouldBe("imgdata[6]", "0");
46 shouldBe("imgdata[7]", "255");