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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-blob-resize.html

Issue 2218963002: Add more layout tests for createImageBitmap with resize options (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-canvas-resize.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-blob-resize.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-blob-resize.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-blob-resize.html
new file mode 100644
index 0000000000000000000000000000000000000000..1e08e696b85b9ba14a82a8339dc328abcfb8aedc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-blob-resize.html
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="./resources/webgl-test-utils-full.js"></script>
+<script src="./resources/tex-image-and-sub-image-utils.js"></script>
+<script src="./resources/tex-image-and-sub-image-image-bitmap-utils.js"></script>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<body>
+<script>
+var wtu = WebGLTestUtils;
+var tiu = TexImageUtils;
+var gl = null;
+var internalFormat = "RGBA";
+var pixelFormat = "RGBA";
+var pixelType = "UNSIGNED_BYTE";
+var redColor = [255, 0, 0];
+var greenColor = [0, 255, 0];
+var blackColor = [0, 0, 0];
+var darkRed = [26, 0, 0];
+var darkGreen = [0, 26, 0];
+
+var blob1 = null;
+var blob2 = null;
+
+function generateTest()
+{
+ var bitmaps = [];
+
+ var canvas = document.createElement('canvas');
+ canvas.width = 32;
+ canvas.height = 32;
+ document.body.appendChild(canvas);
+ gl = canvas.getContext("webgl");
+
+ gl.clearColor(0,0,0,1);
+ gl.clearDepth(1);
+
+ var p1 = createImageBitmap(blob1, {resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.defaultOption = imageBitmap });
+ var p2 = createImageBitmap(blob1, {imageOrientation: "none", premultiplyAlpha: "premultiply", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.noFlipYPremul = imageBitmap });
+ var p3 = createImageBitmap(blob1, {imageOrientation: "none", premultiplyAlpha: "default", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.noFlipYDefault = imageBitmap });
+ var p4 = createImageBitmap(blob1, {imageOrientation: "none", premultiplyAlpha: "none", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.noFlipYUnpremul = imageBitmap });
+ var p5 = createImageBitmap(blob1, {imageOrientation: "flipY", premultiplyAlpha: "premultiply", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.flipYPremul = imageBitmap });
+ var p6 = createImageBitmap(blob1, {imageOrientation: "flipY", premultiplyAlpha: "default", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.flipYDefault = imageBitmap });
+ var p7 = createImageBitmap(blob1, {imageOrientation: "flipY", premultiplyAlpha: "none", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.flipYUnpremul = imageBitmap });
+ var p8 = createImageBitmap(blob2, {resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.colorSpaceDef = imageBitmap });
+ var p9 = createImageBitmap(blob2, {colorSpaceConversion: "none", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.colorSpaceNone = imageBitmap });
+ var p10 = createImageBitmap(blob2, {colorSpaceConversion: "default", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.colorSpaceDefault = imageBitmap });
+ return Promise.all([p1, p2, p3, p4, p5, p6, p7, p8, p9, p10]).then(function() {
+ var alphaVal = 0.5;
+ var testPassed = runTest(bitmaps, alphaVal, true);
+ if (!testPassed)
+ assert_true(false, 'Test failed');
+ }, function() {
+ assert_true(false, 'Promise rejected');
+ });
+}
+
+promise_test(function() {
+ var xhr1 = new XMLHttpRequest();
+ xhr1.open("GET", 'resources/red-green-semi-transparent.png');
+ xhr1.responseType = 'blob';
+ xhr1.send();
+ xhr1.onload = function() {
+ blob1 = xhr1.response;
+ var xhr2 = new XMLHttpRequest();
+ xhr2.open("GET", 'resources/square-with-colorspin-profile.png');
+ xhr2.responseType = 'blob';
+ xhr2.send();
+ xhr2.onload = function() {
+ blob2 = xhr2.response;
+ return generateTest();
+ }
+ }
+}, 'createImageBitmap(Blob) with resize and other options');
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-canvas-resize.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698