| 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-lineWidth-intact-after-strokeRect.js"></script> | 4 <script> |
| 5 test(function(t) { |
| 6 |
| 7 var ctx = document.createElement('canvas').getContext('2d'); |
| 8 |
| 9 ctx.fillStyle = 'red'; |
| 10 ctx.fillRect(0, 0, 1, 1); |
| 11 |
| 12 assert_equals(ctx.fillStyle, '#ff0000'); |
| 13 assert_array_equals(ctx.getImageData(0, 0, 1, 1).data, [255, 0, 0, 255]); |
| 14 assert_array_equals(ctx.getImageData(1, 0, 1, 1).data, [0, 0, 0, 0]); |
| 15 |
| 16 ctx.strokeStyle = 'red'; |
| 17 ctx.lineWidth = 100; |
| 18 // NOTE: This version of strokeRect() is WebKit-specific and not part of the
standard API. |
| 19 ctx.strokeRect(0, 0, 10, 10, 1); |
| 20 assert_equals(ctx.lineWidth, 100); |
| 21 |
| 22 ctx.strokeStyle = 'green'; |
| 23 ctx.beginPath(); |
| 24 ctx.moveTo(0, 0); |
| 25 ctx.lineTo(20, 20); |
| 26 ctx.stroke(); |
| 27 |
| 28 assert_array_equals(ctx.getImageData(2, 2, 1, 1).data, [0, 128, 0, 255]); |
| 29 |
| 30 document.body.appendChild(ctx.canvas) |
| 31 |
| 32 }, "Test that the rendering context's lineWidth is intact after calling strokeRe
ct()"); |
| 33 |
| 34 </script> |
| 8 </body> | 35 </body> |
| 9 </html> | |
| OLD | NEW |