< prev index next >

modules/javafx.graphics/src/test/java/test/javafx/css/PaintTypeTest.java

Print this page
rev 10372 : 8176404: Remove public test-only convenience method from CssParser
Reviewed-by:

*** 33,42 **** --- 33,43 ---- import javafx.scene.paint.RadialGradient; import javafx.scene.paint.Stop; import javafx.scene.text.Font; import com.sun.javafx.css.ParsedValueImpl; import javafx.css.CssParser; + import javafx.css.CssParserShim; import javafx.css.ParsedValue; import javafx.css.Size; import javafx.css.SizeUnits; import javafx.css.Stylesheet; import javafx.css.converter.PaintConverter;
*** 194,219 **** // [ focus-distance <percentage>, ]? // [ center <point>, ]? // radius <length>, // [ [ repeat | reflect ] ,]? // <color-stop>[, <color-stop>]+ ) ! ParsedValue value = new CssParser().parseExpr("-fx-background-color", "radial-gradient(focus-angle 90deg, focus-distance 50%, radius 50, red, green, blue)"); RadialGradient result = (RadialGradient)((Paint[])value.convert(null))[0]; RadialGradient expected = new RadialGradient(90, .5, 0, 0, 50, false, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0,Color.BLUE)); assertEquals(expected,result); ! value = new CssParser().parseExpr("-fx-background-color", "radial-gradient(focus-angle 1.5708rad, focus-distance 50%, radius 50, red, green, blue)"); result = (RadialGradient)((Paint[])value.convert(null))[0]; assertEquals(expected,result); ! value = new CssParser().parseExpr("-fx-background-color", "radial-gradient(center 0% 10%, radius 50%, reflect, red, green, blue)"); result = (RadialGradient)((Paint[])value.convert(null))[0]; expected = new RadialGradient(0, 0, 0, .1, .5, true, CycleMethod.REFLECT, new Stop(0, Color.RED), --- 195,220 ---- // [ focus-distance <percentage>, ]? // [ center <point>, ]? // radius <length>, // [ [ repeat | reflect ] ,]? // <color-stop>[, <color-stop>]+ ) ! ParsedValue value = new CssParserShim().parseExpr("-fx-background-color", "radial-gradient(focus-angle 90deg, focus-distance 50%, radius 50, red, green, blue)"); RadialGradient result = (RadialGradient)((Paint[])value.convert(null))[0]; RadialGradient expected = new RadialGradient(90, .5, 0, 0, 50, false, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0,Color.BLUE)); assertEquals(expected,result); ! value = new CssParserShim().parseExpr("-fx-background-color", "radial-gradient(focus-angle 1.5708rad, focus-distance 50%, radius 50, red, green, blue)"); result = (RadialGradient)((Paint[])value.convert(null))[0]; assertEquals(expected,result); ! value = new CssParserShim().parseExpr("-fx-background-color", "radial-gradient(center 0% 10%, radius 50%, reflect, red, green, blue)"); result = (RadialGradient)((Paint[])value.convert(null))[0]; expected = new RadialGradient(0, 0, 0, .1, .5, true, CycleMethod.REFLECT, new Stop(0, Color.RED),
*** 228,318 **** // <linear-gradient> = linear-gradient( // [ [from <point> to <point>] | [ to <side-or-corner> ] ] ,]? [ [ repeat | reflect ] ,]? // <color-stop>[, <color-stop>]+ // ) // ! ParsedValue value = new CssParser().parseExpr("-fx-background-color", "linear-gradient(to top, red, green, blue)"); LinearGradient result = (LinearGradient)((Paint[])value.convert(null))[0]; LinearGradient expected = new LinearGradient(0, 1, 0, 0, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParser().parseExpr("-fx-background-color", "linear-gradient(to bottom, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParser().parseExpr("-fx-background-color", "linear-gradient(to left, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(1, 0, 0, 0, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParser().parseExpr("-fx-background-color", "linear-gradient(to right, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParser().parseExpr("-fx-background-color", "linear-gradient(to bottom left, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(1, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParser().parseExpr("-fx-background-color", "linear-gradient(to bottom right, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(0, 0, 1, 1, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParser().parseExpr("-fx-background-color", "linear-gradient(to top left, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(1, 1, 0, 0, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParser().parseExpr("-fx-background-color", "linear-gradient(to top right, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(0, 1, 1, 0, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParser().parseExpr("-fx-background-color", "linear-gradient(from 10% 10% to 90% 90%, reflect, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(.1, .1, .9, .9, true, CycleMethod.REFLECT, new Stop(0, Color.RED), --- 229,319 ---- // <linear-gradient> = linear-gradient( // [ [from <point> to <point>] | [ to <side-or-corner> ] ] ,]? [ [ repeat | reflect ] ,]? // <color-stop>[, <color-stop>]+ // ) // ! ParsedValue value = new CssParserShim().parseExpr("-fx-background-color", "linear-gradient(to top, red, green, blue)"); LinearGradient result = (LinearGradient)((Paint[])value.convert(null))[0]; LinearGradient expected = new LinearGradient(0, 1, 0, 0, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParserShim().parseExpr("-fx-background-color", "linear-gradient(to bottom, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParserShim().parseExpr("-fx-background-color", "linear-gradient(to left, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(1, 0, 0, 0, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParserShim().parseExpr("-fx-background-color", "linear-gradient(to right, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParserShim().parseExpr("-fx-background-color", "linear-gradient(to bottom left, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(1, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParserShim().parseExpr("-fx-background-color", "linear-gradient(to bottom right, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(0, 0, 1, 1, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParserShim().parseExpr("-fx-background-color", "linear-gradient(to top left, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(1, 1, 0, 0, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParserShim().parseExpr("-fx-background-color", "linear-gradient(to top right, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(0, 1, 1, 0, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(.5, Color.GREEN), new Stop(1.0, Color.BLUE)); assertEquals(expected,result); ! value = new CssParserShim().parseExpr("-fx-background-color", "linear-gradient(from 10% 10% to 90% 90%, reflect, red, green, blue)"); result = (LinearGradient)((Paint[])value.convert(null))[0]; expected = new LinearGradient(.1, .1, .9, .9, true, CycleMethod.REFLECT, new Stop(0, Color.RED),
< prev index next >