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-valid-lab.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-valid-lab.html')
-rw-r--r-- | testing/web-platform/tests/css/css-color/parsing/color-valid-lab.html | 157 |
1 files changed, 157 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-color/parsing/color-valid-lab.html b/testing/web-platform/tests/css/css-color/parsing/color-valid-lab.html new file mode 100644 index 0000000000..95423f1965 --- /dev/null +++ b/testing/web-platform/tests/css/css-color/parsing/color-valid-lab.html @@ -0,0 +1,157 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Color Level 4: Parsing and serialization of colors using valid Lab notation</title> +<link rel="help" href="https://drafts.csswg.org/css-color-4/#lab-colors"> +<link rel="help" href="https://drafts.csswg.org/css-color-4/#resolving-lab-lch-values"> +<link rel="help" href="https://drafts.csswg.org/css-color-4/#resolving-oklab-oklch-values"> +<link rel="help" href="https://drafts.csswg.org/css-color-4/#serializing-lab-lch"> +<link rel="help" href="https://drafts.csswg.org/css-color-4/#serializing-oklab-oklch"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> + +// lab() +test_valid_value("color", "lab(0 0 0)", "lab(0 0 0)"); +test_valid_value("color", "lab(0 0 0 / 1)", "lab(0 0 0)"); +test_valid_value("color", "lab(0 0 0 / 0.5)", "lab(0 0 0 / 0.5)"); +test_valid_value("color", "lab(20 0 10/0.5)", "lab(20 0 10 / 0.5)"); +test_valid_value("color", "lab(20 0 10/50%)", "lab(20 0 10 / 0.5)"); +test_valid_value("color", "lab(400 0 10/50%)", "lab(100 0 10 / 0.5)"); +test_valid_value("color", "lab(50 -160 160)", "lab(50 -160 160)"); +test_valid_value("color", "lab(50 -200 200)", "lab(50 -200 200)"); +test_valid_value("color", "lab(0 0 0 / -10%)", "lab(0 0 0 / 0)"); +test_valid_value("color", "lab(0 0 0 / 110%)", "lab(0 0 0)"); +test_valid_value("color", "lab(0 0 0 / 300%)", "lab(0 0 0)"); +test_valid_value("color", "lab(-40 0 0)", "lab(0 0 0)"); +test_valid_value("color", "lab(50 -20 0)", "lab(50 -20 0)"); +test_valid_value("color", "lab(50 0 -20)", "lab(50 0 -20)"); +test_valid_value("color", "lab(calc(50 * 3) calc(0.5 - 1) calc(1.5) / calc(-0.5 + 1))", "lab(100 -0.5 1.5 / 0.5)"); +test_valid_value("color", "lab(calc(-50 * 3) calc(0.5 + 1) calc(-1.5) / calc(-0.5 * 2))", "lab(0 1.5 -1.5 / 0)"); + +test_valid_value("color", "lab(none none none / none)", "lab(none none none / none)"); +test_valid_value("color", "lab(none none none)", "lab(none none none)"); +test_valid_value("color", "lab(20 none none / none)", "lab(20 none none / none)"); +test_valid_value("color", "lab(none none none / 0.5)", "lab(none none none / 0.5)"); +test_valid_value("color", "lab(0 0 0 / none)", "lab(0 0 0 / none)"); + +test_valid_value("color", "lab(calc(infinity) 0 0)", "lab(100 0 0)"); +test_valid_value("color", "lab(50 calc(infinity) 0)", "lab(50 calc(infinity) 0)"); +test_valid_value("color", "lab(50 calc(-infinity) 0)", "lab(50 calc(-infinity) 0)"); +test_valid_value("color", "lab(calc(NaN) 0 0)", "lab(calc(NaN) 0 0)"); +test_valid_value("color", "lab(calc(0 / 0) 0 0)", "lab(calc(NaN) 0 0)"); + +// oklab() +test_valid_value("color", "oklab(0 0 0)", "oklab(0 0 0)"); +test_valid_value("color", "oklab(0 0 0 / 1)", "oklab(0 0 0)"); +test_valid_value("color", "oklab(0 0 0 / 0.5)", "oklab(0 0 0 / 0.5)"); +test_valid_value("color", "oklab(0.2 0 0.1/0.5)", "oklab(0.2 0 0.1 / 0.5)"); +test_valid_value("color", "oklab(0.2 0 0.1/50%)", "oklab(0.2 0 0.1 / 0.5)"); +test_valid_value("color", "oklab(4 0 0.1/50%)", "oklab(1 0 0.1 / 0.5)"); +test_valid_value("color", "oklab(0.5 -1.6 1.6)", "oklab(0.5 -1.6 1.6)"); +test_valid_value("color", "oklab(0.5 -2 2)", "oklab(0.5 -2 2)"); +test_valid_value("color", "oklab(0 0 0 / -10%)", "oklab(0 0 0 / 0)"); +test_valid_value("color", "oklab(0 0 0 / 110%)", "oklab(0 0 0)"); +test_valid_value("color", "oklab(0 0 0 / 300%)", "oklab(0 0 0)"); +test_valid_value("color", "oklab(-0.4 0 0)", "oklab(0 0 0)"); +test_valid_value("color", "oklab(0.5 -2 0)", "oklab(0.5 -2 0)"); +test_valid_value("color", "oklab(0.5 0 -2)", "oklab(0.5 0 -2)"); +test_valid_value("color", "oklab(calc(0.5 * 3) calc(0.5 - 1) calc(1.5) / calc(-0.5 + 1))", "oklab(1 -0.5 1.5 / 0.5)"); +test_valid_value("color", "oklab(calc(-0.5 * 3) calc(0.5 + 1) calc(-1.5) / calc(-0.5 * 2))", "oklab(0 1.5 -1.5 / 0)"); + +test_valid_value("color", "oklab(none none none / none)", "oklab(none none none / none)"); +test_valid_value("color", "oklab(none none none)", "oklab(none none none)"); +test_valid_value("color", "oklab(0.2 none none / none)", "oklab(0.2 none none / none)"); +test_valid_value("color", "oklab(none none none / 0.5)", "oklab(none none none / 0.5)"); +test_valid_value("color", "oklab(0 0 0 / none)", "oklab(0 0 0 / none)"); + +// These tests validate the ranges of lab() vs. oklab() components +test_valid_value("color", "lab(20% -50% 90%/0.5)", "lab(20 -62.5 112.5 / 0.5)"); +test_valid_value("color", "oklab(20% 70% -80%/0.5)", "oklab(0.2 0.28 -0.32 / 0.5)"); + +test_valid_value("color", "oklab(calc(infinity) 0 0)", "oklab(1 0 0)"); +test_valid_value("color", "oklab(0.5 calc(infinity) 0)", "oklab(0.5 calc(infinity) 0)"); +test_valid_value("color", "oklab(0.5 calc(-infinity) 0)", "oklab(0.5 calc(-infinity) 0)"); +test_valid_value("color", "oklab(calc(NaN) 0 0)", "oklab(calc(NaN) 0 0)"); +test_valid_value("color", "oklab(calc(0 / 0) 0 0)", "oklab(calc(NaN) 0 0)"); + +// lch() +test_valid_value("color", "lch(0 0 0deg)", "lch(0 0 0)"); +test_valid_value("color", "lch(0 0 0deg / 1)", "lch(0 0 0)"); +test_valid_value("color", "lch(0 0 0deg / 0.5)", "lch(0 0 0 / 0.5)"); +test_valid_value("color", "lch(100 230 0deg / 0.5)", "lch(100 230 0 / 0.5)"); +test_valid_value("color", "lch(20 50 20deg/0.5)", "lch(20 50 20 / 0.5)"); +test_valid_value("color", "lch(20 50 20deg/50%)", "lch(20 50 20 / 0.5)"); +test_valid_value("color", "lch(10 20 20deg / -10%)", "lch(10 20 20 / 0)"); +test_valid_value("color", "lch(10 20 20deg / 110%)", "lch(10 20 20)"); +test_valid_value("color", "lch(10 20 1.28rad)", "lch(10 20 73.3386)"); +test_valid_value("color", "lch(10 20 380deg)", "lch(10 20 20)"); +test_valid_value("color", "lch(10 20 -340deg)", "lch(10 20 20)"); +test_valid_value("color", "lch(10 20 740deg)", "lch(10 20 20)"); +test_valid_value("color", "lch(10 20 -700deg)", "lch(10 20 20)"); +test_valid_value("color", "lch(-40 0 0)", "lch(0 0 0)"); +test_valid_value("color", "lch(20 -20 0)", "lch(20 0 0)"); +test_valid_value("color", "lch(0 0 0 / 0.5)", "lch(0 0 0 / 0.5)"); +test_valid_value("color", "lch(10 20 20 / 110%)", "lch(10 20 20)"); +test_valid_value("color", "lch(10 20 -700)", "lch(10 20 20)"); +test_valid_value("color", "lch(calc(50 * 3) calc(0.5 - 1) calc(20deg * 2) / calc(-0.5 + 1))", "lch(100 0 40 / 0.5)"); +test_valid_value("color", "lch(calc(-50 * 3) calc(0.5 + 1) calc(-20deg * 2) / calc(-0.5 * 2))", "lch(0 1.5 320 / 0)"); + +test_valid_value("color", "lch(none none none / none)", "lch(none none none / none)"); +test_valid_value("color", "lch(none none none)", "lch(none none none)"); +test_valid_value("color", "lch(20 none none / none)", "lch(20 none none / none)"); +test_valid_value("color", "lch(none none none / 0.5)", "lch(none none none / 0.5)"); +test_valid_value("color", "lch(0 0 0 / none)", "lch(0 0 0 / none)"); + +test_valid_value("color", "lch(calc(infinity) 0 0)", "lch(100 0 0)"); +test_valid_value("color", "lch(50 calc(infinity) 0)", "lch(50 calc(infinity) 0)"); +test_valid_value("color", "lch(50 calc(-infinity) 0)", "lch(50 0 0)"); +test_valid_value("color", "lch(calc(NaN) 0 0)", "lch(calc(NaN) 0 0)"); +test_valid_value("color", "lch(calc(0 / 0) 0 0)", "lch(calc(NaN) 0 0)"); + +// oklch() +test_valid_value("color", "oklch(0 0 0deg)", "oklch(0 0 0)"); +test_valid_value("color", "oklch(0 0 0deg / 1)", "oklch(0 0 0)"); +test_valid_value("color", "oklch(0 0 0deg / 0.5)", "oklch(0 0 0 / 0.5)"); +test_valid_value("color", "oklch(1 2.3 0deg / 0.5)", "oklch(1 2.3 0 / 0.5)"); +test_valid_value("color", "oklch(0.2 0.5 20deg/0.5)", "oklch(0.2 0.5 20 / 0.5)"); +test_valid_value("color", "oklch(0.2 0.5 20deg/50%)", "oklch(0.2 0.5 20 / 0.5)"); +test_valid_value("color", "oklch(0.1 0.2 20deg / -10%)", "oklch(0.1 0.2 20 / 0)"); +test_valid_value("color", "oklch(0.1 0.2 20deg / 110%)", "oklch(0.1 0.2 20)"); +test_valid_value("color", "oklch(0.1 0.2 1.28rad)", "oklch(0.1 0.2 73.3386)"); +test_valid_value("color", "oklch(0.1 0.2 380deg)", "oklch(0.1 0.2 20)"); +test_valid_value("color", "oklch(0.1 0.2 -340deg)", "oklch(0.1 0.2 20)"); +test_valid_value("color", "oklch(0.1 0.2 740deg)", "oklch(0.1 0.2 20)"); +test_valid_value("color", "oklch(0.1 0.2 -700deg)", "oklch(0.1 0.2 20)"); +test_valid_value("color", "oklch(-4 0 0)", "oklch(0 0 0)"); +test_valid_value("color", "oklch(0.2 -0.2 0)", "oklch(0.2 0 0)"); +test_valid_value("color", "oklch(0 0 0 / 0.5)", "oklch(0 0 0 / 0.5)"); +test_valid_value("color", "oklch(0.1 0.2 20 / 110%)", "oklch(0.1 0.2 20)"); +test_valid_value("color", "oklch(0.1 0.2 -700)", "oklch(0.1 0.2 20)"); +test_valid_value("color", "oklch(calc(0.5 * 3) calc(0.5 - 1) calc(20deg * 2) / calc(-0.5 + 1))", "oklch(1 0 40 / 0.5)"); +test_valid_value("color", "oklch(calc(-0.5 * 3) calc(0.5 + 1) calc(-20deg * 2) / calc(-0.5 * 2))", "oklch(0 1.5 320 / 0)"); + +test_valid_value("color", "oklch(none none none / none)", "oklch(none none none / none)"); +test_valid_value("color", "oklch(none none none)", "oklch(none none none)"); +test_valid_value("color", "oklch(0.2 none none / none)", "oklch(0.2 none none / none)"); +test_valid_value("color", "oklch(none none none / 0.5)", "oklch(none none none / 0.5)"); +test_valid_value("color", "oklch(0 0 0 / none)", "oklch(0 0 0 / none)"); + + +// These tests validate the ranges of lch() vs. oklch() lightness and chroma +test_valid_value("color", "lch(20% 80% 10/0.5)", "lch(20 120 10 / 0.5)"); +test_valid_value("color", "oklch(20% 60% 10/0.5)", "oklch(0.2 0.24 10 / 0.5)"); + +test_valid_value("color", "oklch(calc(infinity) 0 0)", "oklch(1 0 0)"); +test_valid_value("color", "oklch(0.5 calc(infinity) 0)", "oklch(0.5 calc(infinity) 0)"); +test_valid_value("color", "oklch(0.5 calc(-infinity) 0)", "oklch(0.5 0 0)"); +test_valid_value("color", "oklch(calc(NaN) 0 0)", "oklch(calc(NaN) 0 0)"); +test_valid_value("color", "oklch(calc(0 / 0) 0 0)", "oklch(calc(NaN) 0 0)"); + +</script> +</body> +</html> |