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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-svg-no-intrinsic-size.html

Issue 1901153002: Implement createImageBitmap(SVG) of intrinsic size = 0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: null check Created 4 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-svg-no-intrinsic-size-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
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script> 7 <script>
8 8
9 description("Test createImageBitmap from a SVG image without intrinsic size."); 9 description("Test createImageBitmap from a SVG image without intrinsic size and with zero size.");
10 window.jsTestIsAsync = true; 10 window.jsTestIsAsync = true;
11 11
12 var image = new Image(); 12 var image1Loaded = false;
13 image.onload = function() { 13 var image2Loaded = false;
14 createImageBitmap(image).then(function(imageBitmap) { 14 var image1 = new Image();
15 testFailed("createImageBitmap promise resolved, expected to be rejected" ); 15 var image2 = new Image();
16 finishJSTest(); 16 image1.onload = function() {
17 }, function (e) { 17 image1Loaded = true;
18 testPassed("createImageBitmap promise rejected: " + e); 18 testCreateImageBitmap();
19 finishJSTest();
20 });
21 } 19 }
22 image.src = '../../svg/hixie/intrinsic/resources/003.svg'; 20 image1.src = '../../svg/hixie/intrinsic/resources/003.svg';
21 image2.onload = function() {
22 image2Loaded = true;
23 testCreateImageBitmap();
24 }
25 image2.src = 'resources/zeroSize.svg';
26
27 function testCreateImageBitmap()
28 {
29 if (image1Loaded && image2Loaded) {
30 createImageBitmap(image1).then(function(bitmap1) {
31 testFailed("createImageBitmap from a SVG without intrinsic size succ eed, expected to be rejected");
32 finishJSTest();
33 }, function (e) {
34 testPassed("createImageBitmap from a SVG without intrinsic size reje cted: " + e);
35 createImageBitmap(image2).then(function(bitmap2) {
36 testFailed("createImageBitmap from a SVG with zero size succeed, expected to be rejected");
37 finishJSTest();
38 }, function(e) {
39 testPassed("createImageBitmap from a SVG with zero size rejected : " + e);
40 createImageBitmap(image2, 0, 0, 100, 100).then(function(bitmap3) {
41 testPassed("createImageBitmap from a zero size SVG with crop Rect succeed");
42 checkImageBitmap(bitmap3);
43 finishJSTest();
44 }, function(e) {
45 testFailed("createImageBitmap from a zero size SVG with crop Rect rejected: " + e);
46 finishJSTest();
47 });
48 });
49 });
50 }
51 }
52
53 function shouldBeClear(ctx, x, y) {
54 // should be transparent black pixels
55 d = ctx.getImageData(x, y, 1, 1).data;
56 shouldBe("d[0]", "0");
57 shouldBe("d[1]", "0");
58 shouldBe("d[2]", "0");
59 shouldBe("d[3]", "0");
60 }
61
62 function checkImageBitmap(bitmap)
63 {
64 var canvas = document.createElement("canvas");
65 canvas.width = 100;
66 canvas.height = 100;
67 var ctx = canvas.getContext('2d');
68 ctx.clearRect(0, 0, 100, 100);
69 ctx.drawImage(bitmap, 0, 0);
70 shouldBeClear(ctx, 0, 0);
71 shouldBeClear(ctx, 0, 99);
72 shouldBeClear(ctx, 99, 0);
73 shouldBeClear(ctx, 99, 99);
74 }
23 75
24 </script> 76 </script>
25 </body> 77 </body>
26 </html> 78 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-svg-no-intrinsic-size-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698