OLD | NEW |
(Empty) | |
| 1 <script src="../../../../../resources/testharness.js"></script> |
| 2 <script src="../../../../../resources/testharnessreport.js"></script> |
| 3 |
| 4 <script> |
| 5 |
| 6 var testScenarios = [ |
| 7 ["Test default context creation parameters", {}, {colorSpace: "srgb", pixelF
ormat: "8-8-8-8", linearPixelMath: false}], |
| 8 |
| 9 ["Test CanvasColorSpace value srgb", {colorSpace: "srgb"}, {colorSpace: "srg
b", pixelFormat: "8-8-8-8", linearPixelMath: false}], |
| 10 ["Test CanvasColorSpace value rec2020", {colorSpace: "rec2020"}, {colorSpac
e: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}], |
| 11 ["Test CanvasColorSpace value p3", {colorSpace: "p3"}, {colorSpace: "srgb",
pixelFormat: "8-8-8-8", linearPixelMath: false}], |
| 12 |
| 13 ["Test CanvasPixelFormat value 8-8-8-8", {pixelFormat: "8-8-8-8"}, {colorSpa
ce: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}], |
| 14 ["Test CanvasPixelFormat value 10-10-10-2", {pixelFormat: "10-10-10-2"}, {co
lorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}], |
| 15 ["Test CanvasPixelFormat value 12-12-12-12", {pixelFormat: "12-12-12-12"}, {
colorSpace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}], |
| 16 ["Test CanvasPixelFormat value float16", {pixelFormat: "float16"}, {colorSpa
ce: "srgb", pixelFormat: "float16", linearPixelMath: true}], |
| 17 |
| 18 ["Test supported CanvasColorSpace and CanvasPixelFormat combination: srgb/8-
8-8-8", {colorSpace: "srgb", pixelFormat: "8-8-8-8"}, {colorSpace: "srgb", pixel
Format: "8-8-8-8", linearPixelMath: false}], |
| 19 ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: srg
b/10-10-10-2", {colorSpace: "srgb", pixelFormat: "10-10-10-2"}, {colorSpace: "sr
gb", pixelFormat: "8-8-8-8", linearPixelMath: false}], |
| 20 ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: srg
b/12-12-12-12", {colorSpace: "srgb", pixelFormat: "12-12-12-12"}, {colorSpace: "
srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}], |
| 21 ["Test supported CanvasColorSpace and CanvasPixelFormat combination: srgb/fl
oat16", {colorSpace: "srgb", pixelFormat: "float16"}, {colorSpace: "srgb", pixel
Format: "float16", linearPixelMath: true}], |
| 22 |
| 23 ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: rec
2020/8-8-8-8", {colorSpace: "rec2020", pixelFormat: "8-8-8-8"}, {colorSpace: "sr
gb", pixelFormat: "8-8-8-8", linearPixelMath: false}], |
| 24 ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: rec
2020/10-10-10-2", {colorSpace: "rec2020", pixelFormat: "10-10-10-2"}, {colorSpac
e: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}], |
| 25 ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: rec
2020/12-12-12-12", {colorSpace: "rec2020", pixelFormat: "12-12-12-12"}, {colorSp
ace: "srgb", pixelFormat: "8-8-8-8", linearPixelMath: false}], |
| 26 ["Test supported CanvasColorSpace and CanvasPixelFormat combination: rec2020
/float16", {colorSpace: "rec2020", pixelFormat: "float16"}, {colorSpace: "rec202
0", pixelFormat: "float16", linearPixelMath: true}], |
| 27 |
| 28 ["Test not-supported CanvasColorSpace and CanvasPixelFormat combination: p3/
8-8-8-8", {colorSpace: "p3", pixelFormat: "8-8-8-8"}, {colorSpace: "srgb", pixel
Format: "8-8-8-8", linearPixelMath: false}], |
| 29 ["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}], |
| 30 ["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}], |
| 31 ["Test supported CanvasColorSpace and CanvasPixelFormat combination: p3/floa
t16", {colorSpace: "p3", pixelFormat: "float16"}, {colorSpace: "p3", pixelFormat
: "float16", linearPixelMath: true}], |
| 32 |
| 33 ["Test parameter linearPixelMath srgb/8-8-8-8/false", {colorSpace: "srgb", p
ixelFormat: "8-8-8-8", linearPixelMath: false}, {colorSpace: "srgb", pixelFormat
: "8-8-8-8", linearPixelMath: false}], |
| 34 ["Test parameter linearPixelMath srgb/8-8-8-8/true", {colorSpace: "srgb", pi
xelFormat: "8-8-8-8", linearPixelMath: true}, {colorSpace: "srgb", pixelFormat:
"8-8-8-8", linearPixelMath: false}], |
| 35 ["Test parameter linearPixelMath srgb/float16/false", {colorSpace: "srgb", p
ixelFormat: "float16", linearPixelMath: false}, {colorSpace: "srgb", pixelFormat
: "float16", linearPixelMath: true}], |
| 36 ["Test parameter linearPixelMath srgb/float16/true", {colorSpace: "srgb", pi
xelFormat: "float16", linearPixelMath: true}, {colorSpace: "srgb", pixelFormat:
"float16", linearPixelMath: true}], |
| 37 |
| 38 ["Test parameter linearPixelMath rec2020/float16/false", {colorSpace: "rec20
20", pixelFormat: "float16", linearPixelMath: false}, {colorSpace: "rec2020", pi
xelFormat: "float16", linearPixelMath: true}], |
| 39 ["Test parameter linearPixelMath rec2020/float16/true", {colorSpace: "rec202
0", pixelFormat: "float16", linearPixelMath: true}, {colorSpace: "rec2020", pixe
lFormat: "float16", linearPixelMath: true}], |
| 40 |
| 41 ["Test parameter linearPixelMath p3/float16/false", {colorSpace: "p3", pixel
Format: "float16", linearPixelMath: false}, {colorSpace: "p3", pixelFormat: "flo
at16", linearPixelMath: true}], |
| 42 ["Test parameter linearPixelMath p3/float16/true", {colorSpace: "p3", pixelF
ormat: "float16", linearPixelMath: true}, {colorSpace: "p3", pixelFormat: "float
16", linearPixelMath: true}], |
| 43 ]; |
| 44 |
| 45 function runTestScenario(contextCreationParameters, expectedContextAttributes) { |
| 46 console.log(contextCreationParameters); |
| 47 var canvas = document. createElement('canvas'); |
| 48 var ctx = canvas.getContext('2d', contextCreationParameters); |
| 49 var contextAttributes = ctx.getContextAttributes(); |
| 50 console.log(contextAttributes); |
| 51 console.log(expectedContextAttributes); |
| 52 assert_equals(contextAttributes.colorSpace, expectedContextAttributes.colorS
pace); |
| 53 assert_equals(contextAttributes.pixelFormat, expectedContextAttributes.pixel
Format); |
| 54 assert_equals(contextAttributes.linearPixelMath, expectedContextAttributes.l
inearPixelMath); |
| 55 } |
| 56 |
| 57 generate_tests(runTestScenario, testScenarios); |
| 58 </script> |
| 59 |
OLD | NEW |