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-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
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 along with f lipY option."); 9 description("Ensure correct behavior of drawImage with ImageBitmaps along with f lipY option.");
10 window.jsTestIsAsync = true; 10 window.jsTestIsAsync = true;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 blob = xhr.response; 156 blob = xhr.response;
157 blobLoaded = true; 157 blobLoaded = true;
158 loaded(); 158 loaded();
159 } 159 }
160 160
161 function loaded() { 161 function loaded() {
162 if (imageLoaded && imageBitmapLoaded && blobLoaded) { 162 if (imageLoaded && imageBitmapLoaded && blobLoaded) {
163 // check all elements 163 // check all elements
164 elements = [image, aCanvas, d, testBitmap, blob]; 164 elements = [image, aCanvas, d, testBitmap, blob];
165 imageOrientationOptions = ["none", "flipY", "invalid"]; 165 imageOrientationOptions = ["none", "flipY", "invalid"];
166 premultiplyAlphaOptions = ["default", "none", "invalid"]; 166 premultiplyAlphaOptions = ["default", "none", "premultiply", "invalid"];
167 optionIndexArray = [[0, 0], [0, 1], [0, 2], 167 optionIndexArray = [[0, 0], [0, 1], [0, 2], [0, 3],
168 [1, 0], [1, 1], [1, 2], 168 [1, 0], [1, 1], [1, 2], [1, 3],
169 [2, 0], [2, 1], [2, 2]]; 169 [2, 0], [2, 1], [2, 2], [2, 3]];
170 // wait for callback to finish before each check to ensure synchronous b ehavior 170 // wait for callback to finish before each check to ensure synchronous b ehavior
171 nextCheck(0, 0); 171 nextCheck(0, 0);
172 } 172 }
173 } 173 }
174 174
175 function nextCheck(elementIndex, optionIndex) { 175 function nextCheck(elementIndex, optionIndex) {
176 if (elementIndex == elements.length) { 176 if (elementIndex == elements.length) {
177 finishJSTest(); 177 finishJSTest();
178 return; 178 return;
179 } 179 }
(...skipping 20 matching lines...) Expand all
200 checkOverCropRight(imageBitmaps.overCropRight, imageOrientationOptions[o ptionIndex1]); 200 checkOverCropRight(imageBitmaps.overCropRight, imageOrientationOptions[o ptionIndex1]);
201 checkCrop(imageBitmaps.negativeCrop, imageOrientationOptions[optionIndex 1]); 201 checkCrop(imageBitmaps.negativeCrop, imageOrientationOptions[optionIndex 1]);
202 checkEmpty(imageBitmaps.empty, imageOrientationOptions[optionIndex1]); 202 checkEmpty(imageBitmaps.empty, imageOrientationOptions[optionIndex1]);
203 checkEmpty(imageBitmaps.emptyTwo, imageOrientationOptions[optionIndex1]) ; 203 checkEmpty(imageBitmaps.emptyTwo, imageOrientationOptions[optionIndex1]) ;
204 if (optionIndex == optionIndexArray.length - 1) 204 if (optionIndex == optionIndexArray.length - 1)
205 nextCheck(elementIndex + 1, 0); 205 nextCheck(elementIndex + 1, 0);
206 else 206 else
207 nextCheck(elementIndex, optionIndex + 1); 207 nextCheck(elementIndex, optionIndex + 1);
208 }, function() { 208 }, function() {
209 // when the options are invalid, we expect the promise to be rejected. 209 // when the options are invalid, we expect the promise to be rejected.
210 if ((imageOrientationOptions[optionIndex1] != "none" && imageOrientation Options[optionIndex1] != "flipY") || 210 if (imageOrientationOptions[optionIndex1] == "invalid" || premultiplyAlp haOptions[optionIndex2] == "invalid") {
211 (premultiplyAlphaOptions[optionIndex2] != "default" && premultiplyAl phaOptions[optionIndex2] != "none")) {
212 testPassed("createImageBitmap with invalid options are rejected"); 211 testPassed("createImageBitmap with invalid options are rejected");
213 if (optionIndex == optionIndexArray.length - 1) 212 if (optionIndex == optionIndexArray.length - 1)
214 nextCheck(elementIndex + 1, 0); 213 nextCheck(elementIndex + 1, 0);
215 else 214 else
216 nextCheck(elementIndex, optionIndex + 1); 215 nextCheck(elementIndex, optionIndex + 1);
217 } else { 216 } else {
218 shouldNotBeCalled(); 217 shouldNotBeCalled();
219 } 218 }
220 }); 219 });
221 } 220 }
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 clearContext(ctx); 567 clearContext(ctx);
569 ctx.drawImage(imageBitmap, 0, 0); 568 ctx.drawImage(imageBitmap, 0, 0);
570 shouldBeClear(1, 1); 569 shouldBeClear(1, 1);
571 shouldBeClear(9, 9); 570 shouldBeClear(9, 9);
572 shouldBeClear(11, 11); 571 shouldBeClear(11, 11);
573 shouldBeClear(22, 22); 572 shouldBeClear(22, 22);
574 } 573 }
575 </script> 574 </script>
576 </body> 575 </body>
577 </html> 576 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698