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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/color-space/canvas-colorspace-arguments.html

Issue 2708403003: Implement canvas color space IDL format for 2D canvas (Closed)
Patch Set: Fixing layout test failures Created 3 years, 10 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
Index: third_party/WebKit/LayoutTests/fast/canvas/color-space/canvas-colorspace-arguments.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/color-space/canvas-colorspace-arguments.html b/third_party/WebKit/LayoutTests/fast/canvas/color-space/canvas-colorspace-arguments.html
new file mode 100644
index 0000000000000000000000000000000000000000..7dfc76fdf679b7e094489861e47257238ec106a6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/color-space/canvas-colorspace-arguments.html
@@ -0,0 +1,61 @@
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+
+<script>
+
+var testScenarios = [
+ ["Test CanvasColorSpace value srgb", ["srgb"], ["srgb", "8-8-8-8", false]],
Justin Novosad 2017/02/23 18:48:13 Would be better to use a dictionary instead of an
zakerinasab 2017/02/23 20:22:33 Done.
+ ["Test CanvasColorSpace value rec2020", ["rec2020"], ["srgb", "8-8-8-8", false]],
+ ["Test CanvasColorSpace value p3", ["p3"], ["srgb", "8-8-8-8", false]],
+
+ ["Test supported CanvasColorSpace and CanvasPixelFormat combination: srgb/8-8-8-8", ["srgb", "8-8-8-8"], ["srgb", "8-8-8-8", false]],
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: srgb/10-10-10-2", ["srgb", "10-10-10-2"], ["srgb", "8-8-8-8", false]],
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: srgb/12-12-12-12", ["srgb", "12-12-12-12"], ["srgb", "8-8-8-8", false]],
+ ["Test supported CanvasColorSpace and CanvasPixelFormat combination: srgb/float16", ["srgb", "float16"], ["srgb", "float16", true]],
+
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: rec2020/8-8-8-8", ["rec2020", "8-8-8-8"], ["srgb", "8-8-8-8", false]],
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: rec2020/10-10-10-2", ["rec2020", "10-10-10-2"], ["srgb", "8-8-8-8", false]],
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: rec2020/12-12-12-12", ["rec2020", "12-12-12-12"], ["srgb", "8-8-8-8", false]],
+ ["Test supported CanvasColorSpace and CanvasPixelFormat combination: rec2020/float16", ["rec2020", "float16"], ["rec2020", "float16", true]],
+
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: p3/8-8-8-8", ["p3", "8-8-8-8"], ["srgb", "8-8-8-8", false]],
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: p3/10-10-10-2", ["p3", "10-10-10-2"], ["srgb", "8-8-8-8", false]],
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: p3/12-12-12-12", ["p3", "12-12-12-12"], ["srgb", "8-8-8-8", false]],
+ ["Test supported CanvasColorSpace and CanvasPixelFormat combination: p3/float16", ["p3", "float16"], ["p3", "float16", true]],
+
+ ["Test parameter linearPixelMath srgb/8-8-8-8/false", ["srgb", "8-8-8-8", false], ["srgb", "8-8-8-8", false]],
+ ["Test parameter linearPixelMath srgb/8-8-8-8/true", ["srgb", "8-8-8-8", true], ["srgb", "8-8-8-8", false]],
+ ["Test parameter linearPixelMath srgb/float16/false", ["srgb", "float16", false], ["srgb", "float16", true]],
+ ["Test parameter linearPixelMath srgb/float16/true", ["srgb", "float16", true], ["srgb", "float16", true]],
+
+ ["Test parameter linearPixelMath rec2020/float16/false", ["rec2020", "float16", false], ["rec2020", "float16", true]],
+ ["Test parameter linearPixelMath rec2020/float16/true", ["rec2020", "float16", true], ["rec2020", "float16", true]],
+
+ ["Test parameter linearPixelMath p3/float16/false", ["p3", "float16", false], ["p3", "float16", true]],
+ ["Test parameter linearPixelMath p3/float16/true", ["p3", "float16", true], ["p3", "float16", true]],
+];
+
+function runTestScenario(contextCreationParameters, expectedContextAttributes) {
+ var canvas = document. createElement('canvas');
+ var ctx;
+ switch(contextCreationParameters.length) {
+ case 1:
+ ctx = canvas.getContext('2d', {colorSpace: contextCreationParameters[0]});
+ case 2:
+ ctx = canvas.getContext('2d', {colorSpace: contextCreationParameters[0],
+ pixelFormat: contextCreationParameters[1]});
+ case 3:
+ ctx = canvas.getContext('2d', {colorSpace: contextCreationParameters[0],
+ pixelFormat: contextCreationParameters[1],
+ linearPixelMath: contextCreationParameters[2]});
+ }
+
+ var contextAttributes = ctx.getContextAttributes();
+ assert_equals(contextAttributes.colorSpace, expectedContextAttributes[0]);
+ assert_equals(contextAttributes.pixelFormat, expectedContextAttributes[1]);
+ assert_equals(contextAttributes.linearPixelMath, expectedContextAttributes[2]);
+}
+
+generate_tests(runTestScenario, testScenarios);
+</script>
+

Powered by Google App Engine
This is Rietveld 408576698