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-getImageData-negative-source.js"></script> | 4 <script> |
5 test(function(t) { | |
6 | |
7 ctx = document.createElement('canvas').getContext('2d'); | |
Justin Novosad
2017/02/03 18:07:18
indent
| |
8 | |
9 ctx.fillStyle = 'red'; | |
10 ctx.fillRect(0, 0, 100, 100); | |
11 ctx.fillStyle = 'green'; | |
12 ctx.fillRect(0, 0, 6, 6); | |
13 | |
14 var imageData = ctx.getImageData(-10, 0, 100, 1); | |
15 var imgdata = imageData.data; | |
16 | |
17 // Fully transparent black | |
18 assert_equals(imgdata[0], 0); | |
19 assert_equals(imgdata[1], 0); | |
20 assert_equals(imgdata[2], 0); | |
21 assert_equals(imgdata[3], 0); | |
22 | |
23 // Green | |
24 assert_equals(imgdata[60], 0); | |
25 assert_equals(imgdata[61], 128); | |
26 assert_equals(imgdata[62], 0); | |
27 assert_equals(imgdata[63], 255); | |
28 | |
29 // Red | |
30 assert_equals(imgdata[64], 255); | |
31 assert_equals(imgdata[65], 0); | |
32 assert_equals(imgdata[66], 0); | |
33 assert_equals(imgdata[67], 255); | |
34 | |
35 }, "Test the handling of negative sourceRect offset in getImageData()."); | |
36 </script> | |
8 </body> | 37 </body> |
9 </html> | |
OLD | NEW |