< prev index next >
modules/javafx.graphics/src/test/java/test/javafx/css/CssParserTest.java
Print this page
rev 10372 : 8176404: Remove public test-only convenience method from CssParser
Reviewed-by:
*** 34,43 ****
--- 34,44 ----
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import javafx.css.CssParser;
+ import javafx.css.CssParserShim;
import javafx.css.Declaration;
import javafx.css.FontFace;
import javafx.css.ParsedValue;
import javafx.css.ParsedValue;
*** 60,70 ****
public void testRT_16959() {
CssParser instance = new CssParser();
// RT-16959 is an infinite loop on incomplete linear gradient
! ParsedValue result = instance.parseExpr("-fx-background-color", "linear-gradient(from 0% 0% to 0% 100%, )");
assertNull("parseExpr", result);
// The bad syntax should be skipped. The stylesheet should have one
// linear gradient with colors red, white, blue.
Stylesheet ss = instance.parse(
--- 61,72 ----
public void testRT_16959() {
CssParser instance = new CssParser();
// RT-16959 is an infinite loop on incomplete linear gradient
! ParsedValue result = new CssParserShim(instance)
! .parseExpr("-fx-background-color", "linear-gradient(from 0% 0% to 0% 100%, )");
assertNull("parseExpr", result);
// The bad syntax should be skipped. The stylesheet should have one
// linear gradient with colors red, white, blue.
Stylesheet ss = instance.parse(
*** 144,154 ****
public void testParseSizeWithInvalidDigits() {
CssParser instance = new CssParser();
// RT-16959 is an infinite loop on incomplete linear gradient
! ParsedValue result = instance.parseExpr("-fx-font-size", "10ptx");
assertNull("parseExpr", result);
// The bad syntax should be skipped.
Stylesheet ss = instance.parse(
"* {"
--- 146,156 ----
public void testParseSizeWithInvalidDigits() {
CssParser instance = new CssParser();
// RT-16959 is an infinite loop on incomplete linear gradient
! ParsedValue result = new CssParserShim(instance).parseExpr("-fx-font-size", "10ptx");
assertNull("parseExpr", result);
// The bad syntax should be skipped.
Stylesheet ss = instance.parse(
"* {"
*** 288,316 ****
return nFontFaceSrcs;
}
@Test public void testRT_32522() {
! ParsedValue value = new CssParser().parseExpr("foo", "1 2em 3 4;");
Object obj = value.convert(Font.font(13));
assert obj instanceof Number[];
assertArrayEquals(new Number[] {1d, 26d, 3d, 4d}, (Number[])obj);
! value = new CssParser().parseExpr("foo", "1;");
obj = value.convert(null);
assert obj instanceof Number;
assertEquals(1d, (Number)obj);
}
@Test public void testRT_38483() {
Duration expected = Duration.millis(42);
! ParsedValue value = new CssParser().parseExpr("foo", "42ms;");
Object observed = value.convert(null);
assertEquals(expected, observed);
! value = new CssParser().parseExpr("foo", "indefinite;");
observed = value.convert(null);
assertEquals(Duration.INDEFINITE, observed);
}
}
--- 290,318 ----
return nFontFaceSrcs;
}
@Test public void testRT_32522() {
! ParsedValue value = new CssParserShim().parseExpr("foo", "1 2em 3 4;");
Object obj = value.convert(Font.font(13));
assert obj instanceof Number[];
assertArrayEquals(new Number[] {1d, 26d, 3d, 4d}, (Number[])obj);
! value = new CssParserShim().parseExpr("foo", "1;");
obj = value.convert(null);
assert obj instanceof Number;
assertEquals(1d, (Number)obj);
}
@Test public void testRT_38483() {
Duration expected = Duration.millis(42);
! ParsedValue value = new CssParserShim().parseExpr("foo", "42ms;");
Object observed = value.convert(null);
assertEquals(expected, observed);
! value = new CssParserShim().parseExpr("foo", "indefinite;");
observed = value.convert(null);
assertEquals(Duration.INDEFINITE, observed);
}
}
< prev index next >