Chromium Code Reviews| 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-fillRect.js"></script> | 4 <script> |
| 5 test(function(t) { | |
| 6 | |
| 7 var ctx = document.createElement('canvas').getContext('2d'); | |
|
Justin Novosad
2017/02/06 20:04:23
indent
zakerinasab
2017/02/09 18:02:01
Done.
| |
| 8 | |
| 9 // Fill rect with height = width = 0. | |
| 10 ctx.fillStyle = 'red'; | |
| 11 ctx.fillRect(0, 0, 0, 0); | |
| 12 | |
| 13 var imageData = ctx.getImageData(0, 0, 1, 1); | |
| 14 var imgdata = imageData.data; | |
| 15 assert_equals(imgdata[0], 0); | |
| 16 assert_equals(imgdata[1], 0); | |
| 17 assert_equals(imgdata[2], 0); | |
| 18 | |
| 19 ctx.clearRect(0, 0, 1, 1); | |
| 20 | |
| 21 // Fill rect with height = 0, width = 1. | |
| 22 | |
| 23 ctx.fillStyle = 'red'; | |
| 24 ctx.fillRect(0, 0, 1, 0); | |
| 25 | |
| 26 var imageData = ctx.getImageData(0, 0, 1, 1); | |
| 27 var imgdata = imageData.data; | |
| 28 assert_equals(imgdata[0], 0); | |
| 29 assert_equals(imgdata[1], 0); | |
| 30 assert_equals(imgdata[2], 0); | |
| 31 | |
| 32 ctx.clearRect(0, 0, 1, 1); | |
| 33 | |
| 34 // Fill rect with height = 1, width = 0. | |
| 35 | |
| 36 ctx.fillStyle = 'red'; | |
| 37 ctx.fillRect(0, 0, 0, 1); | |
| 38 | |
| 39 var imageData = ctx.getImageData(0, 0, 1, 1); | |
| 40 var imgdata = imageData.data; | |
| 41 assert_equals(imgdata[0], 0); | |
| 42 assert_equals(imgdata[1], 0); | |
| 43 assert_equals(imgdata[2], 0); | |
| 44 | |
| 45 ctx.clearRect(0, 0, 1, 1); | |
| 46 | |
| 47 }, "Series of tests to ensure correct behavior of canvas.fillRect()."); | |
| 48 </script> | |
| 8 </body> | 49 </body> |
| 9 </html> | |
| OLD | NEW |