 Chromium Code Reviews
 Chromium Code Reviews Issue 2693193003:
  Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests.  (Closed)
    
  
    Issue 2693193003:
  Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests.  (Closed) 
  | 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> | 3 | 
| 4 <script src="../../resources/js-test.js"></script> | 4 <script> | 
| 5 </head> | 5 test(function(t) { | 
| 6 <body> | 6 | 
| 7 <script src="script-tests/canvas-state-intact-after-putImageData.js"></script> | 7 var ctx = document.createElement('canvas').getContext('2d'); | 
| 
Justin Novosad
2017/02/21 21:53:35
indent
 
zakerinasab
2017/02/22 15:33:54
Done.
 | |
| 8 </body> | 8 | 
| 9 </html> | 9 ctx.fillStyle = 'red'; | 
| 10 ctx.fillRect(0, 0, 1, 1); | |
| 11 | |
| 12 assert_equals(ctx.fillStyle, '#ff0000'); | |
| 13 var imageData = ctx.getImageData(0, 0, 2, 1); | |
| 14 assert_array_equals(imageData.data.slice(0,4), [255, 0, 0, 255]); | |
| 15 assert_array_equals(imageData.data.slice(4), [0, 0, 0, 0]); | |
| 16 | |
| 17 ctx.putImageData(imageData, 1, 1); | |
| 18 imageData = ctx.getImageData(1, 1, 1, 1); | |
| 19 assert_array_equals(imageData.data, [255, 0, 0, 255]); | |
| 20 | |
| 21 assert_equals(ctx.fillStyle, '#ff0000'); | |
| 22 | |
| 23 ctx.fillRect(2, 2, 1, 1); | |
| 24 data = ctx.getImageData(2, 2, 1, 1).data; | |
| 25 assert_array_equals(data, [255, 0, 0, 255]); | |
| 26 | |
| 27 }, "Test that the rendering context state is intact after a call to putImageData ()"); | |
| 28 </script> | |
| OLD | NEW |