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