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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-large-pattern.html

Issue 2681423002: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: 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 <body> 3 <script>
4 <script src="../../resources/js-test.js"></script> 4 // This test does not currently succeed because skia does not handle
5 <script type="text/javascript"> 5 // canvases more than 32k pixels wide. For now, this test serves the
6 // purpose of verifying that this use case does not crash the browser.
7 // Crasher bug: crbug.com/281504
6 8
7 description("Verifies createPattern using a source image that is a canva s 40k pixels wide."); 9 test(function(t) {
8 // This test does not currently succeed because skia does not handle 10 var canvas = document.createElement('canvas');
9 // canvases more than 32k pixels wide. For now, this test serves the 11 canvas.width = 40000;
10 // purpose of verifying that this use case does not crash the browser. 12 var context = canvas.getContext('2d');
11 // Crasher bug: crbug.com/281504 13 context.fillStyle = '#0f0';
14 context.fillRect(0, 0, 1, 1);
12 15
13 var canvas = document.createElement('canvas'); 16 var dstCanvas = document.createElement('canvas');
14 canvas.width = 40000; 17 var dstContext = dstCanvas.getContext('2d');
15 var context = canvas.getContext('2d'); 18 var pattern = dstContext.createPattern(canvas, 'repeat');
16 context.fillStyle = '#0f0'; 19 dstContext.fillStyle = pattern;
17 context.fillRect(0, 0, 1, 1); 20 dstContext.fillRect(0, 0, dstCanvas.width, dstCanvas.height);
18 21
19 var dstCanvas = document.createElement('canvas'); 22 //assert_array_equals(dstContext.getImageData(0, 0, 1, 1).data, [0, 255, 0, 255]);
Justin Novosad 2017/02/16 15:41:56 Why are these commented-out? Without theses assert
zakerinasab 2017/02/16 18:12:40 I removed some comment tags. The thing is that thi
20 var dstContext = dstCanvas.getContext('2d'); 23 //assert_array_equals(dstContext.getImageData(1, 0, 1, 1).data, [0, 0, 0, 0] );
21 var pattern = dstContext.createPattern(canvas, 'repeat'); 24 //assert_array_equals(dstContext.getImageData(0, 1, 1, 1).data, [0, 0, 0, 0] );
22 dstContext.fillStyle = pattern; 25
23 dstContext.fillRect(0, 0, dstCanvas.width, dstCanvas.height); 26 }, 'Tests createPattern using a source image that is a canvas 40k pixels wide.') ;
24 27 </script>
25 var imageData = dstContext.getImageData(0, 0, 1, 1);
26 var imgdata = imageData.data;
27 shouldBe("imgdata[0]", "0");
28 shouldBe("imgdata[1]", "255");
29 shouldBe("imgdata[2]", "0");
30 shouldBe("imgdata[3]", "255");
31
32 imageData = dstContext.getImageData(1, 0, 1, 1);
33 imgdata = imageData.data;
34 shouldBe("imgdata[0]", "0");
35 shouldBe("imgdata[1]", "0");
36 shouldBe("imgdata[2]", "0");
37 shouldBe("imgdata[3]", "0");
38
39 imageData = dstContext.getImageData(0, 1, 1, 1);
40 imgdata = imageData.data;
41 shouldBe("imgdata[0]", "0");
42 shouldBe("imgdata[1]", "0");
43 shouldBe("imgdata[2]", "0");
44 shouldBe("imgdata[3]", "0");
45 </script>
46 </body>
47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698