1 description("Tests to make sure we can assign to non-ctm effected properties with a non-invertible ctm set");
2 var canvas = document.createElement("canvas");
5 var ctx = canvas.getContext('2d');
6 document.body.appendChild(canvas);
8 function testPixel(x,y, r, g, b) {
9 imageData = ctx.getImageData(x, y, 1, 1);
10 shouldBe("imageData.data[0]", ""+r);
11 shouldBe("imageData.data[1]", ""+g);
12 shouldBe("imageData.data[2]", ""+b);
15 // Test our ability to set fillStyle
18 ctx.fillStyle = "green";
19 shouldBe('ctx.fillStyle', '"#008000"');
20 ctx.setTransform(1, 0, 0, 1, 0, 0);
21 ctx.fillRect(0,0,100,100);
22 testPixel(50, 50, 0, 128, 0);
25 // Test our ability to set strokeStyle
27 ctx.fillStyle = "red";
28 ctx.fillRect(0,0,100,100);
30 ctx.strokeStyle = "green";
31 shouldBe('ctx.strokeStyle', '"#008000"');
33 ctx.setTransform(1, 0, 0, 1, 0, 0);
34 ctx.strokeRect(0,0,100,100);
35 testPixel(50, 50, 0, 128, 0);
41 ctx.fillStyle = "red";
42 ctx.fillRect(0,0,100,100);
45 ctx.strokeStyle = "green";
48 ctx.lineTo(-100, -100);
49 ctx.lineTo( 200, -100);
53 ctx.setTransform(1, 0, 0, 1, 0, 0);
56 testPixel(50, 50, 0, 128, 0);
58 // Test beginPath behaviour
59 ctx.fillStyle = "green";
60 ctx.fillRect(0,0,100,100);
61 ctx.fillStyle = "red";
62 ctx.rect(0,0,100,100);
65 ctx.setTransform(1, 0, 0, 1, 0, 0);
68 testPixel(50, 50, 0, 128, 0);