OLD | NEW |
| (Empty) |
1 description("Series of tests to ensure that strokeRect() paints nothing on canva
s when the strokeStyle is set to a zero-size gradient."); | |
2 var ctx = document.createElement('canvas').getContext('2d'); | |
3 | |
4 ctx.fillStyle = '#0f0'; | |
5 ctx.fillRect(0, 0, 1, 1); | |
6 | |
7 var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined dir
ection); | |
8 g.addColorStop(0, '#f00'); | |
9 g.addColorStop(1, '#f00'); | |
10 ctx.strokeStyle = g; | |
11 ctx.strokeRect(0, 0, 1 ,1); | |
12 | |
13 var imageData = ctx.getImageData(0, 0, 1, 1); | |
14 var imgdata = imageData.data; | |
15 shouldBe("imgdata[0]", "0"); | |
16 shouldBe("imgdata[1]", "255"); | |
17 shouldBe("imgdata[2]", "0"); | |
OLD | NEW |