Skip to content

Commit 44aff36

Browse files
committed
more tests
1 parent 053ca01 commit 44aff36

File tree

7 files changed

+196
-215
lines changed

7 files changed

+196
-215
lines changed

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ public void hslaMixed() throws Exception {
177177
public void hslVariousErrors() throws Exception {
178178
// like browsers we ignore many errors during parsing
179179

180-
// separators
181180
color("foreground: hsl(10, 20% 30%)", "foreground: hsl(10, 20% 30%)");
182181
color("foreground: hsl(10 20%, 30%)", "foreground: hsl(10 20%, 30%)");
183182

@@ -197,21 +196,6 @@ public void hslVariousErrors() throws Exception {
197196
"foreground: hsl(10 20% -none)");
198197
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
199198
"foreground: hsl(10 20% 30% / -none)");
200-
//
201-
// // mixing numbers and percentages is supported by current browsers
202-
// color("DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10rad, 20, 30)");
203-
// color("DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10rad, 20%, 30)");
204-
// color("DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10, 20%, 30)");
205-
// color("DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10, 20%, 30%)");
206-
// color("DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10, 20, 30%)");
207-
// color("DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10rad, 20, 30%)");
208-
//
209-
// color("DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10rad 20 30)");
210-
// color("DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10rad 20% 30)");
211-
// color("DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10 20% 30)");
212-
// color("DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10 20% 30%)");
213-
// color("DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10 20 30%)");
214-
// color("DOM exception: 'hsl mixing numbers and percentages.'", "foreground: hsl(10rad 20 30%)");
215199

216200
color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"from\", \"-\", \"+\", <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)",
217201
"foreground: hsl()");

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

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -70,35 +70,37 @@ public void hwbRelative() throws Exception {
7070
*/
7171
@Test
7272
public void hwbVariousErrors() throws Exception {
73-
// color(1, "Error in expression. (Invalid token \",\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
74-
// "foreground: hwb(10, 20% 30%)");
75-
// color(1, "Error in expression. (Invalid token \",\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)", "foreground: hwb(10 20%, 30%)");
76-
//
77-
// color(1, "DOM exception: ''hwb' alpha value must be separated by '/'.'", "foreground: hwb(10 20% 30% 40)");
78-
//
79-
// color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)",
80-
// "foreground: hwb(-none 20% 30%)");
81-
// color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
82-
// "foreground: hwb(10 -none 30%)");
83-
// color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
84-
// "foreground: hwb(10 20% -none)");
85-
// color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
86-
// "foreground: hwb(10 20% 30% / -none)");
87-
//
88-
// color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)",
89-
// "foreground: hwb()");
90-
// color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
91-
// "foreground: hwb(10)");
92-
// color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
93-
// "foreground: hwb(10 20%)");
94-
//
95-
// color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
96-
// "foreground: hwb(10 20% 30%/)");
97-
//
98-
// color(1, "Error in expression. (Invalid token \"20\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
99-
// "foreground: hwb(10 20px 30)");
100-
//
101-
// color(1, "Error in expression. (Invalid token \"10\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)",
102-
// "foreground: hwb('10' 20 30)");
73+
// like browsers we ignore many errors during parsing
74+
75+
color(1, "Error in expression. (Invalid token \",\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
76+
"foreground: hwb(10, 20% 30%)");
77+
color(1, "Error in expression. (Invalid token \",\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)", "foreground: hwb(10 20%, 30%)");
78+
79+
color("foreground: hwb(10 20% 30% 40)", "foreground: hwb(10 20% 30% 40)");
80+
81+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"from\", \"-\", \"+\", <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)",
82+
"foreground: hwb(-none 20% 30%)");
83+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
84+
"foreground: hwb(10 -none 30%)");
85+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
86+
"foreground: hwb(10 20% -none)");
87+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
88+
"foreground: hwb(10 20% 30% / -none)");
89+
90+
color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"from\", \"-\", \"+\", <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)",
91+
"foreground: hwb()");
92+
color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
93+
"foreground: hwb(10)");
94+
color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
95+
"foreground: hwb(10 20%)");
96+
97+
color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
98+
"foreground: hwb(10 20% 30%/)");
99+
100+
color(1, "Error in expression. (Invalid token \"20\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
101+
"foreground: hwb(10 20px 30)");
102+
103+
color(1, "Error in expression. (Invalid token \"10\". Was expecting one of: <S>, <NUMBER>, \"none\", \"from\", \"-\", \"+\", <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)",
104+
"foreground: hwb('10' 20 30)");
103105
}
104106
}

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

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -82,34 +82,36 @@ public void labRelative() throws Exception {
8282
*/
8383
@Test
8484
public void labVariousErrors() throws Exception {
85-
// color(1, "Error in expression. (Invalid token \",\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
86-
// "foreground: lab(10, 20 30)");
87-
//
88-
// color(1, "DOM exception: ''lab' alpha value must be separated by '/'.'", "foreground: lab(10 20 30 40)");
89-
//
90-
// color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
91-
// "foreground: lab(-none 20 30)");
92-
// color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
93-
// "foreground: lab(10 -none 30)");
94-
// color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
95-
// "foreground: lab(10 20 -none)");
96-
// color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
97-
// "foreground: lab(10 20 30 / -none)");
98-
//
99-
// color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
100-
// "foreground: lab()");
101-
// color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
102-
// "foreground: lab(10)");
103-
// color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
104-
// "foreground: lab(10 20)");
105-
//
106-
// color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
107-
// "foreground: lab(10 20 30/)");
108-
//
109-
// color(1, "Error in expression. (Invalid token \"20\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
110-
// "foreground: lab(10 20px 30)");
111-
//
112-
// color(1, "Error in expression. (Invalid token \"10\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
113-
// "foreground: lab('10' 20 30)");
85+
// like browsers we ignore many errors during parsing
86+
87+
color(1, "Error in expression. (Invalid token \",\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
88+
"foreground: lab(10, 20 30)");
89+
90+
color("foreground: lab(10 20 30 40)", "foreground: lab(10 20 30 40)");
91+
92+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"from\", \"-\", \"+\", <PERCENTAGE>.)",
93+
"foreground: lab(-none 20 30)");
94+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
95+
"foreground: lab(10 -none 30)");
96+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
97+
"foreground: lab(10 20 -none)");
98+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
99+
"foreground: lab(10 20 30 / -none)");
100+
101+
color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"from\", \"-\", \"+\", <PERCENTAGE>.)",
102+
"foreground: lab()");
103+
color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
104+
"foreground: lab(10)");
105+
color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
106+
"foreground: lab(10 20)");
107+
108+
color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
109+
"foreground: lab(10 20 30/)");
110+
111+
color(1, "Error in expression. (Invalid token \"20\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
112+
"foreground: lab(10 20px 30)");
113+
114+
color(1, "Error in expression. (Invalid token \"10\". Was expecting one of: <S>, <NUMBER>, \"none\", \"from\", \"-\", \"+\", <PERCENTAGE>.)",
115+
"foreground: lab('10' 20 30)");
114116
}
115117
}

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

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -82,34 +82,36 @@ public void lchRelative() throws Exception {
8282
*/
8383
@Test
8484
public void lchVariousErrors() throws Exception {
85-
// color(1, "Error in expression. (Invalid token \",\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
86-
// "foreground: lch(10, 20 30deg)");
87-
//
88-
// color(1, "DOM exception: ''lch' alpha value must be separated by '/'.'", "foreground: lch(10 20 30deg 40)");
89-
//
90-
// color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
91-
// "foreground: lch(-none 20 30deg)");
92-
// color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
93-
// "foreground: lch(10 -none 30deg)");
94-
// color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)",
95-
// "foreground: lch(10 20 -none)");
96-
// color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
97-
// "foreground: lch(10 20 30deg / -none)");
98-
//
99-
// color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
100-
// "foreground: lch()");
101-
// color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
102-
// "foreground: lch(10)");
103-
// color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)",
104-
// "foreground: lch(10 20)");
105-
//
106-
// color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
107-
// "foreground: lch(10 20 30deg/)");
108-
//
109-
// color(1, "Error in expression. (Invalid token \"20\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
110-
// "foreground: lch(10 20px 30deg)");
111-
//
112-
// color(1, "Error in expression. (Invalid token \"10\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
113-
// "foreground: lch('10' 20 30deg)");
85+
// like browsers we ignore many errors during parsing
86+
87+
color(1, "Error in expression. (Invalid token \",\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
88+
"foreground: lch(10, 20 30deg)");
89+
90+
color("foreground: lch(10 20 30deg 40)", "foreground: lch(10 20 30deg 40)");
91+
92+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"from\", \"-\", \"+\", <PERCENTAGE>.)",
93+
"foreground: lch(-none 20 30deg)");
94+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
95+
"foreground: lch(10 -none 30deg)");
96+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)",
97+
"foreground: lch(10 20 -none)");
98+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
99+
"foreground: lch(10 20 30deg / -none)");
100+
101+
color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"from\", \"-\", \"+\", <PERCENTAGE>.)",
102+
"foreground: lch()");
103+
color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
104+
"foreground: lch(10)");
105+
color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, \"none\", \"-\", \"+\", <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>.)",
106+
"foreground: lch(10 20)");
107+
108+
color(1, "Error in expression. (Invalid token \")\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
109+
"foreground: lch(10 20 30deg/)");
110+
111+
color(1, "Error in expression. (Invalid token \"20\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
112+
"foreground: lch(10 20px 30deg)");
113+
114+
color(1, "Error in expression. (Invalid token \"10\". Was expecting one of: <S>, <NUMBER>, \"none\", \"from\", \"-\", \"+\", <PERCENTAGE>.)",
115+
"foreground: lch('10' 20 30deg)");
114116
}
115117
}

0 commit comments

Comments
 (0)