OLD | NEW |
1 description("Series of tests to ensure correct behaviour of canvas.currentTransf
orm"); | 1 description("Series of tests to ensure correct behaviour of canvas.currentTransf
orm"); |
2 var ctx = document.createElement('canvas').getContext('2d'); | 2 var ctx = document.createElement('canvas').getContext('2d'); |
3 | 3 |
4 var matrix = ctx.currentTransform; | 4 var matrix = ctx.currentTransform; |
5 | 5 |
6 debug("Check initial currentTransform values"); | 6 debug("Check initial currentTransform values"); |
7 shouldBe("matrix.a", "1"); | 7 shouldBe("matrix.a", "1"); |
8 shouldBe("matrix.b", "0"); | 8 shouldBe("matrix.b", "0"); |
9 shouldBe("matrix.c", "0"); | 9 shouldBe("matrix.c", "0"); |
10 shouldBe("matrix.d", "1"); | 10 shouldBe("matrix.d", "1"); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 ctx.fillRect(0, 0, 100, 100); | 168 ctx.fillRect(0, 0, 100, 100); |
169 | 169 |
170 imageData = ctx.getImageData(1, 1, 98, 98); | 170 imageData = ctx.getImageData(1, 1, 98, 98); |
171 imgdata = imageData.data; | 171 imgdata = imageData.data; |
172 shouldBe("imgdata[4]", "0"); | 172 shouldBe("imgdata[4]", "0"); |
173 shouldBe("imgdata[5]", "0"); | 173 shouldBe("imgdata[5]", "0"); |
174 shouldBe("imgdata[6]", "255"); | 174 shouldBe("imgdata[6]", "255"); |
175 | 175 |
176 debug("Check assigning an invalid object throws exception as expected"); | 176 debug("Check assigning an invalid object throws exception as expected"); |
177 shouldThrow("ctx.currentTransform = ctx", '"TypeError: Failed to set the \'curre
ntTransform\' property on \'CanvasRenderingContext2D\': The provided value is no
t of type \'SVGMatrix\'."'); | 177 shouldThrow("ctx.currentTransform = ctx", '"TypeError: Failed to set the \'curre
ntTransform\' property on \'CanvasRenderingContext2D\': The provided value is no
t of type \'SVGMatrix\'."'); |
| 178 shouldThrow("ctx.currentTransform = undefined", '"TypeError: Failed to set the \
'currentTransform\' property on \'CanvasRenderingContext2D\': The provided value
is not of type \'SVGMatrix\'."'); |
| 179 shouldThrow("ctx.currentTransform = null", '"TypeError: Failed to set the \'curr
entTransform\' property on \'CanvasRenderingContext2D\': The provided value is n
ot of type \'SVGMatrix\'."'); |
178 | 180 |
179 debug("Check handling non-finite values. see 2d.transformation.setTransform.nonf
inite.html"); | 181 debug("Check handling non-finite values. see 2d.transformation.setTransform.nonf
inite.html"); |
180 ctx.fillStyle = 'red'; | 182 ctx.fillStyle = 'red'; |
181 ctx.fillRect(0, 0, 100, 100); | 183 ctx.fillRect(0, 0, 100, 100); |
182 | 184 |
183 function setCurrentTransformToNonfinite(ctx, a, b, c, d, e, f) | 185 function setCurrentTransformToNonfinite(ctx, a, b, c, d, e, f) |
184 { | 186 { |
185 matrix.a = a; | 187 matrix.a = a; |
186 matrix.b = b; | 188 matrix.b = b; |
187 matrix.c = c; | 189 matrix.c = c; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 shouldBe("matrix.f", "10"); | 298 shouldBe("matrix.f", "10"); |
297 | 299 |
298 ctx.fillStyle = 'green'; | 300 ctx.fillStyle = 'green'; |
299 ctx.fillRect(-100, -10, 100, 100); | 301 ctx.fillRect(-100, -10, 100, 100); |
300 | 302 |
301 imageData = ctx.getImageData(1, 1, 98, 98); | 303 imageData = ctx.getImageData(1, 1, 98, 98); |
302 imgdata = imageData.data; | 304 imgdata = imageData.data; |
303 shouldBe("imgdata[4]", "0"); | 305 shouldBe("imgdata[4]", "0"); |
304 shouldBe("imgdata[5]", "128"); | 306 shouldBe("imgdata[5]", "128"); |
305 shouldBe("imgdata[6]", "0"); | 307 shouldBe("imgdata[6]", "0"); |
OLD | NEW |