Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/canvas/color-space/imageData-colorSpace.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/color-space/imageData-colorSpace.html b/third_party/WebKit/LayoutTests/fast/canvas/color-space/imageData-colorSpace.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..319005274b53947b45c53b9910da2229b0e3a3ce |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/color-space/imageData-colorSpace.html |
| @@ -0,0 +1,56 @@ |
| +<!DOCTYPE html> |
| +<body> |
| +<script src="../../../resources/testharness.js"></script> |
| +<script src="../../../resources/testharnessreport.js"></script> |
| +<script> |
| + |
| +var data = new Uint8ClampedArray([255, 0, 0, 255]); |
| + |
| +function createImageDataAndGetColorSpace(colorSpace) { |
| + experimental = new ImageData(1,1); |
| + imageData = experimental.createImageData(1, 1, colorSpace) |
| + return imageData.colorSpace; |
| +} |
| + |
| +function createWithDataAndGetColorSpaceW(colorSpace) { |
| + experimental = new ImageData(1,1); |
| + imageData = experimental.createImageData(data, 1, colorSpace) |
| + return imageData.colorSpace; |
| +} |
| + |
| +function createWithDataAndGetColorSpaceWH(colorSpace) { |
| + experimental = new ImageData(1,1); |
| + imageData = experimental.createImageData(data, 1, 1, colorSpace) |
| + return imageData.colorSpace; |
| +} |
| + |
| +test(function() { |
| + |
| + assert_equals((new ImageData(1,1)).colorSpace, "legacy-srgb"); |
|
Justin Novosad
2016/12/16 18:38:11
Please add descriptions.
zakerinasab1
2016/12/19 19:57:39
Done.
|
| + assert_equals(createImageDataAndGetColorSpace("legacy-srgb"), "legacy-srgb"); |
| + assert_equals(createImageDataAndGetColorSpace("srgb"), "srgb"); |
| + assert_throws("NotSupportedError", function() {createImageDataAndGetColorSpace("linear-rgb");}); |
| + assert_throws(null, function() {createImageDataAndGetColorSpace("undefined");}); |
| + |
| + assert_equals((new ImageData(data,1)).colorSpace, "legacy-srgb"); |
| + assert_equals(createWithDataAndGetColorSpaceW("legacy-srgb"), "legacy-srgb"); |
| + assert_equals(createWithDataAndGetColorSpaceW("srgb"), "srgb"); |
| + assert_throws("NotSupportedError", function() {createWithDataAndGetColorSpaceW("linear-rgb");}); |
| + assert_throws(null, function() {createWithDataAndGetColorSpaceW("undefined");}); |
| + |
| + assert_equals((new ImageData(data,1, 1)).colorSpace, "legacy-srgb"); |
| + assert_equals(createWithDataAndGetColorSpaceWH("legacy-srgb"), "legacy-srgb"); |
| + assert_equals(createWithDataAndGetColorSpaceWH("srgb"), "srgb"); |
| + assert_throws("NotSupportedError", function() {createWithDataAndGetColorSpaceWH("linear-rgb");}); |
| + assert_throws(null, function() {createWithDataAndGetColorSpaceWH("undefined");}); |
| + |
| +}, 'This test examines the correct behavior of createImageData API in setting and getting ImageData.colorSpace.'); |
| + |
| +</script> |
| + |
| + |
| + |
| +</script> |
| +</body> |
| + |
| + |