OLD | NEW |
---|---|
1 description("Basic test for setLineDash, getLineDash and lineDashOffset"); | 1 description("Basic test for setLineDash, getLineDash and lineDashOffset"); |
2 | 2 |
3 var canvas = document.createElement('canvas'); | 3 var canvas = document.createElement('canvas'); |
4 document.body.appendChild(canvas); | 4 document.body.appendChild(canvas); |
5 canvas.setAttribute('width', '700'); | 5 canvas.setAttribute('width', '700'); |
6 canvas.setAttribute('height', '700'); | 6 canvas.setAttribute('height', '700'); |
7 var ctx = canvas.getContext('2d'); | 7 var ctx = canvas.getContext('2d'); |
8 | 8 |
9 function dataToArray(data) { | 9 function dataToArray(data) { |
10 var result = new Array(data.length) | 10 var result = new Array(data.length) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 ctx.strokeRect(90.5, 10.5, 30, 30); | 97 ctx.strokeRect(90.5, 10.5, 30, 30); |
98 pixelShouldBe(95, 10, [0, 0, 0, 0]); | 98 pixelShouldBe(95, 10, [0, 0, 0, 0]); |
99 pixelShouldBe(105, 10, [0, 255, 0, 255]); | 99 pixelShouldBe(105, 10, [0, 255, 0, 255]); |
100 pixelShouldBe(120, 15, [0, 0, 0, 0]); | 100 pixelShouldBe(120, 15, [0, 0, 0, 0]); |
101 pixelShouldBe(120, 25, [0, 255, 0, 255]); | 101 pixelShouldBe(120, 25, [0, 255, 0, 255]); |
102 pixelShouldBe(115, 40, [0, 0, 0, 0]); | 102 pixelShouldBe(115, 40, [0, 0, 0, 0]); |
103 pixelShouldBe(105, 40, [0, 255, 0, 255]); | 103 pixelShouldBe(105, 40, [0, 255, 0, 255]); |
104 pixelShouldBe(90, 35, [0, 0, 0, 0]); | 104 pixelShouldBe(90, 35, [0, 0, 0, 0]); |
105 pixelShouldBe(90, 25, [0, 255, 0, 255]); | 105 pixelShouldBe(90, 25, [0, 255, 0, 255]); |
106 | 106 |
107 // Verify that all zero dash sequence results in no dashing | |
108 ctx.setLineDash([0, 0]); | |
Stephen White
2015/10/01 15:46:02
Please add a [null, null] case as well, since it's
Justin Novosad
2015/10/01 16:06:42
Done.
| |
109 ctx.lineDashOffset = 0; | |
110 ctx.strokeRect(130.5, 10.5, 30, 30); | |
111 pixelShouldBe(130, 10, [0, 255, 0, 255]); | |
112 pixelShouldBe(130, 15, [0, 255, 0, 255]); | |
113 pixelShouldBe(130, 25, [0, 255, 0, 255]); | |
114 pixelShouldBe(130, 35, [0, 255, 0, 255]); | |
OLD | NEW |