diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/css/css-color/parsing/color-invalid-color-function.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-color/parsing/color-invalid-color-function.html')
-rw-r--r-- | testing/web-platform/tests/css/css-color/parsing/color-invalid-color-function.html | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-color/parsing/color-invalid-color-function.html b/testing/web-platform/tests/css/css-color/parsing/color-invalid-color-function.html new file mode 100644 index 0000000000..5a39d42c2d --- /dev/null +++ b/testing/web-platform/tests/css/css-color/parsing/color-invalid-color-function.html @@ -0,0 +1,63 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Color Level 4: Parsing and serialization of colors using invalid color() function syntax</title> +<link rel="help" href="https://drafts.csswg.org/css-color-4/#color-function"> +<link rel="help" href="https://drafts.csswg.org/css-color-4/#resolving-color-function-values"> +<link rel="help" href="https://drafts.csswg.org/css-color-4/#serializing-color-function-values"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +for (const colorSpace of [ "srgb", "srgb-linear", "a98-rgb", "rec2020", "prophoto-rgb" ]) { + test_invalid_value("color", `color(${colorSpace} 0 0 0 0)`); + test_invalid_value("color", `color(${colorSpace} 0deg 0% 0)`); + test_invalid_value("color", `color(${colorSpace} 0% 0 0 1)`); + test_invalid_value("color", `color(${colorSpace} 0% 0 0 10%)`); + test_invalid_value("color", `color(${colorSpace} 0% 0 0deg)`); + test_invalid_value("color", `color(${colorSpace} 0% 0% 0deg)`); + test_invalid_value("color", `color(${colorSpace} 40% 0 0deg)`); + // Missing parameters should not parse + test_invalid_value("color", `color(${colorSpace} 50% -200)`); + test_invalid_value("color", `color(${colorSpace} 50%)`); + test_invalid_value("color", `color(${colorSpace})`); + test_invalid_value("color", `color(${colorSpace} 50% -200 / 0.5)`); + test_invalid_value("color", `color(${colorSpace} 50% / 0.5)`); + test_invalid_value("color", `color(${colorSpace} / 0.5)`); +} + +for (const colorSpace of [ "xyz", "xyz-d50", "xyz-d65" ]) { + test_invalid_value("color", `color(${colorSpace} 0 0 0 0)`); + test_invalid_value("color", `color(${colorSpace} 0deg 0% 0)`); + test_invalid_value("color", `color(${colorSpace} 0% 0 0 1)`); + test_invalid_value("color", `color(${colorSpace} 0% 0 0 10%)`); + test_invalid_value("color", `color(${colorSpace} 0% 0 0deg)`); + test_invalid_value("color", `color(${colorSpace} 0% 0% 0deg)`); + test_invalid_value("color", `color(${colorSpace} 40% 0 0deg)`); + // Missing parameters should not parse + test_invalid_value("color", `color(${colorSpace} 1 1)`); + test_invalid_value("color", `color(${colorSpace} 1)`); + test_invalid_value("color", `color(${colorSpace})`); + test_invalid_value("color", `color(${colorSpace} 1 1 / .5)`); + test_invalid_value("color", `color(${colorSpace} 1 / 0.5)`); + test_invalid_value("color", `color(${colorSpace} / 50%)`); +} + +test_invalid_value("color", "color()"); // Empty +test_invalid_value("color", "color(banana 1 1 1)"); // Bad color space +test_invalid_value("color", "color(displayp3 1 1 1)"); // Bad Display P3 color space +test_invalid_value("color", "color(1 1 1)"); // No color space +test_invalid_value("color", "color(srgb 1 1)"); // One missing component +test_invalid_value("color", "color(srgb 1)"); // Two missing components + +test_invalid_value("color", "color(srgb 1 1 1 1)"); // Too many parameters +test_invalid_value("color", "color(srgb 1 1 1 1 1)"); // Way too many parameters +test_invalid_value("color", "color(srgb 1 eggs 1)"); // Bad parameters +test_invalid_value("color", "color(srgb 1 1 1 / bacon)"); // Bad alpha +test_invalid_value("color", "color(srgb 1 1 1 / 1 cucumber)"); // Junk after alpha +</script> +</body> +</html> |