diff options
| author | Sébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com> | 2023-09-19 15:48:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-19 15:48:33 +0200 |
| commit | 163c2e1aa27169c1eba946204096d3e8fdfd3c18 (patch) | |
| tree | 0f4c58bf41239865a6cdcaac77a6314dbbb5b8c8 /tests/typ/compiler/methods.typ | |
| parent | bb59f0e2b21c42a796b5eb8d8882a1d2b2a0c35f (diff) | |
Gradient Part 1 - Color rework (#2171)
Diffstat (limited to 'tests/typ/compiler/methods.typ')
| -rw-r--r-- | tests/typ/compiler/methods.typ | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/tests/typ/compiler/methods.typ b/tests/typ/compiler/methods.typ index e4c09ed2..8f70bd8c 100644 --- a/tests/typ/compiler/methods.typ +++ b/tests/typ/compiler/methods.typ @@ -97,39 +97,40 @@ --- // Test color kind method. -#test(rgb(1, 2, 3, 4).kind(), rgb) -#test(cmyk(4%, 5%, 6%, 7%).kind(), cmyk) -#test(luma(40).kind(), luma) -#test(rgb(1, 2, 3, 4).kind() != luma, true) +#test(rgb(1, 2, 3, 4).space(), rgb) +#test(cmyk(4%, 5%, 6%, 7%).space(), cmyk) +#test(luma(40).space(), luma) +#test(rgb(1, 2, 3, 4).space() != luma, true) --- -// Test color '.rgba()', '.cmyk()' and '.luma()' without conversions -#test(rgb(1, 2, 3, 4).to-rgba(), (1, 2, 3, 4)) -#test(rgb(1, 2, 3).to-rgba(), (1, 2, 3, 255)) -#test(cmyk(20%, 20%, 40%, 20%).to-cmyk(), (20%, 20%, 40%, 20%)) -#test(luma(40).to-luma(), 40) +// Test color '.components()' without conversions +#test-repr(rgb(1, 2, 3, 4).components(), (0.39%, 0.78%, 1.18%, 1.57%)) +#test-repr(luma(40).components(), (15.69%, )) +#test-repr(cmyk(4%, 5%, 6%, 7%).components(), (4%, 5%, 6%, 7%)) +#test-repr(oklab(10%, 0.2, 0.3).components(), (10%, 0.2, 0.3, 100%)) +#test-repr(color.linear-rgb(10%, 20%, 30%).components(), (10%, 20%, 30%, 100%)) +#test-repr(color.hsv(10deg, 20%, 30%).components(), (10deg, 20%, 30%, 100%)) +#test-repr(color.hsl(10deg, 20%, 30%).components(), (10deg, 20%, 30%, 100%)) --- // Test color conversions. #test(rgb(1, 2, 3).to-hex(), "#010203") #test(rgb(1, 2, 3, 4).to-hex(), "#01020304") -#test(cmyk(4%, 5%, 6%, 7%).to-rgba(), (228, 225, 223, 255)) -#test(cmyk(4%, 5%, 6%, 7%).to-hex(), "#e4e1df") -#test(luma(40).to-rgba(), (40, 40, 40, 255)) #test(luma(40).to-hex(), "#282828") -#test(repr(luma(40).to-cmyk()), repr((11.76%, 10.59%, 10.59%, 14.12%))) - ---- -// Error: 2-27 cannot obtain cmyk values from rgba color -#rgb(1, 2, 3, 4).to-cmyk() - ---- -// Error: 2-27 cannot obtain the luma value of rgba color -#rgb(1, 2, 3, 4).to-luma() - ---- -// Error: 2-32 cannot obtain the luma value of cmyk color -#cmyk(4%, 5%, 6%, 7%).to-luma() +#test-repr(cmyk(4%, 5%, 6%, 7%).to-hex(), "#e4e1df") +#test-repr(rgb(cmyk(4%, 5%, 6%, 7%)).components(), (89.28%, 88.35%, 87.42%, 100%)) +#test-repr(rgb(luma(40%)).components(false), (40%, 40%, 40%)) +#test-repr(cmyk(luma(40)).components(), (11.76%, 10.67%, 10.51%, 14.12%)) +#test-repr(cmyk(rgb(1, 2, 3)), cmyk(66.67%, 33.33%, 0%, 98.82%)) +#test-repr(luma(rgb(1, 2, 3)), luma(0.73%)) +#test-repr(color.hsl(luma(40)), color.hsl(0deg, 0%, 15.69%)) +#test-repr(color.hsv(luma(40)), color.hsv(0deg, 0%, 15.69%)) +#test-repr(color.linear-rgb(luma(40)), color.linear-rgb(2.12%, 2.12%, 2.12%)) +#test-repr(color.linear-rgb(rgb(1, 2, 3)), color.linear-rgb(0.03%, 0.06%, 0.09%)) +#test-repr(color.hsl(rgb(1, 2, 3)), color.hsl(-150deg, 50%, 0.78%)) +#test-repr(color.hsv(rgb(1, 2, 3)), color.hsv(-150deg, 66.67%, 1.18%)) +#test-repr(oklab(luma(40)).components(), (27.68%, 0.0, 0.0, 100%)) +#test-repr(oklab(rgb(1, 2, 3)).components(), (8.23%, -0.004, -0.007, 100%)) --- // Test alignment methods. |
