Skip to content

Commit 371cf70

Browse files
committed
more tests and some fixes
1 parent bbedd8e commit 371cf70

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -893,10 +893,10 @@ public void hexColor() throws Exception {
893893
*/
894894
@Test
895895
public void rgbComma() throws Exception {
896-
// color("foreground: rgb(255, 0, 153)", "foreground: rgb(255,0,153)");
897-
// color("foreground: rgb(255, 0, 153)", "foreground: rgb(255, 0, 153.0)");
898-
// color("foreground: rgb(100%, 0%, 60%)", "foreground: rgb(100%,0%,60%)");
899-
// color("foreground: rgb(100%, 0%, 60%)", "foreground: rgb(100%, 0%, 60%)");
896+
color("foreground: rgb(255, 0, 153)", "foreground: rgb(255,0,153)");
897+
color("foreground: rgb(255, 0, 153)", "foreground: rgb(255, 0, 153.0)");
898+
color("foreground: rgb(100%, 0%, 60%)", "foreground: rgb(100%,0%,60%)");
899+
color("foreground: rgb(100%, 0%, 60%)", "foreground: rgb(100%, 0%, 60%)");
900900

901901
color("foreground: rgb(none 0% 60%)", "foreground: rgb(none 0% 60%)");
902902
color("foreground: rgb(100% none 60%)", "foreground: rgb(100% none 60%)");
@@ -1045,6 +1045,15 @@ public void rgbVariousErrors() throws Exception {
10451045
color(1, "DOM exception: 'rgb has to use blank as separator if none is used.'", "foreground: rgb(10, 20, none)");
10461046
color(1, "DOM exception: 'rgb has to use blank as separator if none is used.'", "foreground: rgb(10, 20, 30, none)");
10471047

1048+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", <PERCENTAGE>.)",
1049+
"foreground: rgb(-none 20 30)");
1050+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", \",\", <PERCENTAGE>.)",
1051+
"foreground: rgb(10 -none 30)");
1052+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \"-\", \"+\", \",\", <PERCENTAGE>.)",
1053+
"foreground: rgb(10 20 -none)");
1054+
color(1, "Error in expression. (Invalid token \"-none\". Was expecting one of: <S>, <NUMBER>, \"none\", \")\", \"/\", \"-\", \"+\", \",\", <PERCENTAGE>.)",
1055+
"foreground: rgb(10 20 30 -none)");
1056+
10481057
// mixing numbers and percentages is supported by current browsers
10491058
// color(1, "DOM exception: 'rgb mixing numbers and percentages.'", "foreground: rgb(10%, 20, 30)");
10501059
// color(1, "DOM exception: 'rgb mixing numbers and percentages.'", "foreground: rgb(10%, 20%, 30)");
@@ -1947,15 +1956,15 @@ public void malformedDeclaration() throws Exception {
19471956
assertEquals(7, errorHandler.getErrorCount());
19481957
final String expected = "Error in declaration. (Invalid token \"}\". Was expecting one of: <S>, \":\".)"
19491958
+ " Error in declaration. (Invalid token \";\". Was expecting one of: <S>, \":\".)"
1950-
+ " Error in expression. (Invalid token \"}\". Was expecting one of: <S>, <NUMBER>, \"inherit\", \"none\", "
1959+
+ " Error in expression. (Invalid token \"}\". Was expecting one of: <S>, \"only\", <NUMBER>, \"inherit\", \"none\", "
19511960
+ "<IDENT>, <STRING>, \"-\", \"+\", <HASH>, <EMS>, <REM>, <EXS>, <CH>, "
19521961
+ "<VW>, <VH>, <VMIN>, <VMAX>, "
19531962
+ "<LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <LENGTH_Q>, "
19541963
+ "<ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>, "
19551964
+ "<TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <RESOLUTION_DPI>, <RESOLUTION_DPCM>, <PERCENTAGE>, "
19561965
+ "<DIMENSION>, <UNICODE_RANGE>, <URI>, <FUNCTION_CALC>, <FUNCTION_VAR>, "
19571966
+ "<FUNCTION_RGB>, <FUNCTION_HSL>, <FUNCTION>, \"progid:\".)"
1958-
+ " Error in expression. (Invalid token \";\". Was expecting one of: <S>, <NUMBER>, \"inherit\", \"none\", "
1967+
+ " Error in expression. (Invalid token \";\". Was expecting one of: <S>, \"only\", <NUMBER>, \"inherit\", \"none\", "
19591968
+ "<IDENT>, <STRING>, \"-\", \"+\", <HASH>, <EMS>, <REM>, <EXS>, <CH>, "
19601969
+ "<VW>, <VH>, <VMIN>, <VMAX>, "
19611970
+ "<LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <LENGTH_Q>, "
@@ -2253,7 +2262,7 @@ public void unexpectedEndOfString() throws Exception {
22532262

22542263
assertEquals(1, errorHandler.getErrorCount());
22552264
final String expected = "Error in expression. "
2256-
+ "(Invalid token \"\\'\". Was expecting one of: <S>, <NUMBER>, \"inherit\", \"none\", "
2265+
+ "(Invalid token \"\\'\". Was expecting one of: <S>, \"only\", <NUMBER>, \"inherit\", \"none\", "
22572266
+ "<IDENT>, <STRING>, \"-\", \"+\", <HASH>, <EMS>, <REM>, <EXS>, <CH>, "
22582267
+ "<VW>, <VH>, <VMIN>, <VMAX>, "
22592268
+ "<LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <LENGTH_Q>, "

0 commit comments

Comments
 (0)