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

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

Issue 57643005: [2D Canvas] Fix crash in createPattern method when using invalid canvas as source. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/canvas-large-pattern-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <html>
3 <body>
4 <script src="../js/resources/js-test-pre.js"></script>
5 <script type="text/javascript">
6
7 description("Verifies createPattern using a source image that is a canva s 40k pixels wide.");
8 // This test does not currently succeed because skia does not handle
9 // canvases more than 32k pixels wide. For now, this test serves the
10 // purpose of verifying that this use case does not crash the browser.
11 // Crasher bug: crbug.com/281504
12
13 var canvas = document.createElement('canvas');
14 canvas.width = 40000;
15 var context = canvas.getContext('2d');
16 context.fillStyle = '#0f0';
17 context.fillRect(0, 0, 1, 1);
18
19 var dstCanvas = document.createElement('canvas');
20 var dstContext = dstCanvas.getContext('2d');
21 var pattern = dstContext.createPattern(canvas, 'repeat');
22 dstContext.fillStyle = pattern;
23 dstContext.fillRect(0, 0, dstCanvas.width, dstCanvas.height);
24
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 <script src="../js/resources/js-test-post.js"></script>
47 </body>
48 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/canvas-large-pattern-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698