modules/graphics/src/test/java/test/javafx/css/CssMetaDataTest.java
Print this page
rev 9250 : 8134762: Refactor Javafx graphics module tests for clear separation of tests
Reviewed-by:
*** 21,31 ****
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! package javafx.css;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
--- 21,31 ----
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! package test.javafx.css;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
*** 38,49 ****
import com.sun.javafx.css.CascadingStyle;
import com.sun.javafx.css.ParsedValueImpl;
import com.sun.javafx.css.PseudoClassState;
import com.sun.javafx.css.StyleManager;
! import com.sun.javafx.css.TestNode;
! import com.sun.javafx.css.TestNodeBase;
import com.sun.javafx.sg.prism.NGNode;
import javafx.beans.value.WritableValue;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Scene;
--- 38,49 ----
import com.sun.javafx.css.CascadingStyle;
import com.sun.javafx.css.ParsedValueImpl;
import com.sun.javafx.css.PseudoClassState;
import com.sun.javafx.css.StyleManager;
! import test.com.sun.javafx.css.TestNode;
! import test.com.sun.javafx.css.TestNodeBase;
import com.sun.javafx.sg.prism.NGNode;
import javafx.beans.value.WritableValue;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Scene;
*** 55,64 ****
--- 55,85 ----
import javafx.css.converter.BooleanConverter;
import com.sun.javafx.geom.BaseBounds;
import com.sun.javafx.geom.transform.BaseTransform;
import com.sun.javafx.jmx.MXNodeAlgorithm;
import com.sun.javafx.jmx.MXNodeAlgorithmContext;
+ import javafx.css.CompoundSelector;
+ import javafx.css.CssMetaData;
+ import javafx.css.CssParser;
+ import javafx.css.Declaration;
+ import javafx.css.DeclarationShim;
+ import javafx.css.FontCssMetaData;
+ import javafx.css.ParsedValue;
+ import javafx.css.PseudoClass;
+ import javafx.css.Rule;
+ import javafx.css.RuleShim;
+ import javafx.css.Selector;
+ import javafx.css.SelectorShim;
+ import javafx.css.SimpleSelector;
+ import javafx.css.SimpleSelectorShim;
+ import javafx.css.Style;
+ import javafx.css.StyleConverter;
+ import javafx.css.StyleOrigin;
+ import javafx.css.Styleable;
+ import javafx.css.StyleableProperty;
+ import javafx.css.Stylesheet;
+ import javafx.css.StylesheetShim;
import org.junit.Test;
import static org.junit.Assert.*;
*** 230,246 ****
static CascadingStyle createCascadingStyle(Selector selector, Declaration declaration) {
Set<PseudoClass> pseudoClasses = null;
if (selector instanceof SimpleSelector) {
! pseudoClasses = ((SimpleSelector)selector).getPseudoClassStates();
} else {
pseudoClasses = new PseudoClassState();
for (SimpleSelector sel : ((CompoundSelector)selector).getSelectors()) {
! Set<PseudoClass> selectorPseudoClasses = sel.getPseudoClassStates();
pseudoClasses.addAll(selectorPseudoClasses);
}
}
return new CascadingStyle(
--- 251,268 ----
static CascadingStyle createCascadingStyle(Selector selector, Declaration declaration) {
Set<PseudoClass> pseudoClasses = null;
if (selector instanceof SimpleSelector) {
! pseudoClasses =
! SimpleSelectorShim.getPseudoClassStates((SimpleSelector)selector);
} else {
pseudoClasses = new PseudoClassState();
for (SimpleSelector sel : ((CompoundSelector)selector).getSelectors()) {
! Set<PseudoClass> selectorPseudoClasses = SimpleSelectorShim.getPseudoClassStates(sel);
pseudoClasses.addAll(selectorPseudoClasses);
}
}
return new CascadingStyle(
*** 253,263 ****
@Test @org.junit.Ignore
public void testGetMatchingStyles() {
! final Stylesheet stylesheet = new Stylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
--- 275,285 ----
@Test @org.junit.Ignore
public void testGetMatchingStyles() {
! final Stylesheet stylesheet = StylesheetShim.getStylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
*** 265,327 ****
// .root { -fx-base: red; -fx-color: -fx-base; }
//
List<String> rootStyleClass = new ArrayList<String>();
rootStyleClass.add("root");
! Selector root = new SimpleSelector("*", rootStyleClass, null, null);
ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
! Declaration fxBase = new Declaration("-fx-base", fxBaseValue, false);
ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
! Declaration fxColor = new Declaration("-fx-color", fxColorValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxBase, fxColor);
! Rule baseRule = new Rule(selectors, declarations);
rules.add(baseRule);
//
// .rect { -fx-fill: -fx-color; }
//
List<String> rectStyleClass = new ArrayList<String>();
rectStyleClass.add("rect");
! Selector rect = new SimpleSelector("*", rectStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
! Declaration fxFill = new Declaration("-fx-fill", fxFillValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rect);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill);
! Rule rectRule = new Rule(selectors, declarations);
rules.add(rectRule);
// .rect:hover { -fx-fill: yellow; }
List<String> pseudoclasses = new ArrayList<String>();
pseudoclasses.add("hover");
! Selector rectHover = new SimpleSelector("*", rectStyleClass, pseudoclasses, null);
ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
! Declaration fxFillHover = new Declaration("-fx-fill", fxFillHoverValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rectHover);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFillHover);
! Rule rectHoverRule = new Rule(selectors, declarations);
rules.add(rectHoverRule);
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
new Style(root, fxBase),
--- 287,349 ----
// .root { -fx-base: red; -fx-color: -fx-base; }
//
List<String> rootStyleClass = new ArrayList<String>();
rootStyleClass.add("root");
! Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
! Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
! Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxBase, fxColor);
! Rule baseRule = RuleShim.getRule(selectors, declarations);
rules.add(baseRule);
//
// .rect { -fx-fill: -fx-color; }
//
List<String> rectStyleClass = new ArrayList<String>();
rectStyleClass.add("rect");
! Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
! Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rect);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill);
! Rule rectRule = RuleShim.getRule(selectors, declarations);
rules.add(rectRule);
// .rect:hover { -fx-fill: yellow; }
List<String> pseudoclasses = new ArrayList<String>();
pseudoclasses.add("hover");
! Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
! Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rectHover);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFillHover);
! Rule rectHoverRule = RuleShim.getRule(selectors, declarations);
rules.add(rectHoverRule);
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
new Style(root, fxBase),
*** 358,368 ****
@Test @org.junit.Ignore
public void testGetMatchingStylesWithInlineStyleOnParent() {
! final Stylesheet stylesheet = new Stylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
--- 380,390 ----
@Test @org.junit.Ignore
public void testGetMatchingStylesWithInlineStyleOnParent() {
! final Stylesheet stylesheet = StylesheetShim.getStylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
*** 370,450 ****
// .root { -fx-base: red; -fx-color: -fx-base; }
//
List<String> rootStyleClass = new ArrayList<String>();
rootStyleClass.add("root");
! Selector root = new SimpleSelector("*", rootStyleClass, null, null);
ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
! Declaration fxBase = new Declaration("-fx-base", fxBaseValue, false);
ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
! Declaration fxColor = new Declaration("-fx-color", fxColorValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxBase, fxColor);
! Rule baseRule = new Rule(selectors, declarations);
rules.add(baseRule);
//
// .rect { -fx-fill: -fx-color; }
//
List<String> rectStyleClass = new ArrayList<String>();
rectStyleClass.add("rect");
! Selector rect = new SimpleSelector("*", rectStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
! Declaration fxFill = new Declaration("-fx-fill", fxFillValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rect);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill);
! Rule rectRule = new Rule(selectors, declarations);
rules.add(rectRule);
// .rect:hover { -fx-fill: yellow; }
List<String> pseudoclasses = new ArrayList<String>();
pseudoclasses.add("hover");
! Selector rectHover = new SimpleSelector("*", rectStyleClass, pseudoclasses, null);
ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
! Declaration fxFillHover = new Declaration("-fx-fill", fxFillHoverValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rectHover);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFillHover);
! Rule rectHoverRule = new Rule(selectors, declarations);
rules.add(rectHoverRule);
// Declaration now checks origin, so we need to make this expected
// value look like it came from an inline
! final Declaration decl = new Declaration("-fx-base", new ParsedValueImpl<Color,Color>(Color.GREEN, null), false);
! Stylesheet ss = new Stylesheet() {
{
setOrigin(StyleOrigin.INLINE);
getRules().add(
! new Rule(Arrays.asList(SimpleSelector.getUniversalSelector()), Arrays.asList(decl))
);
}
};
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
! new Style(SimpleSelector.getUniversalSelector(), decl),
new Style(root, fxBase),
new Style(root, fxColor),
new Style(rect, fxFill),
new Style(rectHover, fxFillHover)
);
--- 392,472 ----
// .root { -fx-base: red; -fx-color: -fx-base; }
//
List<String> rootStyleClass = new ArrayList<String>();
rootStyleClass.add("root");
! Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
! Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
! Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxBase, fxColor);
! Rule baseRule = RuleShim.getRule(selectors, declarations);
rules.add(baseRule);
//
// .rect { -fx-fill: -fx-color; }
//
List<String> rectStyleClass = new ArrayList<String>();
rectStyleClass.add("rect");
! Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
! Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rect);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill);
! Rule rectRule = RuleShim.getRule(selectors, declarations);
rules.add(rectRule);
// .rect:hover { -fx-fill: yellow; }
List<String> pseudoclasses = new ArrayList<String>();
pseudoclasses.add("hover");
! Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
! Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rectHover);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFillHover);
! Rule rectHoverRule = RuleShim.getRule(selectors, declarations);
rules.add(rectHoverRule);
// Declaration now checks origin, so we need to make this expected
// value look like it came from an inline
! final Declaration decl = DeclarationShim.getDeclaration("-fx-base", new ParsedValueImpl<Color,Color>(Color.GREEN, null), false);
! Stylesheet ss = new StylesheetShim(null) {
{
setOrigin(StyleOrigin.INLINE);
getRules().add(
! RuleShim.getRule(Arrays.asList(SelectorShim.getUniversalSelector()), Arrays.asList(decl))
);
}
};
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
! new Style(SelectorShim.getUniversalSelector(), decl),
new Style(root, fxBase),
new Style(root, fxColor),
new Style(rect, fxFill),
new Style(rectHover, fxFillHover)
);
*** 481,491 ****
@Test @org.junit.Ignore
public void testGetMatchingStylesWithInlineStyleOnLeaf() {
! final Stylesheet stylesheet = new Stylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
--- 503,513 ----
@Test @org.junit.Ignore
public void testGetMatchingStylesWithInlineStyleOnLeaf() {
! final Stylesheet stylesheet = StylesheetShim.getStylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
*** 493,573 ****
// .root { -fx-base: red; -fx-color: -fx-base; }
//
List<String> rootStyleClass = new ArrayList<String>();
rootStyleClass.add("root");
! Selector root = new SimpleSelector("*", rootStyleClass, null, null);
ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
! Declaration fxBase = new Declaration("-fx-base", fxBaseValue, false);
ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
! Declaration fxColor = new Declaration("-fx-color", fxColorValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxBase, fxColor);
! Rule baseRule = new Rule(selectors, declarations);
rules.add(baseRule);
//
// .rect { -fx-fill: -fx-color; }
//
List<String> rectStyleClass = new ArrayList<String>();
rectStyleClass.add("rect");
! Selector rect = new SimpleSelector("*", rectStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
! Declaration fxFill = new Declaration("-fx-fill", fxFillValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rect);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill);
! Rule rectRule = new Rule(selectors, declarations);
rules.add(rectRule);
// .rect:hover { -fx-fill: yellow; }
List<String> pseudoclasses = new ArrayList<String>();
pseudoclasses.add("hover");
! Selector rectHover = new SimpleSelector("*", rectStyleClass, pseudoclasses, null);
ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
! Declaration fxFillHover = new Declaration("-fx-fill", fxFillHoverValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rectHover);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFillHover);
! Rule rectHoverRule = new Rule(selectors, declarations);
rules.add(rectHoverRule);
// Declaration now checks origin, so we need to make this expected
// value look like it came from an inline
! final Declaration decl = new Declaration("-fx-base", new ParsedValueImpl<Color,Color>(Color.GREEN, null), false);
! Stylesheet ss = new Stylesheet() {
{
setOrigin(StyleOrigin.INLINE);
getRules().add(
! new Rule(Arrays.asList(SimpleSelector.getUniversalSelector()), Arrays.asList(decl))
);
}
};
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
! new Style(SimpleSelector.getUniversalSelector(), decl),
new Style(root, fxBase),
new Style(root, fxColor),
new Style(rect, fxFill),
new Style(rectHover, fxFillHover)
);
--- 515,595 ----
// .root { -fx-base: red; -fx-color: -fx-base; }
//
List<String> rootStyleClass = new ArrayList<String>();
rootStyleClass.add("root");
! Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
! Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
! Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxBase, fxColor);
! Rule baseRule = RuleShim.getRule(selectors, declarations);
rules.add(baseRule);
//
// .rect { -fx-fill: -fx-color; }
//
List<String> rectStyleClass = new ArrayList<String>();
rectStyleClass.add("rect");
! Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
! Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rect);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill);
! Rule rectRule = RuleShim.getRule(selectors, declarations);
rules.add(rectRule);
// .rect:hover { -fx-fill: yellow; }
List<String> pseudoclasses = new ArrayList<String>();
pseudoclasses.add("hover");
! Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
! Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rectHover);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFillHover);
! Rule rectHoverRule = RuleShim.getRule(selectors, declarations);
rules.add(rectHoverRule);
// Declaration now checks origin, so we need to make this expected
// value look like it came from an inline
! final Declaration decl = DeclarationShim.getDeclaration("-fx-base", new ParsedValueImpl<Color,Color>(Color.GREEN, null), false);
! Stylesheet ss = new StylesheetShim(null) {
{
setOrigin(StyleOrigin.INLINE);
getRules().add(
! RuleShim.getRule(Arrays.asList(SelectorShim.getUniversalSelector()), Arrays.asList(decl))
);
}
};
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
! new Style(SelectorShim.getUniversalSelector(), decl),
new Style(root, fxBase),
new Style(root, fxColor),
new Style(rect, fxFill),
new Style(rectHover, fxFillHover)
);
*** 604,614 ****
@Test @org.junit.Ignore
public void testGetMatchingStylesWithInlineStyleOnRootAndLeaf() {
! final Stylesheet stylesheet = new Stylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
--- 626,636 ----
@Test @org.junit.Ignore
public void testGetMatchingStylesWithInlineStyleOnRootAndLeaf() {
! final Stylesheet stylesheet = StylesheetShim.getStylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
*** 616,699 ****
// .root { -fx-base: red; -fx-color: -fx-base; }
//
List<String> rootStyleClass = new ArrayList<String>();
rootStyleClass.add("root");
! Selector root = new SimpleSelector("*", rootStyleClass, null, null);
ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
! Declaration fxBase = new Declaration("-fx-base", fxBaseValue, false);
ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
! Declaration fxColor = new Declaration("-fx-color", fxColorValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxBase, fxColor);
! Rule baseRule = new Rule(selectors, declarations);
rules.add(baseRule);
//
// .rect { -fx-fill: -fx-color; }
//
List<String> rectStyleClass = new ArrayList<String>();
rectStyleClass.add("rect");
! Selector rect = new SimpleSelector("*", rectStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
! Declaration fxFill = new Declaration("-fx-fill", fxFillValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rect);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill);
! Rule rectRule = new Rule(selectors, declarations);
rules.add(rectRule);
// .rect:hover { -fx-fill: yellow; }
List<String> pseudoclasses = new ArrayList<String>();
pseudoclasses.add("hover");
! Selector rectHover = new SimpleSelector("*", rectStyleClass, pseudoclasses, null);
ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
! Declaration fxFillHover = new Declaration("-fx-fill", fxFillHoverValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rectHover);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFillHover);
! Rule rectHoverRule = new Rule(selectors, declarations);
rules.add(rectHoverRule);
// Declaration now checks origin, so we need to make this expected
// value look like it came from an inline
! final Declaration gdecl = new Declaration("-fx-base", new ParsedValueImpl<Color,Color>(Color.GREEN, null), false);
! final Declaration ydecl = new Declaration("-fx-color", new ParsedValueImpl<Color,Color>(Color.YELLOW, null), false);
! Stylesheet ss = new Stylesheet() {
{
setOrigin(StyleOrigin.INLINE);
Collections.addAll(getRules(),
! new Rule(Arrays.asList(SimpleSelector.getUniversalSelector()), Arrays.asList(gdecl)),
! new Rule(Arrays.asList(SimpleSelector.getUniversalSelector()), Arrays.asList(ydecl))
);
}
};
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
! new Style(SimpleSelector.getUniversalSelector(), ydecl),
! new Style(SimpleSelector.getUniversalSelector(), gdecl),
new Style(root, fxBase),
new Style(root, fxColor),
new Style(rect, fxFill),
new Style(rectHover, fxFillHover)
);
--- 638,721 ----
// .root { -fx-base: red; -fx-color: -fx-base; }
//
List<String> rootStyleClass = new ArrayList<String>();
rootStyleClass.add("root");
! Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
! Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
! Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxBase, fxColor);
! Rule baseRule = RuleShim.getRule(selectors, declarations);
rules.add(baseRule);
//
// .rect { -fx-fill: -fx-color; }
//
List<String> rectStyleClass = new ArrayList<String>();
rectStyleClass.add("rect");
! Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
! Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rect);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill);
! Rule rectRule = RuleShim.getRule(selectors, declarations);
rules.add(rectRule);
// .rect:hover { -fx-fill: yellow; }
List<String> pseudoclasses = new ArrayList<String>();
pseudoclasses.add("hover");
! Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
! Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rectHover);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFillHover);
! Rule rectHoverRule = RuleShim.getRule(selectors, declarations);
rules.add(rectHoverRule);
// Declaration now checks origin, so we need to make this expected
// value look like it came from an inline
! final Declaration gdecl = DeclarationShim.getDeclaration("-fx-base", new ParsedValueImpl<Color,Color>(Color.GREEN, null), false);
! final Declaration ydecl = DeclarationShim.getDeclaration("-fx-color", new ParsedValueImpl<Color,Color>(Color.YELLOW, null), false);
! Stylesheet ss = new StylesheetShim(null) {
{
setOrigin(StyleOrigin.INLINE);
Collections.addAll(getRules(),
! RuleShim.getRule(Arrays.asList(SelectorShim.getUniversalSelector()), Arrays.asList(gdecl)),
! RuleShim.getRule(Arrays.asList(SelectorShim.getUniversalSelector()), Arrays.asList(ydecl))
);
}
};
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
! new Style(SelectorShim.getUniversalSelector(), ydecl),
! new Style(SelectorShim.getUniversalSelector(), gdecl),
new Style(root, fxBase),
new Style(root, fxColor),
new Style(rect, fxFill),
new Style(rectHover, fxFillHover)
);
*** 731,741 ****
@Test @org.junit.Ignore
public void testGetMatchingStylesShouldNotReturnAncestorPropertyIfNotInherited() {
! final Stylesheet stylesheet = new Stylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
--- 753,763 ----
@Test @org.junit.Ignore
public void testGetMatchingStylesShouldNotReturnAncestorPropertyIfNotInherited() {
! final Stylesheet stylesheet = StylesheetShim.getStylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
*** 743,808 ****
// .root { -fx-base: red; -fx-color: -fx-base; }
//
List<String> rootStyleClass = new ArrayList<String>();
rootStyleClass.add("root");
! Selector root = new SimpleSelector("*", rootStyleClass, null, null);
ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
! Declaration fxBase = new Declaration("-fx-base", fxBaseValue, false);
ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
! Declaration fxColor = new Declaration("-fx-color", fxColorValue, false);
ParsedValueImpl<Color,Color> fxFillShouldNotMatchValue = new ParsedValueImpl<Color,Color>(Color.RED, null);
! Declaration fxFillShouldNotMatch = new Declaration("-fx-fill", fxFillShouldNotMatchValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxBase, fxColor, fxFillShouldNotMatch);
! Rule baseRule = new Rule(selectors, declarations);
rules.add(baseRule);
//
// .rect { -fx-fill: -fx-color; }
//
List<String> rectStyleClass = new ArrayList<String>();
rectStyleClass.add("rect");
! Selector rect = new SimpleSelector("*", rectStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
! Declaration fxFill = new Declaration("-fx-fill", fxFillValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rect);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill);
! Rule rectRule = new Rule(selectors, declarations);
rules.add(rectRule);
// .rect:hover { -fx-fill: yellow; }
List<String> pseudoclasses = new ArrayList<String>();
pseudoclasses.add("hover");
! Selector rectHover = new SimpleSelector("*", rectStyleClass, pseudoclasses, null);
ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
! Declaration fxFillHover = new Declaration("-fx-fill", fxFillHoverValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rectHover);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFillHover);
! Rule rectHoverRule = new Rule(selectors, declarations);
rules.add(rectHoverRule);
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
new Style(root, fxBase),
--- 765,830 ----
// .root { -fx-base: red; -fx-color: -fx-base; }
//
List<String> rootStyleClass = new ArrayList<String>();
rootStyleClass.add("root");
! Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
! Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
! Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
ParsedValueImpl<Color,Color> fxFillShouldNotMatchValue = new ParsedValueImpl<Color,Color>(Color.RED, null);
! Declaration fxFillShouldNotMatch = DeclarationShim.getDeclaration("-fx-fill", fxFillShouldNotMatchValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxBase, fxColor, fxFillShouldNotMatch);
! Rule baseRule = RuleShim.getRule(selectors, declarations);
rules.add(baseRule);
//
// .rect { -fx-fill: -fx-color; }
//
List<String> rectStyleClass = new ArrayList<String>();
rectStyleClass.add("rect");
! Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
! Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rect);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill);
! Rule rectRule = RuleShim.getRule(selectors, declarations);
rules.add(rectRule);
// .rect:hover { -fx-fill: yellow; }
List<String> pseudoclasses = new ArrayList<String>();
pseudoclasses.add("hover");
! Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
! Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rectHover);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFillHover);
! Rule rectHoverRule = RuleShim.getRule(selectors, declarations);
rules.add(rectHoverRule);
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
new Style(root, fxBase),
*** 839,849 ****
@Test @org.junit.Ignore
public void testGetMatchingStylesShouldNotReturnInlineAncestorPropertyIfNotInherited() {
! final Stylesheet stylesheet = new Stylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
--- 861,871 ----
@Test @org.junit.Ignore
public void testGetMatchingStylesShouldNotReturnInlineAncestorPropertyIfNotInherited() {
! final Stylesheet stylesheet = StylesheetShim.getStylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
*** 854,916 ****
rectStyleClass.add("rect");
//
// .root { -fx-base: red; -fx-color: -fx-base; }
//
! Selector root = new SimpleSelector("*", rootStyleClass, null, null);
ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
! Declaration fxBase = new Declaration("-fx-base", fxBaseValue, false);
ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
! Declaration fxColor = new Declaration("-fx-color", fxColorValue, false);
ParsedValueImpl<Color,Color> fxFillShouldNotMatchValue = new ParsedValueImpl<Color,Color>(Color.RED, null);
! Declaration fxFillShouldNotMatch = new Declaration("-fx-fill", fxFillShouldNotMatchValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxBase, fxColor, fxFillShouldNotMatch);
! Rule baseRule = new Rule(selectors, declarations);
rules.add(baseRule);
//
// .rect { -fx-fill: -fx-color; }
//
! Selector rect = new SimpleSelector("*", rectStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
! Declaration fxFill = new Declaration("-fx-fill", fxFillValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rect);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill);
! Rule rectRule = new Rule(selectors, declarations);
rules.add(rectRule);
// .rect:hover { -fx-fill: yellow; }
List<String> pseudoclasses = new ArrayList<String>();
pseudoclasses.add("hover");
! Selector rectHover = new SimpleSelector("*", rectStyleClass, pseudoclasses, null);
ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
! Declaration fxFillHover = new Declaration("-fx-fill", fxFillHoverValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rectHover);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFillHover);
! Rule rectHoverRule = new Rule(selectors, declarations);
rules.add(rectHoverRule);
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
new Style(root, fxBase),
--- 876,938 ----
rectStyleClass.add("rect");
//
// .root { -fx-base: red; -fx-color: -fx-base; }
//
! Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
! Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
! Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
ParsedValueImpl<Color,Color> fxFillShouldNotMatchValue = new ParsedValueImpl<Color,Color>(Color.RED, null);
! Declaration fxFillShouldNotMatch = DeclarationShim.getDeclaration("-fx-fill", fxFillShouldNotMatchValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxBase, fxColor, fxFillShouldNotMatch);
! Rule baseRule = RuleShim.getRule(selectors, declarations);
rules.add(baseRule);
//
// .rect { -fx-fill: -fx-color; }
//
! Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
! Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rect);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill);
! Rule rectRule = RuleShim.getRule(selectors, declarations);
rules.add(rectRule);
// .rect:hover { -fx-fill: yellow; }
List<String> pseudoclasses = new ArrayList<String>();
pseudoclasses.add("hover");
! Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
! Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, rectHover);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFillHover);
! Rule rectHoverRule = RuleShim.getRule(selectors, declarations);
rules.add(rectHoverRule);
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
new Style(root, fxBase),
*** 945,955 ****
@Test @org.junit.Ignore
public void testGetMatchingStylesReturnsInheritedProperty() {
! final Stylesheet stylesheet = new Stylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
--- 967,977 ----
@Test @org.junit.Ignore
public void testGetMatchingStylesReturnsInheritedProperty() {
! final Stylesheet stylesheet = StylesheetShim.getStylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
*** 957,998 ****
// .root { -fx-base: red; -fx-color: -fx-base; }
//
List<String> rootStyleClass = new ArrayList<String>();
rootStyleClass.add("root");
! Selector root = new SimpleSelector("*", rootStyleClass, null, null);
ParsedValue<Color,Color> fxFontShouldInheritValue = new CssParser().parseExpr("-fx-font", "12px system");
! Declaration fxFontShouldInherit = new Declaration("-fx-font", fxFontShouldInheritValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFontShouldInherit);
! Rule baseRule = new Rule(selectors, declarations);
rules.add(baseRule);
//
// .text { -fx-fill: -fx-color; }
//
List<String> textStyleClass = new ArrayList<String>();
textStyleClass.add("text");
! Selector textSelector = new SimpleSelector("*", textStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "red");
! Declaration fxFill = new Declaration("-fx-fill", fxFillValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, textSelector);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill);
! Rule rectRule = new Rule(selectors, declarations);
rules.add(rectRule);
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
new Style(root, fxFontShouldInherit)
--- 979,1020 ----
// .root { -fx-base: red; -fx-color: -fx-base; }
//
List<String> rootStyleClass = new ArrayList<String>();
rootStyleClass.add("root");
! Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
ParsedValue<Color,Color> fxFontShouldInheritValue = new CssParser().parseExpr("-fx-font", "12px system");
! Declaration fxFontShouldInherit = DeclarationShim.getDeclaration("-fx-font", fxFontShouldInheritValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFontShouldInherit);
! Rule baseRule = RuleShim.getRule(selectors, declarations);
rules.add(baseRule);
//
// .text { -fx-fill: -fx-color; }
//
List<String> textStyleClass = new ArrayList<String>();
textStyleClass.add("text");
! Selector textSelector = SimpleSelectorShim.getSimpleSelector("*", textStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "red");
! Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, textSelector);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill);
! Rule rectRule = RuleShim.getRule(selectors, declarations);
rules.add(rectRule);
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
new Style(root, fxFontShouldInherit)
*** 1025,1035 ****
}
@Test @org.junit.Ignore
public void testGetMatchingStylesReturnsSubProperty() {
! final Stylesheet stylesheet = new Stylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
--- 1047,1057 ----
}
@Test @org.junit.Ignore
public void testGetMatchingStylesReturnsSubProperty() {
! final Stylesheet stylesheet = StylesheetShim.getStylesheet();
stylesheet.setOrigin(StyleOrigin.USER_AGENT);
StyleManager.getInstance().setDefaultUserAgentStylesheet(stylesheet);
final List<Rule> rules = stylesheet.getRules();
*** 1037,1081 ****
// .root { -fx-base: red; -fx-color: -fx-base; }
//
List<String> rootStyleClass = new ArrayList<String>();
rootStyleClass.add("root");
! Selector root = new SimpleSelector("*", rootStyleClass, null, null);
ParsedValue<Color,Color> fxFontShouldInheritValue = new CssParser().parseExpr("-fx-font", "12px system");
! Declaration fxFontShouldInherit = new Declaration("-fx-font", fxFontShouldInheritValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFontShouldInherit);
! Rule baseRule = new Rule(selectors, declarations);
rules.add(baseRule);
//
// .text { -fx-fill: -fx-color; }
//
List<String> rectStyleClass = new ArrayList<String>();
rectStyleClass.add("text");
! Selector textSelector = new SimpleSelector("*", rectStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "red");
! Declaration fxFill = new Declaration("-fx-fill", fxFillValue, false);
ParsedValue fxFontFamilyValue = new CssParser().parseExpr("-fx-font-family", "arial");
! Declaration fxFontFamily = new Declaration("-fx-font-family", fxFontFamilyValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, textSelector);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill, fxFontFamily);
! Rule rectRule = new Rule(selectors, declarations);
rules.add(rectRule);
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
new Style(textSelector, fxFontFamily),
--- 1059,1103 ----
// .root { -fx-base: red; -fx-color: -fx-base; }
//
List<String> rootStyleClass = new ArrayList<String>();
rootStyleClass.add("root");
! Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
ParsedValue<Color,Color> fxFontShouldInheritValue = new CssParser().parseExpr("-fx-font", "12px system");
! Declaration fxFontShouldInherit = DeclarationShim.getDeclaration("-fx-font", fxFontShouldInheritValue, false);
List<Selector> selectors = new ArrayList<Selector>();
Collections.addAll(selectors, root);
List<Declaration> declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFontShouldInherit);
! Rule baseRule = RuleShim.getRule(selectors, declarations);
rules.add(baseRule);
//
// .text { -fx-fill: -fx-color; }
//
List<String> rectStyleClass = new ArrayList<String>();
rectStyleClass.add("text");
! Selector textSelector = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "red");
! Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
ParsedValue fxFontFamilyValue = new CssParser().parseExpr("-fx-font-family", "arial");
! Declaration fxFontFamily = DeclarationShim.getDeclaration("-fx-font-family", fxFontFamilyValue, false);
selectors = new ArrayList<Selector>();
Collections.addAll(selectors, textSelector);
declarations = new ArrayList<Declaration>();
Collections.addAll(declarations, fxFill, fxFontFamily);
! Rule rectRule = RuleShim.getRule(selectors, declarations);
rules.add(rectRule);
List<Style> expecteds = new ArrayList<Style>();
Collections.addAll(expecteds,
new Style(textSelector, fxFontFamily),