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

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

Issue 2708403003: Implement canvas color space IDL format for 2D canvas (Closed)
Patch Set: Addressing GPU pixel 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/virtual/color_space/fast/canvas/color-space/canvas-colorspace-arguments.html
diff --git a/third_party/WebKit/LayoutTests/virtual/color_space/fast/canvas/color-space/canvas-colorspace-arguments.html b/third_party/WebKit/LayoutTests/virtual/color_space/fast/canvas/color-space/canvas-colorspace-arguments.html
new file mode 100644
index 0000000000000000000000000000000000000000..2ee2a98417287de6fda97df6cbae23ebd0d2d6c0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/color_space/fast/canvas/color-space/canvas-colorspace-arguments.html
@@ -0,0 +1,59 @@
+<script src="../../../../../resources/testharness.js"></script>
+<script src="../../../../../resources/testharnessreport.js"></script>
+
+<script>
+
+var testScenarios = [
+ ["Test default context creation parameters", {}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+
+ ["Test CanvasColorSpace value srgb", {colorSpace: "srgb"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test CanvasColorSpace value rec2020", {colorSpace: "rec2020"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test CanvasColorSpace value p3", {colorSpace: "p3"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+
+ ["Test CanvasPixelFormat value 8-8-8-8", {pixelFormat: "8-8-8-8"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test CanvasPixelFormat value 10-10-10-2", {pixelFormat: "10-10-10-2"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test CanvasPixelFormat value 12-12-12-12", {pixelFormat: "12-12-12-12"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test CanvasPixelFormat value float16", {pixelFormat: "float16"}, {colorSpace: "srgb", pixelFormat: "float16", linearPixelMath: true}],
+
+ ["Test supported CanvasColorSpace and CanvasPixelFormat combination: srgb/8-8-8-8", {colorSpace: "srgb", pixelFormat: "8-8-8-8"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: srgb/10-10-10-2", {colorSpace: "srgb", pixelFormat: "10-10-10-2"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: srgb/12-12-12-12", {colorSpace: "srgb", pixelFormat: "12-12-12-12"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test supported CanvasColorSpace and CanvasPixelFormat combination: srgb/float16", {colorSpace: "srgb", pixelFormat: "float16"}, {colorSpace: "srgb", pixelFormat: "float16", linearPixelMath: true}],
+
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: rec2020/8-8-8-8", {colorSpace: "rec2020", pixelFormat: "8-8-8-8"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: rec2020/10-10-10-2", {colorSpace: "rec2020", pixelFormat: "10-10-10-2"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: rec2020/12-12-12-12", {colorSpace: "rec2020", pixelFormat: "12-12-12-12"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test supported CanvasColorSpace and CanvasPixelFormat combination: rec2020/float16", {colorSpace: "rec2020", pixelFormat: "float16"}, {colorSpace: "rec2020", pixelFormat: "float16", linearPixelMath: true}],
+
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: p3/8-8-8-8", {colorSpace: "p3", pixelFormat: "8-8-8-8"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: p3/10-10-10-2", {colorSpace: "p3", pixelFormat: "10-10-10-2"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: p3/12-12-12-12", {colorSpace: "p3", pixelFormat: "12-12-12-12"}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test supported CanvasColorSpace and CanvasPixelFormat combination: p3/float16", {colorSpace: "p3", pixelFormat: "float16"}, {colorSpace: "p3", pixelFormat: "float16", linearPixelMath: true}],
+
+ ["Test parameter linearPixelMath srgb/8-8-8-8/false", {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test parameter linearPixelMath srgb/8-8-8-8/true", {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: true}, {colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}],
+ ["Test parameter linearPixelMath srgb/float16/false", {colorSpace: "srgb", pixelFormat: "float16", linearPixelMath: false}, {colorSpace: "srgb", pixelFormat: "float16", linearPixelMath: true}],
+ ["Test parameter linearPixelMath srgb/float16/true", {colorSpace: "srgb", pixelFormat: "float16", linearPixelMath: true}, {colorSpace: "srgb", pixelFormat: "float16", linearPixelMath: true}],
+
+ ["Test parameter linearPixelMath rec2020/float16/false", {colorSpace: "rec2020", pixelFormat: "float16", linearPixelMath: false}, {colorSpace: "rec2020", pixelFormat: "float16", linearPixelMath: true}],
+ ["Test parameter linearPixelMath rec2020/float16/true", {colorSpace: "rec2020", pixelFormat: "float16", linearPixelMath: true}, {colorSpace: "rec2020", pixelFormat: "float16", linearPixelMath: true}],
+
+ ["Test parameter linearPixelMath p3/float16/false", {colorSpace: "p3", pixelFormat: "float16", linearPixelMath: false}, {colorSpace: "p3", pixelFormat: "float16", linearPixelMath: true}],
+ ["Test parameter linearPixelMath p3/float16/true", {colorSpace: "p3", pixelFormat: "float16", linearPixelMath: true}, {colorSpace: "p3", pixelFormat: "float16", linearPixelMath: true}],
+];
+
+function runTestScenario(contextCreationParameters, expectedContextAttributes) {
+ console.log(contextCreationParameters);
+ var canvas = document. createElement('canvas');
+ var ctx = canvas.getContext('2d', contextCreationParameters);
+ var contextAttributes = ctx.getContextAttributes();
+ console.log(contextAttributes);
+ console.log(expectedContextAttributes);
+ assert_equals(contextAttributes.colorSpace, expectedContextAttributes.colorSpace);
+ assert_equals(contextAttributes.pixelFormat, expectedContextAttributes.pixelFormat);
+ assert_equals(contextAttributes.linearPixelMath, expectedContextAttributes.linearPixelMath);
+}
+
+generate_tests(runTestScenario, testScenarios);
+</script>
+

Powered by Google App Engine
This is Rietveld 408576698