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

Side by Side 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, 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
(Empty)
1 <script src="../../../resources/testharness.js"></script>
2 <script src="../../../resources/testharnessreport.js"></script>
3
4 <script>
5
6 var testScenarios = [
7 ["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.
8 ["Test CanvasColorSpace value rec2020", ["rec2020"], ["srgb", "8-8-8-8", fa lse]],
9 ["Test CanvasColorSpace value p3", ["p3"], ["srgb", "8-8-8-8", false]],
10
11 ["Test supported CanvasColorSpace and CanvasPixelFormat combination: srgb/8- 8-8-8", ["srgb", "8-8-8-8"], ["srgb", "8-8-8-8", false]],
12 ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: srg b/10-10-10-2", ["srgb", "10-10-10-2"], ["srgb", "8-8-8-8", false]],
13 ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: srg b/12-12-12-12", ["srgb", "12-12-12-12"], ["srgb", "8-8-8-8", false]],
14 ["Test supported CanvasColorSpace and CanvasPixelFormat combination: srgb/fl oat16", ["srgb", "float16"], ["srgb", "float16", true]],
15
16 ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: rec 2020/8-8-8-8", ["rec2020", "8-8-8-8"], ["srgb", "8-8-8-8", false]],
17 ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: rec 2020/10-10-10-2", ["rec2020", "10-10-10-2"], ["srgb", "8-8-8-8", false]],
18 ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: rec 2020/12-12-12-12", ["rec2020", "12-12-12-12"], ["srgb", "8-8-8-8", false]],
19 ["Test supported CanvasColorSpace and CanvasPixelFormat combination: rec2020 /float16", ["rec2020", "float16"], ["rec2020", "float16", true]],
20
21 ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: p3/ 8-8-8-8", ["p3", "8-8-8-8"], ["srgb", "8-8-8-8", false]],
22 ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: p3/ 10-10-10-2", ["p3", "10-10-10-2"], ["srgb", "8-8-8-8", false]],
23 ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: p3/ 12-12-12-12", ["p3", "12-12-12-12"], ["srgb", "8-8-8-8", false]],
24 ["Test supported CanvasColorSpace and CanvasPixelFormat combination: p3/floa t16", ["p3", "float16"], ["p3", "float16", true]],
25
26 ["Test parameter linearPixelMath srgb/8-8-8-8/false", ["srgb", "8-8-8-8", fa lse], ["srgb", "8-8-8-8", false]],
27 ["Test parameter linearPixelMath srgb/8-8-8-8/true", ["srgb", "8-8-8-8", tru e], ["srgb", "8-8-8-8", false]],
28 ["Test parameter linearPixelMath srgb/float16/false", ["srgb", "float16", fa lse], ["srgb", "float16", true]],
29 ["Test parameter linearPixelMath srgb/float16/true", ["srgb", "float16", tru e], ["srgb", "float16", true]],
30
31 ["Test parameter linearPixelMath rec2020/float16/false", ["rec2020", "float1 6", false], ["rec2020", "float16", true]],
32 ["Test parameter linearPixelMath rec2020/float16/true", ["rec2020", "float16 ", true], ["rec2020", "float16", true]],
33
34 ["Test parameter linearPixelMath p3/float16/false", ["p3", "float16", false] , ["p3", "float16", true]],
35 ["Test parameter linearPixelMath p3/float16/true", ["p3", "float16", true], ["p3", "float16", true]],
36 ];
37
38 function runTestScenario(contextCreationParameters, expectedContextAttributes) {
39 var canvas = document. createElement('canvas');
40 var ctx;
41 switch(contextCreationParameters.length) {
42 case 1:
43 ctx = canvas.getContext('2d', {colorSpace: contextCreationParameters [0]});
44 case 2:
45 ctx = canvas.getContext('2d', {colorSpace: contextCreationParameters [0],
46 pixelFormat: contextCreationParameter s[1]});
47 case 3:
48 ctx = canvas.getContext('2d', {colorSpace: contextCreationParameters [0],
49 pixelFormat: contextCreationParameter s[1],
50 linearPixelMath: contextCreationParam eters[2]});
51 }
52
53 var contextAttributes = ctx.getContextAttributes();
54 assert_equals(contextAttributes.colorSpace, expectedContextAttributes[0]);
55 assert_equals(contextAttributes.pixelFormat, expectedContextAttributes[1]);
56 assert_equals(contextAttributes.linearPixelMath, expectedContextAttributes[2 ]);
57 }
58
59 generate_tests(runTestScenario, testScenarios);
60 </script>
61
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698