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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-video-with-options.html

Issue 1756963003: Add "premultiply" in ImageBitmapOptions enum PremultiplyAlpha (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change parseOptions Created 4 years, 9 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-drawImage-video-with-options-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("Ensure correct behavior of drawImage with ImageBitmaps from video e lements along with flipY option."); 9 description("Ensure correct behavior of drawImage with ImageBitmaps from video e lements along with flipY option.");
10 window.jsTestIsAsync = true; 10 window.jsTestIsAsync = true;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 testFailed("This pixel is expected to be transparent black, but it is actual ly: " + d); 44 testFailed("This pixel is expected to be transparent black, but it is actual ly: " + d);
45 } 45 }
46 46
47 function clearContext() { 47 function clearContext() {
48 ctx.clearRect(0, 0, 500, 500); 48 ctx.clearRect(0, 0, 500, 500);
49 } 49 }
50 50
51 var bitmap; 51 var bitmap;
52 var video; 52 var video;
53 var imageOrientationOptions = ["none", "flipY", "invalid"]; 53 var imageOrientationOptions = ["none", "flipY", "invalid"];
54 var premultiplyAlphaOptions = ["default", "none", "invalid"]; 54 var premultiplyAlphaOptions = ["default", "none", "premultiply", "invalid"];
55 var optionIndexArray = [[0, 0], [0, 1], [0, 2], 55 var optionIndexArray = [[0, 0], [0, 1], [0, 2], [0, 3],
56 [1, 0], [1, 1], [1, 2], 56 [1, 0], [1, 1], [1, 2], [1, 3],
57 [2, 0], [2, 1], [2, 2]]; 57 [2, 0], [2, 1], [2, 2], [2, 3]];
58 var optionIndex = 0; 58 var optionIndex = 0;
59 59
60 var canvas = document.createElement("canvas"); 60 var canvas = document.createElement("canvas");
61 canvas.setAttribute("width", "500"); 61 canvas.setAttribute("width", "500");
62 canvas.setAttribute("height", "500"); 62 canvas.setAttribute("height", "500");
63 var ctx = canvas.getContext("2d"); 63 var ctx = canvas.getContext("2d");
64 64
65 video = document.createElement("video"); 65 video = document.createElement("video");
66 video.addEventListener("canplaythrough", videoLoaded, false); 66 video.addEventListener("canplaythrough", videoLoaded, false);
67 video.src = "../../compositing/resources/video.ogv"; 67 video.src = "../../compositing/resources/video.ogv";
(...skipping 23 matching lines...) Expand all
91 checkCrop(imageBitmaps.cropCenter, imageOrientationOptions[optionIndex1] ); 91 checkCrop(imageBitmaps.cropCenter, imageOrientationOptions[optionIndex1] );
92 checkOverCrop(imageBitmaps.overCrop, imageOrientationOptions[optionIndex 1]); 92 checkOverCrop(imageBitmaps.overCrop, imageOrientationOptions[optionIndex 1]);
93 checkOverCropRight(imageBitmaps.overCropRight, imageOrientationOptions[o ptionIndex1]); 93 checkOverCropRight(imageBitmaps.overCropRight, imageOrientationOptions[o ptionIndex1]);
94 checkCrop(imageBitmaps.negativeCrop, imageOrientationOptions[optionIndex 1]); 94 checkCrop(imageBitmaps.negativeCrop, imageOrientationOptions[optionIndex 1]);
95 checkEmpty(imageBitmaps.empty, imageOrientationOptions[optionIndex1]); 95 checkEmpty(imageBitmaps.empty, imageOrientationOptions[optionIndex1]);
96 checkEmpty(imageBitmaps.emptyTwo, imageOrientationOptions[optionIndex1]) ; 96 checkEmpty(imageBitmaps.emptyTwo, imageOrientationOptions[optionIndex1]) ;
97 optionIndex++; 97 optionIndex++;
98 videoLoaded(); 98 videoLoaded();
99 }, function(ex) { 99 }, function(ex) {
100 // when the options are invalid, we expect the promise to be rejected. 100 // when the options are invalid, we expect the promise to be rejected.
101 if ((imageOrientationOptions[optionIndex1] != "none" && imageOrientation Options[optionIndex1] != "flipY") || 101 if (imageOrientationOptions[optionIndex1] == "invalid" || premultiplyAlp haOptions[optionIndex2] == "invalid") {
102 (premultiplyAlphaOptions[optionIndex2] != "default" && premultiplyAl phaOptions[optionIndex2] != "none")) {
103 testPassed("createImageBitmap with invalid options are rejected"); 102 testPassed("createImageBitmap with invalid options are rejected");
104 optionIndex++; 103 optionIndex++;
105 videoLoaded(); 104 videoLoaded();
106 } else { 105 } else {
107 testFailed("Promise was rejected." + ex); 106 testFailed("Promise was rejected." + ex);
108 finishJSTest(); 107 finishJSTest();
109 return; 108 return;
110 } 109 }
111 }); 110 });
112 } 111 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 ctx.drawImage(imageBitmap, 0, 0); 263 ctx.drawImage(imageBitmap, 0, 0);
265 shouldBeClear(10, 10); 264 shouldBeClear(10, 10);
266 shouldBeClear(90, 90); 265 shouldBeClear(90, 90);
267 shouldBeClear(110, 110); 266 shouldBeClear(110, 110);
268 shouldBeClear(210, 210); 267 shouldBeClear(210, 210);
269 } 268 }
270 269
271 </script> 270 </script>
272 </body> 271 </body>
273 </html> 272 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-video-with-options-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698