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

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

Issue 2674933002: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Corrections Created 3 years, 10 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 <!DOCTYPE html> 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> 4 <script>
8 description("Test the handling of non-integer source coordinates in getImageData ()."); 5 test(function(t) {
9 6 ctx = document.createElement('canvas').getContext('2d');
10 ctx = document.createElement('canvas').getContext('2d'); 7
11 8 function testDimensions(sx, sy, sw, sh, width, height)
12 function dimensionsShouldBe(sx, sy, sw, sh, width, height) 9 {
13 { 10 imageData = ctx.getImageData(sx, sy, sw, sh);
14 imageData = ctx.getImageData(sx, sy, sw, sh); 11 assert_equals(imageData.width, width);
15 debug('getImageData(' + sx + ', ' + sy + ', ' + sw + ', ' + sh + ')'); 12 assert_equals(imageData.height, height);
16 shouldBe('imageData.width', width + ''); 13 }
17 shouldBe('imageData.height', height + ''); 14
18 } 15 // Basic integer values
19 16 testDimensions( 0, 0, 20, 10, 20, 10);
20 // Basic integer values 17
21 dimensionsShouldBe( 0, 0, 20, 10, 20, 10); 18 // Source point is not an integer
22 19 testDimensions( .1, .2, 20, 10, 21, 11);
23 // Source point is not an integer 20 testDimensions( .9, .8, 20, 10, 21, 11);
24 dimensionsShouldBe( .1, .2, 20, 10, 21, 11); 21
25 dimensionsShouldBe( .9, .8, 20, 10, 21, 11); 22 // Size is not an integer
26 23 testDimensions( 0, 0, 19.9, 9.9, 20, 10);
27 // Size is not an integer 24 testDimensions( 0, 0, 19.1, 9.1, 20, 10);
28 dimensionsShouldBe( 0, 0, 19.9, 9.9, 20, 10); 25
29 dimensionsShouldBe( 0, 0, 19.1, 9.1, 20, 10); 26 // Width straddles a pixel boundary
30 27 testDimensions( .9, 0, .2, 10, 2, 10);
31 // Width straddles a pixel boundary 28
32 dimensionsShouldBe( .9, 0, .2, 10, 2, 10); 29 // Basic integer negative values
33 30 testDimensions( -1, -1, 20, 10, 20, 10);
34 // Basic integer negative values 31
35 dimensionsShouldBe( -1, -1, 20, 10, 20, 10); 32 // Non-integer negative values
36 33 testDimensions(-1.1, 0, 20, 10, 21, 10);
37 // Non-integer negative values 34 testDimensions(-1.9, 0, 20, 10, 21, 10);
38 dimensionsShouldBe(-1.1, 0, 20, 10, 21, 10); 35 }, 'Test the handling of non-integer source coordinates in getImageData().');
39 dimensionsShouldBe(-1.9, 0, 20, 10, 21, 10);
40 </script> 36 </script>
41 </body> 37 </body>
42 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698