| OLD | NEW | 
|---|
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <script src="../../resources/testharness.js"></script> | 
| 2 <html> | 2 <script src="../../resources/testharnessreport.js"></script> | 
| 3 <head> |  | 
| 4 <script src="../../resources/js-test.js"></script> |  | 
| 5 </head> |  | 
| 6 <body> | 3 <body> | 
| 7 <script src="script-tests/canvas-setTransform.js"></script> | 4 <script> | 
|  | 5 var ctx = document.createElement('canvas').getContext('2d'); | 
|  | 6 | 
|  | 7 function checkPixel(x, y, rgb) { | 
|  | 8     assert_array_equals(ctx.getImageData(x, y, 1, 1).data.slice(0,3), rgb); | 
|  | 9 } | 
|  | 10 | 
|  | 11 test(function(t) { | 
|  | 12 | 
|  | 13     ctx.beginPath(); | 
|  | 14     ctx.scale(0.5, 0.5); | 
|  | 15     ctx.setTransform(1, 0, 0, 1, 0, 0); | 
|  | 16     ctx.fillStyle = 'green'; | 
|  | 17     ctx.fillRect(0, 0, 100, 100); | 
|  | 18     checkPixel(2, 1, [0, 128, 0]); | 
|  | 19 | 
|  | 20     ctx.beginPath(); | 
|  | 21     ctx.rect(0, 0, 100, 100); | 
|  | 22     ctx.save(); | 
|  | 23     ctx.setTransform(0.5, 0, 0, 0.5, 10, 10); | 
|  | 24     ctx.fillStyle = 'red'; | 
|  | 25     ctx.fillRect(0, 0, 100, 100); | 
|  | 26     ctx.restore(); | 
|  | 27     ctx.fillStyle = 'green'; | 
|  | 28     ctx.fillRect(0, 0, 100, 100); | 
|  | 29     checkPixel(2, 1, [0, 128, 0]); | 
|  | 30 | 
|  | 31     ctx.beginPath(); | 
|  | 32     ctx.fillStyle = 'green'; | 
|  | 33     ctx.save(); | 
|  | 34     ctx.setTransform(0.5, 0, 0, 0.5, 0, 0); | 
|  | 35     ctx.fillStyle = 'red'; | 
|  | 36     ctx.fillRect(0, 0, 100, 100); | 
|  | 37     ctx.restore(); | 
|  | 38     ctx.fillRect(0, 0, 100, 100); | 
|  | 39     checkPixel(2, 1, [0, 128, 0]); | 
|  | 40 | 
|  | 41     ctx.beginPath(); | 
|  | 42     ctx.fillStyle = 'green'; | 
|  | 43     ctx.fillRect(0, 0, 100, 100); | 
|  | 44     ctx.setTransform(0, 0, 0, 0, 0, 0); | 
|  | 45     ctx.fillStyle = 'red'; | 
|  | 46     ctx.fillRect(0, 0, 100, 100); | 
|  | 47     checkPixel(2, 1, [0, 128, 0]); | 
|  | 48 | 
|  | 49     ctx.beginPath(); | 
|  | 50     ctx.resetTransform(); | 
|  | 51     ctx.save(); | 
|  | 52     ctx.setTransform(0, 0, 0, 0, 0, 0); | 
|  | 53     ctx.fillStyle = 'red'; | 
|  | 54     ctx.fillRect(0, 0, 100, 100); | 
|  | 55     ctx.restore(); | 
|  | 56     ctx.fillStyle = 'blue'; | 
|  | 57     ctx.fillRect(0, 0, 100, 100); | 
|  | 58     checkPixel(2, 1, [0, 0, 255]); | 
|  | 59 | 
|  | 60     ctx.beginPath(); | 
|  | 61     ctx.fillStyle = 'red'; | 
|  | 62     ctx.fillRect(0, 0, 100, 100); | 
|  | 63     ctx.setTransform(0, 0, 0, 0, 0, 0); | 
|  | 64     ctx.fillStyle = 'green'; | 
|  | 65     ctx.fillRect(0, 0, 100, 100); | 
|  | 66     ctx.setTransform(1, 0, 0, 1, 0, 0); | 
|  | 67     ctx.fillStyle = 'blue'; | 
|  | 68     ctx.fillRect(0, 0, 100, 100); | 
|  | 69     checkPixel(2, 1, [0, 0, 255]); | 
|  | 70 | 
|  | 71 }, "Series of tests to ensure correct behaviour of canvas.setTransform()"); | 
|  | 72 </script> | 
| 8 </body> | 73 </body> | 
| 9 </html> |  | 
| OLD | NEW | 
|---|