Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-rounding.html

Issue 2771933002: Update createImageData/getImageData/putImageData from float to long (Closed)
Patch Set: Reset tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <script src="../../resources/testharness.js"></script> 1 <script src="../../resources/testharness.js"></script>
2 <script src="../../resources/testharnessreport.js"></script> 2 <script src="../../resources/testharnessreport.js"></script>
3 <body> 3 <body>
4 <script> 4 <script>
5 test(function(t) { 5 test(function(t) {
6 ctx = document.createElement('canvas').getContext('2d'); 6 ctx = document.createElement('canvas').getContext('2d');
7 7
8 function testDimensions(sx, sy, sw, sh, width, height) 8 function testDimensions(sx, sy, sw, sh, width, height)
9 { 9 {
10 imageData = ctx.getImageData(sx, sy, sw, sh); 10 imageData = ctx.getImageData(sx, sy, sw, sh);
11 assert_equals(imageData.width, width); 11 assert_equals(imageData.width, width);
12 assert_equals(imageData.height, height); 12 assert_equals(imageData.height, height);
13 } 13 }
14 14
15 // Basic integer values 15 // Basic integer values
16 testDimensions( 0, 0, 20, 10, 20, 10); 16 testDimensions( 0, 0, 20, 10, 20, 10);
17 17
18 // Source point is not an integer 18 // Source point is not an integer
19 testDimensions( .1, .2, 20, 10, 21, 11); 19 testDimensions( .1, .2, 20, 10, 20, 10);
20 testDimensions( .9, .8, 20, 10, 21, 11); 20 testDimensions( .9, .8, 20, 10, 20, 10);
21 21
22 // Size is not an integer 22 // Size is not an integer
23 testDimensions( 0, 0, 19.9, 9.9, 20, 10); 23 testDimensions( 0, 0, 20.9, 10.9, 20, 10);
24 testDimensions( 0, 0, 19.1, 9.1, 20, 10); 24 testDimensions( 0, 0, 20.1, 10.1, 20, 10);
25 25
26 // Width straddles a pixel boundary
27 testDimensions( .9, 0, .2, 10, 2, 10);
28
29 // Basic integer negative values 26 // Basic integer negative values
30 testDimensions( -1, -1, 20, 10, 20, 10); 27 testDimensions( -1, -1, 20, 10, 20, 10);
31 28
32 // Non-integer negative values 29 // Non-integer negative values
33 testDimensions(-1.1, 0, 20, 10, 21, 10); 30 testDimensions(-1.1, 0, 20, 10, 20, 10);
34 testDimensions(-1.9, 0, 20, 10, 21, 10); 31 testDimensions(-1.9, 0, 20, 10, 20, 10);
35 }, 'Test the handling of non-integer source coordinates in getImageData().'); 32 }, 'Test the handling of non-integer source coordinates in getImageData().');
36 </script> 33 </script>
37 </body> 34 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698