OLD | NEW |
1 description("Tests for the imageSmoothingEnabled attribute."); | 1 description("Tests for the imageSmoothingEnabled attribute."); |
2 var ctx = document.createElement('canvas').getContext('2d'); | 2 var ctx = document.createElement('canvas').getContext('2d'); |
3 | 3 |
4 debug("Test that the default value is true."); | 4 debug("Test that the default value is true."); |
5 shouldBe("ctx.imageSmoothingEnabled", "true"); | 5 shouldBe("ctx.imageSmoothingEnabled", "true"); |
| 6 shouldBe("ctx.webkitImageSmoothingEnabled", "true"); |
6 | 7 |
7 debug("Test that false is returned after a the attribute is set to false."); | 8 debug("Test that false is returned after a the attribute is set to false."); |
8 ctx.imageSmoothingEnabled = false; | 9 ctx.imageSmoothingEnabled = false; |
9 shouldBe("ctx.imageSmoothingEnabled", "false"); | 10 shouldBe("ctx.imageSmoothingEnabled", "false"); |
| 11 shouldBe("ctx.webkitImageSmoothingEnabled", "false"); |
10 | 12 |
11 debug("Test that restore works. We save a false state; create, then save a true
state; and then finally restore."); | 13 debug("Test that restore works. We save a false state; create, then save a true
state; and then finally restore."); |
12 ctx.save(); | 14 ctx.save(); |
13 ctx.imageSmoothingEnabled = true; | 15 ctx.imageSmoothingEnabled = true; |
14 ctx.restore(); | 16 ctx.restore(); |
15 shouldBe("ctx.imageSmoothingEnabled", "false"); | 17 shouldBe("ctx.imageSmoothingEnabled", "false"); |
16 | 18 |
17 var image = document.createElement('canvas'); | 19 var image = document.createElement('canvas'); |
18 image.width = 2; | 20 image.width = 2; |
19 image.height = 1; | 21 image.height = 1; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 ctx.imageSmoothingEnabled = false; | 71 ctx.imageSmoothingEnabled = false; |
70 ctx.save(); | 72 ctx.save(); |
71 ctx.imageSmoothingEnabled = true; | 73 ctx.imageSmoothingEnabled = true; |
72 ctx.restore(); | 74 ctx.restore(); |
73 ctx.drawImage(image, 0, 0, canvas.width, canvas.height); | 75 ctx.drawImage(image, 0, 0, canvas.width, canvas.height); |
74 left_of_center_pixel = ctx.getImageData(1, 0, 1, 1); | 76 left_of_center_pixel = ctx.getImageData(1, 0, 1, 1); |
75 shouldBe("left_of_center_pixel.data[0]", "0"); | 77 shouldBe("left_of_center_pixel.data[0]", "0"); |
76 shouldBe("left_of_center_pixel.data[1]", "0"); | 78 shouldBe("left_of_center_pixel.data[1]", "0"); |
77 shouldBe("left_of_center_pixel.data[2]", "0"); | 79 shouldBe("left_of_center_pixel.data[2]", "0"); |
78 | 80 |
OLD | NEW |