changeset 1780:990a916ce39a

RT-24598: declaration needs to consider origin in equals
author David Grieve<david.grieve@oracle.com>
date Fri, 21 Sep 2012 09:13:09 -0400
parents a09a117dc223
children b6ba50d02d9e
files javafx-ui-common/src/com/sun/javafx/css/Declaration.java javafx-ui-common/test/unit/com/sun/javafx/css/DeclarationTest.java javafx-ui-common/test/unit/com/sun/javafx/css/StyleablePropertyTest.java
diffstat 3 files changed, 671 insertions(+), 634 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-common/src/com/sun/javafx/css/Declaration.java	Fri Sep 21 09:13:09 2012 -0400
+++ b/javafx-ui-common/src/com/sun/javafx/css/Declaration.java	Fri Sep 21 09:13:09 2012 -0400
@@ -62,6 +62,14 @@
         return important;
     }
 
+    /** Helper */
+    private Stylesheet.Origin getOrigin() {
+        Rule rule = getRule();
+        if (rule != null)  {
+            return rule.getOrigin();
+        }
+        return null;
+    }
     /** 
      * One declaration is the equal to another regardless of the Rule to which
      * the Declaration belongs. Only the property, value and importance are
@@ -79,15 +87,18 @@
             return false;
         }
         final Declaration other = (Declaration) obj;
+        if (this.important != other.important) {
+            return false;
+        }
+        if (this.getOrigin() != other.getOrigin()) {
+            return false;
+        }
         if ((this.property == null) ? (other.property != null) : !this.property.equals(other.property)) {
             return false;
         }
         if (this.parsedValue != other.parsedValue && (this.parsedValue == null || !this.parsedValue.equals(other.parsedValue))) {
             return false;
         }
-        if (this.important != other.important) {
-            return false;
-        }
         return true;
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/test/unit/com/sun/javafx/css/DeclarationTest.java	Fri Sep 21 09:13:09 2012 -0400
@@ -0,0 +1,117 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.sun.javafx.css;
+
+import com.sun.javafx.css.parser.CSSParser;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import javafx.scene.paint.Color;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class DeclarationTest {
+    
+    private static class Data {
+        private final Declaration d1, d2;
+        private final boolean expected;
+        Data(Declaration d1, Declaration d2, boolean expected){
+            this.d1 = d1;
+            this.d2 = d2;
+            this.expected = expected;
+        }
+        
+        @Override public String toString() {
+            return "\"" + d1 + "\" " + (expected ? "==" : "!=") + " \"" + d2 + "\"";
+        }
+    }
+    
+    public DeclarationTest(Data data) {
+        this.data = data;
+    }
+    private final Data data;
+    
+
+    @Parameters
+    public static Collection data() {
+
+        int n = 0;
+        final int GI = n++; // green inline
+        final int YI = n++; // yellow inline
+        final int GA1 = n++; // green author 1 
+        final int YA1 = n++; // yellow author 1 
+        final int GA2 = n++; // green author 2 
+        final int YA2 = n++; // yellow author 2 
+        
+        final Declaration[] DECLS = new Declaration[n];
+        
+        Stylesheet inlineSS = new Stylesheet() {
+            {
+                setOrigin(Stylesheet.Origin.INLINE);
+                
+                DECLS[GI] = new Declaration("-fx-base", new ParsedValue<Color,Color>(Color.GREEN, null), false);
+                DECLS[YI] = new Declaration("-fx-color", new ParsedValue<Color,Color>(Color.YELLOW, null), false);
+    
+                Collections.addAll(getRules(),
+                    new Rule(Arrays.asList(SimpleSelector.getUniversalSelector()), Arrays.asList(DECLS[GI])),
+                    new Rule(Arrays.asList(SimpleSelector.getUniversalSelector()), Arrays.asList(DECLS[YI]))
+                );
+            }
+        };
+        
+        Stylesheet authorSS_1 = new Stylesheet() {
+            {
+                setOrigin(Stylesheet.Origin.AUTHOR);
+                
+                DECLS[GA1] = new Declaration("-fx-base", new ParsedValue<Color,Color>(Color.GREEN, null), false);
+                DECLS[YA1] = new Declaration("-fx-color", new ParsedValue<Color,Color>(Color.YELLOW, null), false);
+    
+                Collections.addAll(getRules(),
+                    new Rule(Arrays.asList(SimpleSelector.getUniversalSelector()), Arrays.asList(DECLS[GA1])),
+                    new Rule(Arrays.asList(SimpleSelector.getUniversalSelector()), Arrays.asList(DECLS[YA1]))
+                );
+            }
+        };
+        
+        Stylesheet authorSS_2 = new Stylesheet() {
+            {
+                setOrigin(Stylesheet.Origin.AUTHOR);
+                
+                DECLS[GA2] = new Declaration("-fx-base", new ParsedValue<Color,Color>(Color.GREEN, null), false);
+                DECLS[YA2] = new Declaration("-fx-color", new ParsedValue<Color,Color>(Color.YELLOW, null), false);
+    
+                Collections.addAll(getRules(),
+                    new Rule(Arrays.asList(SimpleSelector.getUniversalSelector()), Arrays.asList(DECLS[GA2])),
+                    new Rule(Arrays.asList(SimpleSelector.getUniversalSelector()), Arrays.asList(DECLS[YA2]))
+                );
+            }
+        };
+        
+        return Arrays.asList(new Object[] {
+            new Object[] { new Data(DECLS[GA1], DECLS[GA2], true) },
+            new Object[] { new Data(DECLS[GA1], DECLS[YA1], false) },
+            new Object[] { new Data(DECLS[GA1], DECLS[GI],  false) }
+        });
+    }
+    
+    @Test
+    public void testEquals() {
+
+        Declaration instance = data.d1;
+        Declaration obj = data.d2;
+        boolean expected = data.expected;
+        boolean actual = instance.equals(obj);
+        assertTrue(data.toString(), expected == actual);
+        
+    }
+
+}
--- a/javafx-ui-common/test/unit/com/sun/javafx/css/StyleablePropertyTest.java	Fri Sep 21 09:13:09 2012 -0400
+++ b/javafx-ui-common/test/unit/com/sun/javafx/css/StyleablePropertyTest.java	Fri Sep 21 09:13:09 2012 -0400
@@ -50,9 +50,11 @@
 import com.sun.javafx.jmx.MXNodeAlgorithm;
 import com.sun.javafx.jmx.MXNodeAlgorithmContext;
 import com.sun.javafx.sg.PGNode;
-import org.junit.AfterClass;
+import com.sun.javafx.tk.Toolkit;
+import javafx.scene.Scene;
+import javafx.scene.text.Text;
+import javafx.stage.Stage;
 import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -62,19 +64,7 @@
 
     public StyleablePropertyTest() {
     }
-
-    @BeforeClass
-    public static void setUpClass() throws Exception {
-    }
-
-    @AfterClass
-    public static void tearDownClass() throws Exception {
-    }
-
-    @Before
-    public void setUp() {
-    }
-
+    
     private static StyleableProperty get(List<StyleableProperty> list, String prop) {
         for (StyleableProperty styleable : list) {
             if (prop.equals(styleable.getProperty())) return styleable;
@@ -274,151 +264,7 @@
         
         return styles;
     }
-    
-    Group createGroup(final CascadingStyle... styles ) {
         
-        // TBD: can't execute this code because there is no StyleHelper.create method
-        assert false : "caller should be @Ignored";
-    
-        final List<CascadingStyle> cascadingStyles = new ArrayList<CascadingStyle>();
-        Collections.addAll(cascadingStyles, styles);
-        final  Map<String, List<CascadingStyle>> styleMap = 
-                Node_cssStyleMap_Test.createStyleMap(cascadingStyles);
-        final Map<StyleHelper.StyleCacheKey, StyleHelper.StyleCacheBucket> styleCache = 
-                        new HashMap<StyleHelper.StyleCacheKey, StyleHelper.StyleCacheBucket>();
-        
-        
-        final Group group = new Group() {
-            // I'm bypassing StyleManager by creating StyleHelper directly. 
-//            StyleHelper shelper = null;
-//            
-//            @Override public void impl_processCSS(boolean reapply) {
-//                if (reapply) {
-//                    shelper = StyleHelper.create(this, styleMap, styleCache, 0, 2);
-//                }
-//                shelper.transitionToState(this);
-//            }
-//                                               
-//            @Override public StyleHelper impl_getStyleHelper() {
-//                return shelper;
-//            }            
-            
-        };
-        group.getStyleClass().add("root");
-        
-        return group;
-    }
-    
-    Rectangle createRectangle(final CascadingStyle... styles ) {
-
-        // TBD: can't execute this code because there is no StyleHelper.create method
-        assert false : "caller should be @Ignored";
-            
-        final List<CascadingStyle> cascadingStyles = new ArrayList<CascadingStyle>();
-        Collections.addAll(cascadingStyles, styles);
-        final  Map<String, List<CascadingStyle>> styleMap = 
-                Node_cssStyleMap_Test.createStyleMap(cascadingStyles);
-        final Map<StyleHelper.StyleCacheKey, StyleHelper.StyleCacheBucket> styleCache = 
-                        new HashMap<StyleHelper.StyleCacheKey, StyleHelper.StyleCacheBucket>();
-        
-        Rectangle rectangle = new Rectangle() {
-            // I'm bypassing StyleManager by creating StyleHelper directly. 
-//            StyleHelper shelper = null;
-//            
-//            @Override public void impl_processCSS(boolean reapply) {
-//                if (reapply) {
-//                    shelper = StyleHelper.create(this, styleMap, styleCache, 0, 2);
-//                }
-//                shelper.transitionToState(this);
-//            }
-//                                               
-//            @Override public StyleHelper impl_getStyleHelper() {
-//                return shelper;
-//            }            
-                                    
-        };
-        rectangle.getStyleClass().add("rect");
-
-        return rectangle;
-    }
-
-    static class RectangleWithFont extends Rectangle {
-                
-        final List<CascadingStyle> cascadingStyles = new ArrayList<CascadingStyle>();
-        final  Map<String, List<CascadingStyle>> styleMap = 
-                Node_cssStyleMap_Test.createStyleMap(cascadingStyles);
-        final Map<StyleHelper.StyleCacheKey, StyleHelper.StyleCacheBucket> styleCache = 
-                        new HashMap<StyleHelper.StyleCacheKey, StyleHelper.StyleCacheBucket>();
-        
-        // I'm bypassing StyleManager by creating StyleHelper directly. 
-        StyleHelper shelper = null;
-        
-        RectangleWithFont(final CascadingStyle... styles) {
-            super();
-            getStyleClass().add("rect");
-            Collections.addAll(cascadingStyles, styles);
-            
-            assert false : "caller should be @Ignored";
-            // TBD: can't execute this code because there is no StyleHelper.create method
-        }    
-        
-//            @Override public void impl_processCSS(boolean reapply) {
-//                if (reapply) {
-//                    shelper = StyleHelper.create(this, styleMap, styleCache, 0, 2);
-//                }
-//                shelper.transitionToState(this);
-//            }
-//                                               
-//            @Override public StyleHelper impl_getStyleHelper() {
-//                return shelper;
-//            }            
-            
-        ObjectProperty<Font> font = new StyleableObjectProperty<Font>() {
-
-            @Override
-            public Object getBean() {
-                return RectangleWithFont.this;
-            }
-
-            @Override
-            public String getName() {
-                return "font";
-            }
-
-            @Override
-            public StyleableProperty getStyleableProperty() {
-                return FONT;
-            }
-
-        };
-
-        private static final StyleableProperty<RectangleWithFont,Font> FONT =
-            new StyleableProperty.FONT<RectangleWithFont>("-fx-font", Font.getDefault()) {
-
-                @Override
-                public boolean isSettable(RectangleWithFont node) {
-                    return true;
-                }
-
-                @Override
-                public WritableValue<Font> getWritableValue(RectangleWithFont node) {
-                    return node.font;
-                }
-            };
-            
-        public static List<StyleableProperty> impl_CSS_STYLEABLES() {
-            List<StyleableProperty> styleables = new ArrayList<StyleableProperty>();
-            styleables.addAll(Rectangle.impl_CSS_STYLEABLES());
-            styleables.add(FONT);
-            return styleables;
-        }
-        
-        @Override public List<StyleableProperty> impl_getStyleableProperties() {
-            return impl_CSS_STYLEABLES();
-        }
-            
-    }    
-    
     static int ord = 0;
     static CascadingStyle createCascadingStyle(Selector selector, Declaration declaration) {
         List<String> pseudoclasses = null;
@@ -441,24 +287,22 @@
         );
     }
         
-    @Test @org.junit.Ignore
+    @Test
     public void testGetMatchingStyles() {
 
         
         final Stylesheet stylesheet = new Stylesheet();
         stylesheet.setOrigin(Stylesheet.Origin.USER_AGENT);
+        StyleManager.setDefaultUserAgentStylesheet(stylesheet);
         
         final List<Rule> rules = stylesheet.getRules();
         
-        List<String> rootStyleClass = new ArrayList<String>();
-        rootStyleClass.add("root");
-        
-        List<String> rectStyleClass = new ArrayList<String>();
-        rootStyleClass.add("rect");
-        
         //
         // .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 = CSSParser.getInstance().parseExpr("-fx-base", "red");
@@ -479,6 +323,237 @@
         //
         // .rect { -fx-fill: -fx-color; }
         //
+        List<String> rectStyleClass = new ArrayList<String>();
+        rectStyleClass.add("rect");
+        
+        Selector rect = new SimpleSelector("*", rectStyleClass, null, null);
+        
+        ParsedValue fxFillValue = CSSParser.getInstance().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);
+        
+        ParsedValue<Color,Color> fxFillHoverValue = new ParsedValue<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), 
+                new Style(root, fxColor), 
+                new Style(rect, fxFill),
+                new Style(rectHover, fxFillHover)
+        );
+        
+        final Rectangle rectangle = new Rectangle();
+        rectangle.getStyleClass().add("rect");
+        
+        final Group group = new Group();
+        group.getChildren().add(rectangle);
+        
+        Scene scene = new Scene(group);
+        Stage stage = new Stage();
+        stage.setScene(scene);
+        stage.show();
+        
+        final StyleableProperty FILL = get(StyleableProperty.getStyleables(rectangle), "-fx-fill");
+        final List<Style> actuals = FILL.getMatchingStyles(rectangle);
+
+//        System.err.println("matchingStyles: " + matchingStyles);
+//        System.err.println("expecteds: " + expecteds);
+//        System.err.println("actuals: " + actuals);
+        
+        assertEquals(expecteds.size(), actuals.size(), 0);
+        
+        for (Style style : expecteds) {
+            if (!actuals.remove(style)) fail();
+        }
+        assertTrue(actuals.isEmpty());
+    }
+
+    @Test
+    public void testGetMatchingStylesWithInlineStyleOnParent() {
+
+        
+        final Stylesheet stylesheet = new Stylesheet();
+        stylesheet.setOrigin(Stylesheet.Origin.USER_AGENT);
+        StyleManager.setDefaultUserAgentStylesheet(stylesheet);
+        
+        final List<Rule> rules = stylesheet.getRules();
+        
+        //
+        // .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 = CSSParser.getInstance().parseExpr("-fx-base", "red");
+        Declaration fxBase = new Declaration("-fx-base", fxBaseValue, false);
+
+        ParsedValue<String,String> fxColorValue = new ParsedValue<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 = CSSParser.getInstance().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);
+        
+        ParsedValue<Color,Color> fxFillHoverValue = new ParsedValue<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 ParsedValue<Color,Color>(Color.GREEN, null), false);
+    
+        Stylesheet ss = new Stylesheet() {
+            {
+                setOrigin(Stylesheet.Origin.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)
+        );
+                
+        final Rectangle rectangle = new Rectangle();
+        rectangle.getStyleClass().add("rect");
+        
+        final Group group = new Group();
+        group.setStyle("-fx-base: green;");
+        group.getChildren().add(rectangle);        
+        
+        Scene scene = new Scene(group);
+        Stage stage = new Stage();
+        stage.setScene(scene);
+        stage.show();        
+                
+        final StyleableProperty FILL = get(StyleableProperty.getStyleables(rectangle), "-fx-fill");
+        final List<Style> actuals = FILL.getMatchingStyles(rectangle);
+
+//        System.err.println("matchingStyles: " + matchingStyles);
+//        System.err.println("expecteds: " + expecteds);
+//        System.err.println("actuals: " + actuals);
+        
+        assertEquals(expecteds.size(), actuals.size(), 0);
+
+        // inline style should be first
+        assertEquals(expecteds.get(0), actuals.get(0));
+        
+        for (Style style : expecteds) {
+            if (!actuals.remove(style)) fail();
+        }
+        assertTrue(actuals.isEmpty());
+    }
+
+    @Test
+    public void testGetMatchingStylesWithInlineStyleOnLeaf() {
+
+        
+        final Stylesheet stylesheet = new Stylesheet();
+        stylesheet.setOrigin(Stylesheet.Origin.USER_AGENT);
+        StyleManager.setDefaultUserAgentStylesheet(stylesheet);
+        
+        final List<Rule> rules = stylesheet.getRules();
+        
+        //
+        // .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 = CSSParser.getInstance().parseExpr("-fx-base", "red");
+        Declaration fxBase = new Declaration("-fx-base", fxBaseValue, false);
+
+        ParsedValue<String,String> fxColorValue = new ParsedValue<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 = CSSParser.getInstance().parseExpr("-fx-fill", "-fx-color");
@@ -511,60 +586,74 @@
         Rule rectHoverRule = new Rule(selectors, declarations);
         rules.add(rectHoverRule);
                 
-        final Group group = createGroup(
-            createCascadingStyle(root, fxBase), 
-            createCascadingStyle(root, fxColor)
-        );
-        
-        final Rectangle rectangle = createRectangle(
-            createCascadingStyle(rect, fxFill), 
-            createCascadingStyle(rectHover, fxFillHover)                
-        );
-        
+        // 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 ParsedValue<Color,Color>(Color.GREEN, null), false);
+    
+        Stylesheet ss = new Stylesheet() {
+            {
+                setOrigin(Stylesheet.Origin.INLINE);
+                getRules().add(
+                    new Rule(Arrays.asList(SimpleSelector.getUniversalSelector()), Arrays.asList(decl))
+                );
+            }
+        };
+       
         List<Style> expecteds = new ArrayList<Style>();
         Collections.addAll(expecteds, 
-                new Style(root, fxBase), 
+                new Style(SimpleSelector.getUniversalSelector(), decl),
+                new Style(root, fxBase),
                 new Style(root, fxColor), 
                 new Style(rect, fxFill),
                 new Style(rectHover, fxFillHover)
         );
         
+        final Rectangle rectangle = new Rectangle();
+        rectangle.getStyleClass().add("rect");
+        rectangle.setStyle("-fx-base: green;");
+        
+        final Group group = new Group();        
         group.getChildren().add(rectangle);        
-        group.impl_processCSS(true);
         
+        Scene scene = new Scene(group);
+        Stage stage = new Stage();
+        stage.setScene(scene);
+        stage.show();
+
         final StyleableProperty FILL = get(StyleableProperty.getStyleables(rectangle), "-fx-fill");
         final List<Style> actuals = FILL.getMatchingStyles(rectangle);
+                
+//        System.err.println("matchingStyles: " + matchingStyles);
+//        System.err.println("expecteds: " + expecteds);
+//        System.err.println("actuals: " + actuals);
 
-//        System.out.println("matchingStyles: " + matchingStyles);
-//        System.out.println("expecteds: " + expecteds);
-//        System.out.println("actuals: " + actuals);
+        assertEquals(expecteds.size(), actuals.size(), 0);
         
-        assertEquals(expecteds.size(), actuals.size(), 0);
+        // inline style should be first
+        assertEquals(expecteds.get(0), actuals.get(0));
         
         for (Style style : expecteds) {
             if (!actuals.remove(style)) fail();
         }
         assertTrue(actuals.isEmpty());
-    }
+    }   
+    
+    @Test
+    public void testGetMatchingStylesWithInlineStyleOnRootAndLeaf() {
 
-    @Test  @org.junit.Ignore
-    public void testGetMatchingStylesWithInlineStyleOnParent() {
 
-        
         final Stylesheet stylesheet = new Stylesheet();
         stylesheet.setOrigin(Stylesheet.Origin.USER_AGENT);
+        StyleManager.setDefaultUserAgentStylesheet(stylesheet);
         
         final List<Rule> rules = stylesheet.getRules();
         
-        List<String> rootStyleClass = new ArrayList<String>();
-        rootStyleClass.add("root");
-        
-        List<String> rectStyleClass = new ArrayList<String>();
-        rootStyleClass.add("rect");
-        
         //
         // .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 = CSSParser.getInstance().parseExpr("-fx-base", "red");
@@ -585,6 +674,139 @@
         //
         // .rect { -fx-fill: -fx-color; }
         //
+        List<String> rectStyleClass = new ArrayList<String>();
+        rectStyleClass.add("rect");
+        
+        Selector rect = new SimpleSelector("*", rectStyleClass, null, null);
+        
+        ParsedValue fxFillValue = CSSParser.getInstance().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);
+        
+        ParsedValue<Color,Color> fxFillHoverValue = new ParsedValue<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 ParsedValue<Color,Color>(Color.GREEN, null), false);
+        final Declaration ydecl = new Declaration("-fx-color", new ParsedValue<Color,Color>(Color.YELLOW, null), false);
+    
+        Stylesheet ss = new Stylesheet() {
+            {
+                setOrigin(Stylesheet.Origin.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)
+        );
+        
+        final Rectangle rectangle = new Rectangle();
+        rectangle.getStyleClass().add("rect");
+        rectangle.setStyle("-fx-base: green;");
+                
+        final Group group = new Group();
+        group.setStyle("-fx-color: yellow;");
+        group.getChildren().add(rectangle);        
+
+        Scene scene = new Scene(group);
+        Stage stage = new Stage();
+        stage.setScene(scene);
+        stage.show();
+        
+        final StyleableProperty FILL = get(StyleableProperty.getStyleables(rectangle), "-fx-fill");
+        final List<Style> actuals = FILL.getMatchingStyles(rectangle);
+
+//        System.err.println("matchingStyles: " + matchingStyles);
+//        System.err.println("expecteds: " + expecteds);
+        System.err.println("actuals: " + actuals);
+
+        assertEquals(expecteds.size(), actuals.size(), 0);
+        
+        // inline style should be first
+        assertEquals(expecteds.get(0), actuals.get(0));
+        
+        for (Style style : expecteds) {
+            if (!actuals.remove(style)) fail(style.toString());
+        }
+        assertTrue(actuals.isEmpty());
+    } 
+
+    @Test
+    public void testGetMatchingStylesShouldNotReturnAncestorPropertyIfNotInherited() {
+
+        
+        final Stylesheet stylesheet = new Stylesheet();
+        stylesheet.setOrigin(Stylesheet.Origin.USER_AGENT);
+        StyleManager.setDefaultUserAgentStylesheet(stylesheet);
+        
+        final List<Rule> rules = stylesheet.getRules();
+        
+        //
+        // .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 = CSSParser.getInstance().parseExpr("-fx-base", "red");
+        Declaration fxBase = new Declaration("-fx-base", fxBaseValue, false);
+
+        ParsedValue<String,String> fxColorValue = new ParsedValue<String,String>(fxBase.getProperty(), null, true);
+        Declaration fxColor = new Declaration("-fx-color", fxColorValue, false);
+
+        ParsedValue<Color,Color> fxFillShouldNotMatchValue = new ParsedValue<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 = CSSParser.getInstance().parseExpr("-fx-fill", "-fx-color");
@@ -617,54 +839,47 @@
         Rule rectHoverRule = new Rule(selectors, declarations);
         rules.add(rectHoverRule);
                 
-        final Group group = createGroup(
-            createCascadingStyle(root, fxBase), 
-            createCascadingStyle(root, fxColor)
-        );
-        group.setStyle("-fx-base: green;");
-        
-        final Rectangle rectangle = createRectangle(
-            createCascadingStyle(rect, fxFill), 
-            createCascadingStyle(rectHover, fxFillHover)                
-        );
-        
         List<Style> expecteds = new ArrayList<Style>();
         Collections.addAll(expecteds, 
-                new Style(SimpleSelector.getUniversalSelector(), 
-                          new Declaration("-fx-base", new ParsedValue<Color,Color>(Color.GREEN, null), false)), 
                 new Style(root, fxBase),
                 new Style(root, fxColor), 
                 new Style(rect, fxFill),
                 new Style(rectHover, fxFillHover)
         );
         
+        final Rectangle rectangle = new Rectangle();
+        rectangle.getStyleClass().add("rect");
+        
+        final Group group = new Group();
         group.getChildren().add(rectangle);        
-        group.impl_processCSS(true);
-        
+
+        Scene scene = new Scene(group);
+        Stage stage = new Stage();
+        stage.setScene(scene);
+        stage.show();
+                
         final StyleableProperty FILL = get(StyleableProperty.getStyleables(rectangle), "-fx-fill");
         final List<Style> actuals = FILL.getMatchingStyles(rectangle);
 
-//        System.out.println("matchingStyles: " + matchingStyles);
-//        System.out.println("expecteds: " + expecteds);
-//        System.out.println("actuals: " + actuals);
-        
+//        System.err.println("matchingStyles: " + matchingStyles);
+//        System.err.println("expecteds: " + expecteds);
+//        System.err.println("actuals: " + actuals);
+
         assertEquals(expecteds.size(), actuals.size(), 0);
-        
-        // inline style should be first
-        assertEquals(expecteds.get(0), actuals.get(0));
-        
+                
         for (Style style : expecteds) {
             if (!actuals.remove(style)) fail();
         }
         assertTrue(actuals.isEmpty());
-    }
+    } 
 
-    @Test @org.junit.Ignore
-    public void testGetMatchingStylesWithInlineStyleOnLeaf() {
 
+    @Test
+    public void testGetMatchingStylesShouldNotReturnInlineAncestorPropertyIfNotInherited() {
         
         final Stylesheet stylesheet = new Stylesheet();
         stylesheet.setOrigin(Stylesheet.Origin.USER_AGENT);
+        StyleManager.setDefaultUserAgentStylesheet(stylesheet);
         
         final List<Rule> rules = stylesheet.getRules();
         
@@ -672,234 +887,7 @@
         rootStyleClass.add("root");
         
         List<String> rectStyleClass = new ArrayList<String>();
-        rootStyleClass.add("rect");
-        
-        //
-        // .root { -fx-base: red; -fx-color: -fx-base; }
-        //
-        Selector root = new SimpleSelector("*", rootStyleClass, null, null);
-        
-        ParsedValue fxBaseValue = CSSParser.getInstance().parseExpr("-fx-base", "red");
-        Declaration fxBase = new Declaration("-fx-base", fxBaseValue, false);
-
-        ParsedValue<String,String> fxColorValue = new ParsedValue<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; }
-        //
-        Selector rect = new SimpleSelector("*", rectStyleClass, null, null);
-        
-        ParsedValue fxFillValue = CSSParser.getInstance().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);
-        
-        ParsedValue<Color,Color> fxFillHoverValue = new ParsedValue<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);
-                
-        final Group group = createGroup(
-            createCascadingStyle(root, fxBase), 
-            createCascadingStyle(root, fxColor)
-        );
-        
-        final Rectangle rectangle = createRectangle(
-            createCascadingStyle(rect, fxFill), 
-            createCascadingStyle(rectHover, fxFillHover)                
-        );
-        rectangle.setStyle("-fx-base: green;");
-        
-        List<Style> expecteds = new ArrayList<Style>();
-        Collections.addAll(expecteds, 
-                new Style(SimpleSelector.getUniversalSelector(), 
-                          new Declaration("-fx-base", new ParsedValue<Color,Color>(Color.GREEN, null), false)), 
-                new Style(root, fxBase),
-                new Style(root, fxColor), 
-                new Style(rect, fxFill),
-                new Style(rectHover, fxFillHover)
-        );
-        
-        group.getChildren().add(rectangle);        
-        group.impl_processCSS(true);
-        
-        final StyleableProperty FILL = get(StyleableProperty.getStyleables(rectangle), "-fx-fill");
-        final List<Style> actuals = FILL.getMatchingStyles(rectangle);
-
-//        System.out.println("matchingStyles: " + matchingStyles);
-//        System.out.println("expecteds: " + expecteds);
-//        System.out.println("actuals: " + actuals);
-
-        assertEquals(expecteds.size(), actuals.size(), 0);
-        
-        // inline style should be first
-        assertEquals(expecteds.get(0), actuals.get(0));
-        
-        for (Style style : expecteds) {
-            if (!actuals.remove(style)) fail();
-        }
-        assertTrue(actuals.isEmpty());
-    }   
-    
-    @Test  @org.junit.Ignore
-    public void testGetMatchingStylesWithInlineStyleOnRootAndLeaf() {
-
-        
-        final Stylesheet stylesheet = new Stylesheet();
-        stylesheet.setOrigin(Stylesheet.Origin.USER_AGENT);
-        
-        final List<Rule> rules = stylesheet.getRules();
-        
-        List<String> rootStyleClass = new ArrayList<String>();
-        rootStyleClass.add("root");
-        
-        List<String> rectStyleClass = new ArrayList<String>();
-        rootStyleClass.add("rect");
-        
-        //
-        // .root { -fx-base: red; -fx-color: -fx-base; }
-        //
-        Selector root = new SimpleSelector("*", rootStyleClass, null, null);
-        
-        ParsedValue fxBaseValue = CSSParser.getInstance().parseExpr("-fx-base", "red");
-        Declaration fxBase = new Declaration("-fx-base", fxBaseValue, false);
-
-        ParsedValue<String,String> fxColorValue = new ParsedValue<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; }
-        //
-        Selector rect = new SimpleSelector("*", rectStyleClass, null, null);
-        
-        ParsedValue fxFillValue = CSSParser.getInstance().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);
-        
-        ParsedValue<Color,Color> fxFillHoverValue = new ParsedValue<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);
-                
-        final Group group = createGroup(
-            createCascadingStyle(root, fxBase), 
-            createCascadingStyle(root, fxColor)
-        );
-        group.setStyle("-fx-color: yellow;");
-        
-        final Rectangle rectangle = createRectangle(
-            createCascadingStyle(rect, fxFill), 
-            createCascadingStyle(rectHover, fxFillHover)                
-        );
-        rectangle.setStyle("-fx-base: green;");
-        
-        List<Style> expecteds = new ArrayList<Style>();
-        Collections.addAll(expecteds, 
-                new Style(SimpleSelector.getUniversalSelector(), 
-                          new Declaration("-fx-color", new ParsedValue<Color,Color>(Color.YELLOW, null), false)), 
-                new Style(SimpleSelector.getUniversalSelector(), 
-                          new Declaration("-fx-base", new ParsedValue<Color,Color>(Color.GREEN, null), false)), 
-                new Style(root, fxBase),
-                new Style(root, fxColor), 
-                new Style(rect, fxFill),
-                new Style(rectHover, fxFillHover)
-        );
-        
-        group.getChildren().add(rectangle);        
-        group.impl_processCSS(true);
-        
-        final StyleableProperty FILL = get(StyleableProperty.getStyleables(rectangle), "-fx-fill");
-        final List<Style> actuals = FILL.getMatchingStyles(rectangle);
-
-//        System.out.println("matchingStyles: " + matchingStyles);
-//        System.out.println("expecteds: " + expecteds);
-//        System.out.println("actuals: " + actuals);
-
-        assertEquals(expecteds.size(), actuals.size(), 0);
-        
-        // inline style should be first
-        assertEquals(expecteds.get(0), actuals.get(0));
-        
-        for (Style style : expecteds) {
-            if (!actuals.remove(style)) fail();
-        }
-        assertTrue(actuals.isEmpty());
-    } 
-
-    @Test  @org.junit.Ignore
-    public void testGetMatchingStylesShouldNotReturnAncestorPropertyIfNotInherited() {
-
-        
-        final Stylesheet stylesheet = new Stylesheet();
-        stylesheet.setOrigin(Stylesheet.Origin.USER_AGENT);
-        
-        final List<Rule> rules = stylesheet.getRules();
-        
-        List<String> rootStyleClass = new ArrayList<String>();
-        rootStyleClass.add("root");
-        
-        List<String> rectStyleClass = new ArrayList<String>();
-        rootStyleClass.add("rect");
+        rectStyleClass.add("rect");
         
         //
         // .root { -fx-base: red; -fx-color: -fx-base; }
@@ -959,17 +947,6 @@
         Rule rectHoverRule = new Rule(selectors, declarations);
         rules.add(rectHoverRule);
                 
-        final Group group = createGroup(
-            createCascadingStyle(root, fxBase), 
-            createCascadingStyle(root, fxColor),
-            createCascadingStyle(root, fxFillShouldNotMatch)
-        );
-        
-        final Rectangle rectangle = createRectangle(
-            createCascadingStyle(rect, fxFill), 
-            createCascadingStyle(rectHover, fxFillHover)                
-        );
-        
         List<Style> expecteds = new ArrayList<Style>();
         Collections.addAll(expecteds, 
                 new Style(root, fxBase),
@@ -978,126 +955,23 @@
                 new Style(rectHover, fxFillHover)
         );
         
+        final Rectangle rectangle = new Rectangle();
+        rectangle.getStyleClass().add("rect");
+        
+        final Group group = new Group();
         group.getChildren().add(rectangle);        
-        group.impl_processCSS(true);
         
+        Scene scene = new Scene(group);
+        Stage stage = new Stage();
+        stage.setScene(scene);
+        stage.show();
+                
         final StyleableProperty FILL = get(StyleableProperty.getStyleables(rectangle), "-fx-fill");
         final List<Style> actuals = FILL.getMatchingStyles(rectangle);
 
-//        System.out.println("matchingStyles: " + matchingStyles);
-//        System.out.println("expecteds: " + expecteds);
-//        System.out.println("actuals: " + actuals);
-
-        assertEquals(expecteds.size(), actuals.size(), 0);
-                
-        for (Style style : expecteds) {
-            if (!actuals.remove(style)) fail();
-        }
-        assertTrue(actuals.isEmpty());
-    } 
-
-
-    @Test @org.junit.Ignore("uses createGroup which, in turn, relies on a method that is no longer available")
-    public void testGetMatchingStylesShouldNotReturnInlineAncestorPropertyIfNotInherited() {
-
-        
-        final Stylesheet stylesheet = new Stylesheet();
-        stylesheet.setOrigin(Stylesheet.Origin.USER_AGENT);
-        
-        final List<Rule> rules = stylesheet.getRules();
-        
-        List<String> rootStyleClass = new ArrayList<String>();
-        rootStyleClass.add("root");
-        
-        List<String> rectStyleClass = new ArrayList<String>();
-        rootStyleClass.add("rect");
-        
-        //
-        // .root { -fx-base: red; -fx-color: -fx-base; }
-        //
-        Selector root = new SimpleSelector("*", rootStyleClass, null, null);
-        
-        ParsedValue fxBaseValue = CSSParser.getInstance().parseExpr("-fx-base", "red");
-        Declaration fxBase = new Declaration("-fx-base", fxBaseValue, false);
-
-        ParsedValue<String,String> fxColorValue = new ParsedValue<String,String>(fxBase.getProperty(), null, true);
-        Declaration fxColor = new Declaration("-fx-color", fxColorValue, false);
-
-        ParsedValue<Color,Color> fxFillShouldNotMatchValue = new ParsedValue<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 = CSSParser.getInstance().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);
-        
-        ParsedValue<Color,Color> fxFillHoverValue = new ParsedValue<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);
-                
-        final Group group = createGroup(
-            createCascadingStyle(root, fxBase), 
-            createCascadingStyle(root, fxColor)
-        );
-        group.setStyle("-fx-fill: black;");
-        
-        final Rectangle rectangle = createRectangle(
-            createCascadingStyle(rect, fxFill), 
-            createCascadingStyle(rectHover, fxFillHover)                
-        );
-        
-        List<Style> expecteds = new ArrayList<Style>();
-        Collections.addAll(expecteds, 
-                new Style(root, fxBase),
-                new Style(root, fxColor), 
-                new Style(rect, fxFill),
-                new Style(rectHover, fxFillHover)
-        );
-        
-        group.getChildren().add(rectangle);        
-        group.impl_processCSS(true);
-        
-        final StyleableProperty FILL = get(StyleableProperty.getStyleables(rectangle), "-fx-fill");
-        final List<Style> actuals = FILL.getMatchingStyles(rectangle);
-
-//        System.out.println("matchingStyles: " + matchingStyles);
-//        System.out.println("expecteds: " + expecteds);
-//        System.out.println("actuals: " + actuals);
+//        System.err.println("matchingStyles: " + matchingStyles);
+//        System.err.println("expecteds: " + expecteds);
+//        System.err.println("actuals: " + actuals);
                 
         for (Style style : expecteds) {
             actuals.remove(style);
@@ -1105,24 +979,22 @@
         assertTrue(actuals.toString(), actuals.isEmpty());
     }    
     
-    @Test @org.junit.Ignore
+    @Test
     public void testGetMatchingStylesReturnsInheritedProperty() {
 
-        
+
         final Stylesheet stylesheet = new Stylesheet();
         stylesheet.setOrigin(Stylesheet.Origin.USER_AGENT);
+        StyleManager.setDefaultUserAgentStylesheet(stylesheet);
         
         final List<Rule> rules = stylesheet.getRules();
         
-        List<String> rootStyleClass = new ArrayList<String>();
-        rootStyleClass.add("root");
-        
-        List<String> rectStyleClass = new ArrayList<String>();
-        rectStyleClass.add("rect");
-        
         //
         // .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 = CSSParser.getInstance().parseExpr("-fx-font", "12px system");       
@@ -1138,15 +1010,18 @@
         rules.add(baseRule);
         
         //
-        // .rect { -fx-fill: -fx-color; }
+        // .text { -fx-fill: -fx-color; }
         //
-        Selector rect = new SimpleSelector("*", rectStyleClass, null, null);
+        List<String> textStyleClass = new ArrayList<String>();
+        textStyleClass.add("text");
+        
+        Selector textSelector = new SimpleSelector("*", textStyleClass, null, null);
         
         ParsedValue fxFillValue = CSSParser.getInstance().parseExpr("-fx-fill", "red");
         Declaration fxFill = new Declaration("-fx-fill", fxFillValue, false);
         
         selectors = new ArrayList<Selector>();
-        Collections.addAll(selectors, rect); 
+        Collections.addAll(selectors, textSelector); 
         
         declarations = new ArrayList<Declaration>(); 
         Collections.addAll(declarations, fxFill);
@@ -1154,28 +1029,28 @@
         Rule rectRule = new Rule(selectors, declarations);
         rules.add(rectRule);
                
-        final Group group = createGroup(
-            createCascadingStyle(root, fxFontShouldInherit)
-        );
-        
-        final RectangleWithFont rectangle  = new RectangleWithFont(
-            createCascadingStyle(rect, fxFill) 
-        );
-        
         List<Style> expecteds = new ArrayList<Style>();
         Collections.addAll(expecteds, 
                 new Style(root, fxFontShouldInherit)
         );
         
-        group.getChildren().add(rectangle);        
-        group.impl_processCSS(true);
+        final Text text = new Text("text");
+        text.getStyleClass().add("text");
         
-        final StyleableProperty FONT = get(StyleableProperty.getStyleables(rectangle), "-fx-font");
-        final List<Style> actuals = FONT.getMatchingStyles(rectangle);
+        final Group group = new Group();
+        group.getChildren().add(text);        
+        
+        Scene scene = new Scene(group);
+        Stage stage = new Stage();
+        stage.setScene(scene);
+        stage.show();
+                
+        final StyleableProperty FONT = get(StyleableProperty.getStyleables(text), "-fx-font");
+        final List<Style> actuals = FONT.getMatchingStyles(text);
 
-//        System.out.println("matchingStyles: " + matchingStyles);
-//        System.out.println("expecteds: " + expecteds);
-//        System.out.println("actuals: " + actuals);
+//        System.err.println("matchingStyles: " + matchingStyles);
+//        System.err.println("expecteds: " + expecteds);
+//        System.err.println("actuals: " + actuals);
 
         assertEquals(expecteds.size(), actuals.size(), 0);
                 
@@ -1185,24 +1060,21 @@
         assertTrue(actuals.isEmpty());
     }
     
-    @Test @org.junit.Ignore
+    @Test
     public void testGetMatchingStylesReturnsSubProperty() {
 
-        
         final Stylesheet stylesheet = new Stylesheet();
         stylesheet.setOrigin(Stylesheet.Origin.USER_AGENT);
-        
+        StyleManager.setDefaultUserAgentStylesheet(stylesheet);        
+                
         final List<Rule> rules = stylesheet.getRules();
         
-        List<String> rootStyleClass = new ArrayList<String>();
-        rootStyleClass.add("root");
-        
-        List<String> rectStyleClass = new ArrayList<String>();
-        rectStyleClass.add("rect");
-        
         //
         // .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 = CSSParser.getInstance().parseExpr("-fx-font", "12px system");       
@@ -1218,9 +1090,12 @@
         rules.add(baseRule);
         
         //
-        // .rect { -fx-fill: -fx-color; }
+        // .text { -fx-fill: -fx-color; }
         //
-        Selector rect = new SimpleSelector("*", rectStyleClass, null, null);
+        List<String> rectStyleClass = new ArrayList<String>();
+        rectStyleClass.add("text");
+        
+        Selector textSelector = new SimpleSelector("*", rectStyleClass, null, null);
         
         ParsedValue fxFillValue = CSSParser.getInstance().parseExpr("-fx-fill", "red");
         Declaration fxFill = new Declaration("-fx-fill", fxFillValue, false);
@@ -1229,38 +1104,37 @@
         Declaration fxFontFamily = new Declaration("-fx-font-family", fxFontFamilyValue, false);
         
         selectors = new ArrayList<Selector>();
-        Collections.addAll(selectors, rect); 
+        Collections.addAll(selectors, textSelector); 
         
         declarations = new ArrayList<Declaration>(); 
         Collections.addAll(declarations, fxFill, fxFontFamily);
         
         Rule rectRule = new Rule(selectors, declarations);
         rules.add(rectRule);
-               
-        final Group group = createGroup(
-            createCascadingStyle(root, fxFontShouldInherit)
-        );
-        
-        final RectangleWithFont rectangle  = new RectangleWithFont(
-            createCascadingStyle(rect, fxFill),
-            createCascadingStyle(rect, fxFontFamily)
-        );
-        
+
         List<Style> expecteds = new ArrayList<Style>();
         Collections.addAll(expecteds, 
-                new Style(rect, fxFontFamily),
+                new Style(textSelector, fxFontFamily),
                 new Style(root, fxFontShouldInherit)
         );
         
-        group.getChildren().add(rectangle);        
-        group.impl_processCSS(true);
+        final Text text  = new Text();
+        text.getStyleClass().add("text");
         
-        final StyleableProperty FONT = get(StyleableProperty.getStyleables(rectangle), "-fx-font");
-        final List<Style> actuals = FONT.getMatchingStyles(rectangle);
+        final Group group = new Group();
+        group.getChildren().add(text);        
 
-//        System.out.println("matchingStyles: " + matchingStyles);
-//        System.out.println("expecteds: " + expecteds);
-//        System.out.println("actuals: " + actuals);
+        Scene scene = new Scene(group);
+        Stage stage = new Stage();
+        stage.setScene(scene);
+        stage.show();
+                        
+        final StyleableProperty FONT = get(StyleableProperty.getStyleables(text), "-fx-font");
+        final List<Style> actuals = FONT.getMatchingStyles(text);
+
+//        System.err.println("matchingStyles: " + matchingStyles);
+//        System.err.println("expecteds: " + expecteds);
+//        System.err.println("actuals: " + actuals);
 
         assertEquals(expecteds.size(), actuals.size(), 0);
                 
@@ -1276,7 +1150,7 @@
             ClassLoader cl = Thread.currentThread().getContextClassLoader();
             URL base = cl.getResource("javafx/..");
             File f = new File(base.toURI());
-            System.out.println(f.getPath());
+//            System.err.println(f.getPath());
             recursiveCheck(f, f.getPath().length());
         } catch (Exception ex) {
             ex.printStackTrace(System.err);
@@ -1356,7 +1230,7 @@
 
     private static void recursiveCheck(File directory, int pathLength) {
         if (directory.isDirectory()) {
-//            System.out.println(directory.getPath());
+//            System.err.println(directory.getPath());
             checkDirectory(directory, pathLength);
 
             for (File subFile : directory.listFiles()) {
@@ -1367,7 +1241,7 @@
     
     @Test
     public void testRT_21185() {
-        
+
         Color c1 = new Color(.1,.2,.3,1.0);
         Color c2 = new Color(.1,.2,.3,1.0);
                 
@@ -1403,4 +1277,39 @@
         
     }
     
+    
+    @Test
+    public void testRT_24606() {
+
+        final Stylesheet stylesheet = CSSParser.getInstance().parse(
+                ".root { -fx-base: red; }" +
+                ".group { -fx-color: -fx-base; }" +
+                ".text { -fx-fill: -fx-color; }" 
+        );
+        stylesheet.setOrigin(Stylesheet.Origin.USER_AGENT);
+        StyleManager.setDefaultUserAgentStylesheet(stylesheet);        
+       
+        final Text text = new Text("HelloWorld");
+        text.getStyleClass().add("text");
+        text.setFill(Color.BLUE);
+        
+        final Group group = new Group();
+        group.getStyleClass().add("group");
+        group.getChildren().add(text);
+
+        final Group root = new Group();
+        root.getChildren().add(group);
+        
+        Scene scene = new Scene(root);
+        Stage stage = new Stage();
+        stage.setScene(scene);
+        stage.show();
+
+        StyleableProperty prop = StyleableProperty.getStyleableProperty(text.fillProperty());
+        List list = prop.getMatchingStyles(text);
+        
+        assertEquals(3, list.size(), 0);
+                
+    }    
+    
 }