Skip to content

Commit 036798a

Browse files
committed
releative (wip)
1 parent aabb2de commit 036798a

File tree

8 files changed

+483
-333
lines changed

8 files changed

+483
-333
lines changed

src/test/java/org/htmlunit/cssparser/parser/CSS3ParserRealWorldTest.java

Lines changed: 397 additions & 0 deletions
Large diffs are not rendered by default.

src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java

Lines changed: 20 additions & 332 deletions
Large diffs are not rendered by default.

src/test/java/org/htmlunit/cssparser/parser/HSLColorParserTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void hslRelative() throws Exception {
9999
color("foreground: hsl(from rgb(200 170 0) 7 11% 13%)", "foreground: hsl(from rgb(200 170 0) 7 11% 13%)");
100100
color("foreground: hsl(from var(--base-color) 7 11% 13%)", "foreground: hsl(from var(--base-color) 7 11% 13%)");
101101

102-
color("foreground: red calc(h + 7) calc(s - 11%) calc(l * 13%)", "foreground: red calc(h + 7) calc(s - 11%) calc(l * 13%)");
102+
color("foreground: hsl(from red calc(h + 7) calc(s - 11%) calc(l * 13%))", "foreground: hsl(from red calc(h + 7) calc(s - 11%) calc(l * 13%))");
103103
}
104104

105105
/**

src/test/java/org/htmlunit/cssparser/parser/HWBColorParserTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ public void hwbBlank() throws Exception {
5252
color("foreground: hwb(-270 60% 70% / none)", "foreground: hwb(-270 60% 70% / none)");
5353
}
5454

55+
/**
56+
* @throws Exception in case of failure
57+
*/
58+
@Test
59+
public void hwbRelative() throws Exception {
60+
color("foreground: hwb(from red h w b)", "foreground: hwb(from red h w b)");
61+
color("foreground: hwb(from red 7 11% 13%)", "foreground: hwb(from red 7 11% 13%)");
62+
color("foreground: hwb(from rgb(200 170 0) 7 11% 13%)", "foreground: hwb(from rgb(200 170 0) 7 11% 13%)");
63+
color("foreground: hwb(from var(--base-color) 7 11% 13%)", "foreground: hwb(from var(--base-color) 7 11% 13%)");
64+
65+
color("foreground: hwb(from red calc(h + 7) calc(w - 11%) calc(b * 13%))", "foreground: hwb(from red calc(h + 7) calc(w - 11%) calc(b * 13%))");
66+
}
67+
5568
/**
5669
* @throws Exception in case of failure
5770
*/

src/test/java/org/htmlunit/cssparser/parser/LABColorParserTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ public void labMixed() throws Exception {
6464
color("foreground: lab(42% 128% 255%)", "foreground: lab(42% 128% 255%)");
6565
}
6666

67+
/**
68+
* @throws Exception in case of failure
69+
*/
70+
@Test
71+
public void labRelative() throws Exception {
72+
color("foreground: lab(from red l a b)", "foreground: lab(from red l a b)");
73+
color("foreground: lab(from red 7 11% 13%)", "foreground: lab(from red 7 11% 13%)");
74+
color("foreground: lab(from rgb(200 170 0) 7 11% 13%)", "foreground: lab(from rgb(200 170 0) 7 11% 13%)");
75+
color("foreground: lab(from var(--base-color) 7 11% 13%)", "foreground: lab(from var(--base-color) 7 11% 13%)");
76+
77+
color("foreground: lab(from red calc(h + 7) calc(w - 11%) calc(b * 13%))", "foreground: lab(from red calc(h + 7) calc(w - 11%) calc(b * 13%))");
78+
}
79+
6780
/**
6881
* @throws Exception in case of failure
6982
*/

src/test/java/org/htmlunit/cssparser/parser/LCHColorParserTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ public void lchMixed() throws Exception {
6464
color("foreground: lch(42% 128% 255rad)", "foreground: lch(42% 128% 255rad)");
6565
}
6666

67+
/**
68+
* @throws Exception in case of failure
69+
*/
70+
@Test
71+
public void lchRelative() throws Exception {
72+
color("foreground: lch(from red l c h)", "foreground: lch(from red l c h)");
73+
color("foreground: lch(from red 7 11% 13deg)", "foreground: lch(from red 7 11% 13deg)");
74+
color("foreground: lch(from rgb(200 170 0) 7 11% 13deg)", "foreground: lch(from rgb(200 170 0) 7 11% 13deg)");
75+
color("foreground: lch(from var(--base-color) 7 11% 13deg)", "foreground: lch(from var(--base-color) 7 11% 13deg)");
76+
77+
color("foreground: lch(from red calc(h + 7) calc(w - 11%) calc(b * 13deg))", "foreground: lch(from red calc(h + 7) calc(w - 11%) calc(b * 13deg))");
78+
}
79+
6780
/**
6881
* @throws Exception in case of failure
6982
*/

src/test/java/org/htmlunit/cssparser/parser/OKLABColorParserTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ public void oklabMixed() throws Exception {
6464
color("foreground: oklab(42% 128% 255%)", "foreground: oklab(42% 128% 255%)");
6565
}
6666

67+
/**
68+
* @throws Exception in case of failure
69+
*/
70+
@Test
71+
public void labRelative() throws Exception {
72+
color("foreground: oklab(from red l a b)", "foreground: oklab(from red l a b)");
73+
color("foreground: oklab(from red 7 11% 13%)", "foreground: oklab(from red 7 11% 13%)");
74+
color("foreground: oklab(from rgb(200 170 0) 7 11% 13%)", "foreground: oklab(from rgb(200 170 0) 7 11% 13%)");
75+
color("foreground: oklab(from var(--base-color) 7 11% 13%)", "foreground: oklab(from var(--base-color) 7 11% 13%)");
76+
77+
color("foreground: oklab(from red calc(h + 7) calc(w - 11%) calc(b * 13%))", "foreground: oklab(from red calc(h + 7) calc(w - 11%) calc(b * 13%))");
78+
}
79+
6780
/**
6881
* @throws Exception in case of failure
6982
*/

src/test/java/org/htmlunit/cssparser/parser/OKLCHColorParserTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ public void oklchMixed() throws Exception {
6464
color("foreground: oklch(42% 128% 255rad)", "foreground: oklch(42% 128% 255rad)");
6565
}
6666

67+
/**
68+
* @throws Exception in case of failure
69+
*/
70+
@Test
71+
public void lchRelative() throws Exception {
72+
color("foreground: oklch(from red l c h)", "foreground: oklch(from red l c h)");
73+
color("foreground: oklch(from red 7 11% 13deg)", "foreground: oklch(from red 7 11% 13deg)");
74+
color("foreground: oklch(from rgb(200 170 0) 7 11% 13deg)", "foreground: oklch(from rgb(200 170 0) 7 11% 13deg)");
75+
color("foreground: oklch(from var(--base-color) 7 11% 13deg)", "foreground: oklch(from var(--base-color) 7 11% 13deg)");
76+
77+
color("foreground: oklch(from red calc(h + 7) calc(w - 11%) calc(b * 13deg))", "foreground: oklch(from red calc(h + 7) calc(w - 11%) calc(b * 13deg))");
78+
}
79+
6780
/**
6881
* @throws Exception in case of failure
6982
*/

0 commit comments

Comments
 (0)