Skip to content

Commit

Permalink
Remove relative color tests that assume range scaling
Browse files Browse the repository at this point in the history
w3c/csswg-drafts#9094

Change-Id: I9ca3224647a272c214d0e4782ca44912213625ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4794880
Commit-Queue: Aaron Krajeski <aaronhk@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1187223}
  • Loading branch information
mysteryDate authored and Chromium LUCI CQ committed Aug 23, 2023
1 parent c83d1bf commit d8d8308
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 112 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This is a testharness.js-based test.
Found 934 tests; 893 PASS, 41 FAIL, 0 TIMEOUT, 0 NOTRUN.
Found 910 tests; 893 PASS, 17 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS Property color value 'rgb(from rebeccapurple r g b)'
PASS Property color value 'rgb(from rebeccapurple r g b / alpha)'
PASS Property color value 'rgb(from rgb(20%, 40%, 60%, 80%) r g b / alpha)'
Expand Down Expand Up @@ -262,18 +262,6 @@ PASS Property color value 'oklab(from oklab(none none none) l a b)'
PASS Property color value 'oklab(from oklab(none none none / none) l a b / alpha)'
PASS Property color value 'oklab(from oklab(0.25 none 0.5) l a b)'
PASS Property color value 'oklab(from oklab(0.25 0.2 0.5 / none) l a b / alpha)'
FAIL Property color value 'lab(from lab(.7 45 30) alpha b a / l)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 100 +/- 0.0001, expected 100 but got 1
FAIL Property color value 'lab(from lab(.7 45 30) alpha a b / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 100 +/- 0.0001, expected 100 but got 1
FAIL Property color value 'lab(from lab(.7 45 30) alpha a a / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 100 +/- 0.0001, expected 100 but got 1
FAIL Property color value 'lab(from lab(.7 45 30 / 40%) alpha b a / l)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 40 +/- 0.0001, expected 40 but got 0.4
FAIL Property color value 'lab(from lab(.7 45 30 / 40%) alpha a b / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 40 +/- 0.0001, expected 40 but got 0.4
FAIL Property color value 'lab(from lab(.7 45 30 / 40%) alpha a a / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 40 +/- 0.0001, expected 40 but got 0.4
FAIL Property color value 'oklab(from oklab(.7 0.45 0.3) alpha b a / l)' assert_array_approx_equals: Numeric parameters are approximately equal. lengths differ, expected 4 got 3
FAIL Property color value 'oklab(from oklab(.7 0.45 0.3) alpha a b / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 1 +/- 0.0001, expected 1 but got 0.01
FAIL Property color value 'oklab(from oklab(.7 0.45 0.3) alpha a a / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 1 +/- 0.0001, expected 1 but got 0.01
FAIL Property color value 'oklab(from oklab(.7 0.45 0.3 / 40%) alpha b a / l)' assert_array_approx_equals: Numeric parameters are approximately equal. lengths differ, expected 4 got 3
FAIL Property color value 'oklab(from oklab(.7 0.45 0.3 / 40%) alpha a b / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 0.4 +/- 0.0001, expected 0.4 but got 0.004
FAIL Property color value 'oklab(from oklab(.7 0.45 0.3 / 40%) alpha a a / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 0.4 +/- 0.0001, expected 0.4 but got 0.004
PASS Property color value 'lch(from lch(0.7 45 30) l c h)'
PASS Property color value 'lch(from lch(0.7 45 30) l c h / alpha)'
PASS Property color value 'lch(from lch(0.7 45 30 / 40%) l c h / alpha)'
Expand Down Expand Up @@ -376,18 +364,6 @@ PASS Property color value 'oklch(from oklch(none none none) l c h)'
PASS Property color value 'oklch(from oklch(none none none / none) l c h / alpha)'
PASS Property color value 'oklch(from oklch(0.7 none 30) l c h)'
PASS Property color value 'oklch(from oklch(0.7 0.45 30 / none) l c h / alpha)'
FAIL Property color value 'lch(from lch(.7 45 30) alpha c h / l)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 100 +/- 0.0001, expected 100 but got 1
FAIL Property color value 'lch(from lch(.7 45 30) alpha c h / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 100 +/- 0.0001, expected 100 but got 1
FAIL Property color value 'lch(from lch(.7 45 30) alpha c c / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 100 +/- 0.0001, expected 100 but got 1
FAIL Property color value 'lch(from lch(.7 45 30 / 40%) alpha c h / l)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 40 +/- 0.0001, expected 40 but got 0.4
FAIL Property color value 'lch(from lch(.7 45 30 / 40%) alpha c h / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 40 +/- 0.0001, expected 40 but got 0.4
FAIL Property color value 'lch(from lch(.7 45 30 / 40%) alpha c c / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 40 +/- 0.0001, expected 40 but got 0.4
FAIL Property color value 'oklch(from oklch(.7 0.45 30) alpha c h / l)' assert_array_approx_equals: Numeric parameters are approximately equal. lengths differ, expected 4 got 3
FAIL Property color value 'oklch(from oklch(.7 0.45 30) alpha c h / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 1 +/- 0.0001, expected 1 but got 0.01
FAIL Property color value 'oklch(from oklch(.7 0.45 30) alpha c c / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 1 +/- 0.0001, expected 1 but got 0.01
FAIL Property color value 'oklch(from oklch(.7 0.45 30 / 40%) alpha c h / l)' assert_array_approx_equals: Numeric parameters are approximately equal. lengths differ, expected 4 got 3
FAIL Property color value 'oklch(from oklch(.7 0.45 30 / 40%) alpha c h / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 0.4 +/- 0.0001, expected 0.4 but got 0.004
FAIL Property color value 'oklch(from oklch(.7 0.45 30 / 40%) alpha c c / alpha)' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 0.4 +/- 0.0001, expected 0.4 but got 0.004
PASS Property color value 'color(from color(srgb 0.7 0.5 0.3) srgb r g b)'
PASS Property color value 'color(from color(srgb 0.7 0.5 0.3) srgb r g b / alpha)'
PASS Property color value 'color(from color(srgb 0.7 0.5 0.3 / 40%) srgb r g b)'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,21 +385,6 @@
test_computed_value(`color`, `oklab(from oklab(0.25 none 0.5) l a b)`, `oklab(0.25 0 0.5)`);
test_computed_value(`color`, `oklab(from oklab(0.25 0.2 0.5 / none) l a b / alpha)`, `oklab(0.25 0.2 0.5 / 0)`);

// lab and oklab tests that require different results due to percent scaling differences.
test_computed_value(`color`, `lab(from lab(.7 45 30) alpha b a / l)`, `lab(100 30 45 / 0.7)`);
test_computed_value(`color`, `lab(from lab(.7 45 30) alpha a b / alpha)`, `lab(100 45 30)`);
test_computed_value(`color`, `lab(from lab(.7 45 30) alpha a a / alpha)`, `lab(100 45 45)`);
test_computed_value(`color`, `lab(from lab(.7 45 30 / 40%) alpha b a / l)`, `lab(40 30 45 / 0.7)`);
test_computed_value(`color`, `lab(from lab(.7 45 30 / 40%) alpha a b / alpha)`, `lab(40 45 30 / 0.4)`);
test_computed_value(`color`, `lab(from lab(.7 45 30 / 40%) alpha a a / alpha)`, `lab(40 45 45 / 0.4)`);

test_computed_value(`color`, `oklab(from oklab(.7 0.45 0.3) alpha b a / l)`, `oklab(1 0.3 0.45 / 0.7)`);
test_computed_value(`color`, `oklab(from oklab(.7 0.45 0.3) alpha a b / alpha)`, `oklab(1 0.45 0.3)`);
test_computed_value(`color`, `oklab(from oklab(.7 0.45 0.3) alpha a a / alpha)`, `oklab(1 0.45 0.45)`);
test_computed_value(`color`, `oklab(from oklab(.7 0.45 0.3 / 40%) alpha b a / l)`, `oklab(0.4 0.3 0.45 / 0.7)`);
test_computed_value(`color`, `oklab(from oklab(.7 0.45 0.3 / 40%) alpha a b / alpha)`, `oklab(0.4 0.45 0.3 / 0.4)`);
test_computed_value(`color`, `oklab(from oklab(.7 0.45 0.3 / 40%) alpha a a / alpha)`, `oklab(0.4 0.45 0.45 / 0.4)`);

// lch()

// Testing no modifications.
Expand Down Expand Up @@ -543,22 +528,6 @@
test_computed_value(`color`, `oklch(from oklch(0.7 none 30) l c h)`, `oklch(0.7 0 30)`);
test_computed_value(`color`, `oklch(from oklch(0.7 0.45 30 / none) l c h / alpha)`, `oklch(0.7 0.45 30 / 0)`);

// lch and oklch tests that require different results due to percent scaling differences.
test_computed_value(`color`, `lch(from lch(.7 45 30) alpha c h / l)`, `lch(100 45 30 / 0.7)`);
test_computed_value(`color`, `lch(from lch(.7 45 30) alpha c h / alpha)`, `lch(100 45 30)`);
test_computed_value(`color`, `lch(from lch(.7 45 30) alpha c c / alpha)`, `lch(100 45 45)`);
test_computed_value(`color`, `lch(from lch(.7 45 30 / 40%) alpha c h / l)`, `lch(40 45 30 / 0.7)`);
test_computed_value(`color`, `lch(from lch(.7 45 30 / 40%) alpha c h / alpha)`, `lch(40 45 30 / 0.4)`);
test_computed_value(`color`, `lch(from lch(.7 45 30 / 40%) alpha c c / alpha)`, `lch(40 45 45 / 0.4)`);

test_computed_value(`color`, `oklch(from oklch(.7 0.45 30) alpha c h / l)`, `oklch(1 0.45 30 / 0.7)`);
test_computed_value(`color`, `oklch(from oklch(.7 0.45 30) alpha c h / alpha)`, `oklch(1 0.45 30)`);
test_computed_value(`color`, `oklch(from oklch(.7 0.45 30) alpha c c / alpha)`, `oklch(1 0.45 0.45)`);
test_computed_value(`color`, `oklch(from oklch(.7 0.45 30 / 40%) alpha c h / l)`, `oklch(0.4 0.45 30 / 0.7)`);
test_computed_value(`color`, `oklch(from oklch(.7 0.45 30 / 40%) alpha c h / alpha)`, `oklch(0.4 0.45 30 / 0.4)`);
test_computed_value(`color`, `oklch(from oklch(.7 0.45 30 / 40%) alpha c c / alpha)`, `oklch(0.4 0.45 0.45 / 0.4)`);


for (const colorSpace of [ "srgb", "srgb-linear", "a98-rgb", "rec2020", "prophoto-rgb", "display-p3" ]) {
// Testing no modifications.
test_computed_value(`color`, `color(from color(${colorSpace} 0.7 0.5 0.3) ${colorSpace} r g b)`, `color(${colorSpace} 0.7 0.5 0.3)`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This is a testharness.js-based test.
Found 934 tests; 902 PASS, 32 FAIL, 0 TIMEOUT, 0 NOTRUN.
Found 910 tests; 902 PASS, 8 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS e.style['color'] = "rgb(from rebeccapurple r g b)" should set the property value
PASS e.style['color'] = "rgb(from rebeccapurple r g b / alpha)" should set the property value
PASS e.style['color'] = "rgb(from rgb(20%, 40%, 60%, 80%) r g b / alpha)" should set the property value
Expand Down Expand Up @@ -262,18 +262,6 @@ PASS e.style['color'] = "oklab(from oklab(none none none) l a b)" should set the
PASS e.style['color'] = "oklab(from oklab(none none none / none) l a b / alpha)" should set the property value
PASS e.style['color'] = "oklab(from oklab(0.25 none 0.5) l a b)" should set the property value
PASS e.style['color'] = "oklab(from oklab(0.25 0.2 0.5 / none) l a b / alpha)" should set the property value
FAIL e.style['color'] = "lab(from lab(.7 45 30) alpha b a / l)" should set the property value assert_equals: serialization should be canonical expected "lab(100 30 45 / 0.7)" but got "lab(1 30 45 / 0.7)"
FAIL e.style['color'] = "lab(from lab(.7 45 30) alpha a b / alpha)" should set the property value assert_equals: serialization should be canonical expected "lab(100 45 30)" but got "lab(1 45 30)"
FAIL e.style['color'] = "lab(from lab(.7 45 30) alpha a a / alpha)" should set the property value assert_equals: serialization should be canonical expected "lab(100 45 45)" but got "lab(1 45 45)"
FAIL e.style['color'] = "lab(from lab(.7 45 30 / 40%) alpha b a / l)" should set the property value assert_equals: serialization should be canonical expected "lab(40 30 45 / 0.7)" but got "lab(0.4 30 45 / 0.7)"
FAIL e.style['color'] = "lab(from lab(.7 45 30 / 40%) alpha a b / alpha)" should set the property value assert_equals: serialization should be canonical expected "lab(40 45 30 / 0.4)" but got "lab(0.4 45 30 / 0.4)"
FAIL e.style['color'] = "lab(from lab(.7 45 30 / 40%) alpha a a / alpha)" should set the property value assert_equals: serialization should be canonical expected "lab(40 45 45 / 0.4)" but got "lab(0.4 45 45 / 0.4)"
FAIL e.style['color'] = "oklab(from oklab(.7 0.45 0.3) alpha b a / l)" should set the property value assert_equals: serialization should be canonical expected "oklab(1 0.3 0.45 / 0.7)" but got "oklab(0.01 0.3 0.45)"
FAIL e.style['color'] = "oklab(from oklab(.7 0.45 0.3) alpha a b / alpha)" should set the property value assert_equals: serialization should be canonical expected "oklab(1 0.45 0.3)" but got "oklab(0.01 0.45 0.3)"
FAIL e.style['color'] = "oklab(from oklab(.7 0.45 0.3) alpha a a / alpha)" should set the property value assert_equals: serialization should be canonical expected "oklab(1 0.45 0.45)" but got "oklab(0.01 0.45 0.45)"
FAIL e.style['color'] = "oklab(from oklab(.7 0.45 0.3 / 40%) alpha b a / l)" should set the property value assert_equals: serialization should be canonical expected "oklab(0.4 0.3 0.45 / 0.7)" but got "oklab(0.004 0.3 0.45)"
FAIL e.style['color'] = "oklab(from oklab(.7 0.45 0.3 / 40%) alpha a b / alpha)" should set the property value assert_equals: serialization should be canonical expected "oklab(0.4 0.45 0.3 / 0.4)" but got "oklab(0.004 0.45 0.3 / 0.4)"
FAIL e.style['color'] = "oklab(from oklab(.7 0.45 0.3 / 40%) alpha a a / alpha)" should set the property value assert_equals: serialization should be canonical expected "oklab(0.4 0.45 0.45 / 0.4)" but got "oklab(0.004 0.45 0.45 / 0.4)"
PASS e.style['color'] = "lch(from lch(0.7 45 30) l c h)" should set the property value
PASS e.style['color'] = "lch(from lch(0.7 45 30) l c h / alpha)" should set the property value
PASS e.style['color'] = "lch(from lch(0.7 45 30 / 40%) l c h / alpha)" should set the property value
Expand Down Expand Up @@ -376,18 +364,6 @@ PASS e.style['color'] = "oklch(from oklch(none none none) l c h)" should set the
PASS e.style['color'] = "oklch(from oklch(none none none / none) l c h / alpha)" should set the property value
PASS e.style['color'] = "oklch(from oklch(0.7 none 30) l c h)" should set the property value
PASS e.style['color'] = "oklch(from oklch(0.7 0.45 30 / none) l c h / alpha)" should set the property value
FAIL e.style['color'] = "lch(from lch(.7 45 30) alpha c h / l)" should set the property value assert_equals: serialization should be canonical expected "lch(100 45 30 / 0.7)" but got "lch(1 45 30 / 0.7)"
FAIL e.style['color'] = "lch(from lch(.7 45 30) alpha c h / alpha)" should set the property value assert_equals: serialization should be canonical expected "lch(100 45 30)" but got "lch(1 45 30)"
FAIL e.style['color'] = "lch(from lch(.7 45 30) alpha c c / alpha)" should set the property value assert_equals: serialization should be canonical expected "lch(100 45 45)" but got "lch(1 45 45)"
FAIL e.style['color'] = "lch(from lch(.7 45 30 / 40%) alpha c h / l)" should set the property value assert_equals: serialization should be canonical expected "lch(40 45 30 / 0.7)" but got "lch(0.4 45 30 / 0.7)"
FAIL e.style['color'] = "lch(from lch(.7 45 30 / 40%) alpha c h / alpha)" should set the property value assert_equals: serialization should be canonical expected "lch(40 45 30 / 0.4)" but got "lch(0.4 45 30 / 0.4)"
FAIL e.style['color'] = "lch(from lch(.7 45 30 / 40%) alpha c c / alpha)" should set the property value assert_equals: serialization should be canonical expected "lch(40 45 45 / 0.4)" but got "lch(0.4 45 45 / 0.4)"
FAIL e.style['color'] = "oklch(from oklch(.7 0.45 30) alpha c h / l)" should set the property value assert_equals: serialization should be canonical expected "oklch(1 0.45 30 / 0.7)" but got "oklch(0.01 0.45 30)"
FAIL e.style['color'] = "oklch(from oklch(.7 0.45 30) alpha c h / alpha)" should set the property value assert_equals: serialization should be canonical expected "oklch(1 0.45 30)" but got "oklch(0.01 0.45 30)"
FAIL e.style['color'] = "oklch(from oklch(.7 0.45 30) alpha c c / alpha)" should set the property value assert_equals: serialization should be canonical expected "oklch(1 0.45 0.45)" but got "oklch(0.01 0.45 0.45)"
FAIL e.style['color'] = "oklch(from oklch(.7 0.45 30 / 40%) alpha c h / l)" should set the property value assert_equals: serialization should be canonical expected "oklch(0.4 0.45 30 / 0.7)" but got "oklch(0.004 0.45 30)"
FAIL e.style['color'] = "oklch(from oklch(.7 0.45 30 / 40%) alpha c h / alpha)" should set the property value assert_equals: serialization should be canonical expected "oklch(0.4 0.45 30 / 0.4)" but got "oklch(0.004 0.45 30 / 0.4)"
FAIL e.style['color'] = "oklch(from oklch(.7 0.45 30 / 40%) alpha c c / alpha)" should set the property value assert_equals: serialization should be canonical expected "oklch(0.4 0.45 0.45 / 0.4)" but got "oklch(0.004 0.45 0.45 / 0.4)"
PASS e.style['color'] = "color(from color(srgb 0.7 0.5 0.3) srgb r g b)" should set the property value
PASS e.style['color'] = "color(from color(srgb 0.7 0.5 0.3) srgb r g b / alpha)" should set the property value
PASS e.style['color'] = "color(from color(srgb 0.7 0.5 0.3 / 40%) srgb r g b)" should set the property value
Expand Down

0 comments on commit d8d8308

Please sign in to comment.