< prev index next >

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

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


  44 import test.com.sun.javafx.css.TestNodeBase;
  45 import com.sun.javafx.sg.prism.NGNode;
  46 import javafx.beans.value.WritableValue;
  47 import javafx.scene.Group;
  48 import javafx.scene.Node;
  49 import javafx.scene.Scene;
  50 import javafx.scene.paint.Color;
  51 import javafx.scene.shape.Rectangle;
  52 import javafx.scene.text.Font;
  53 import javafx.scene.text.Text;
  54 import javafx.stage.Stage;
  55 import javafx.css.converter.BooleanConverter;
  56 import com.sun.javafx.geom.BaseBounds;
  57 import com.sun.javafx.geom.transform.BaseTransform;
  58 import com.sun.javafx.jmx.MXNodeAlgorithm;
  59 import com.sun.javafx.jmx.MXNodeAlgorithmContext;
  60 import com.sun.javafx.scene.NodeHelper;
  61 import javafx.css.CompoundSelector;
  62 import javafx.css.CssMetaData;
  63 import javafx.css.CssParser;

  64 import javafx.css.Declaration;
  65 import javafx.css.DeclarationShim;
  66 import javafx.css.FontCssMetaData;
  67 import javafx.css.ParsedValue;
  68 import javafx.css.PseudoClass;
  69 import javafx.css.Rule;
  70 import javafx.css.RuleShim;
  71 import javafx.css.Selector;
  72 import javafx.css.SelectorShim;
  73 import javafx.css.SimpleSelector;
  74 import javafx.css.SimpleSelectorShim;
  75 import javafx.css.Style;
  76 import javafx.css.StyleConverter;
  77 import javafx.css.StyleOrigin;
  78 import javafx.css.Styleable;
  79 import javafx.css.StyleableProperty;
  80 import javafx.css.Stylesheet;
  81 import javafx.css.StylesheetShim;
  82 import org.junit.Test;
  83 


 255     }
 256 
 257     @Test @org.junit.Ignore
 258     public void testGetMatchingStyles() {
 259 
 260 
 261         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
 262         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
 263         StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
 264 
 265         final List<Rule> rules = stylesheet.getRules();
 266 
 267         //
 268         // .root { -fx-base: red; -fx-color: -fx-base; }
 269         //
 270         List<String> rootStyleClass = new ArrayList<String>();
 271         rootStyleClass.add("root");
 272 
 273         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
 274 
 275         ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
 276         Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
 277 
 278         ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
 279         Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
 280 
 281         List<Selector> selectors = new ArrayList<Selector>();
 282         Collections.addAll(selectors, root);
 283 
 284         List<Declaration> declarations = new ArrayList<Declaration>();
 285         Collections.addAll(declarations, fxBase, fxColor);
 286 
 287         Rule baseRule = RuleShim.getRule(selectors, declarations);
 288         rules.add(baseRule);
 289 
 290         //
 291         // .rect { -fx-fill: -fx-color; }
 292         //
 293         List<String> rectStyleClass = new ArrayList<String>();
 294         rectStyleClass.add("rect");
 295 
 296         Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
 297 
 298         ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
 299         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
 300 
 301         selectors = new ArrayList<Selector>();
 302         Collections.addAll(selectors, rect);
 303 
 304         declarations = new ArrayList<Declaration>();
 305         Collections.addAll(declarations, fxFill);
 306 
 307         Rule rectRule = RuleShim.getRule(selectors, declarations);
 308         rules.add(rectRule);
 309 
 310         // .rect:hover { -fx-fill: yellow; }
 311         List<String> pseudoclasses = new ArrayList<String>();
 312         pseudoclasses.add("hover");
 313 
 314         Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
 315 
 316         ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
 317         Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
 318 


 360     }
 361 
 362     @Test @org.junit.Ignore
 363     public void testGetMatchingStylesWithInlineStyleOnParent() {
 364 
 365 
 366         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
 367         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
 368         StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
 369 
 370         final List<Rule> rules = stylesheet.getRules();
 371 
 372         //
 373         // .root { -fx-base: red; -fx-color: -fx-base; }
 374         //
 375         List<String> rootStyleClass = new ArrayList<String>();
 376         rootStyleClass.add("root");
 377 
 378         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
 379 
 380         ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
 381         Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
 382 
 383         ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
 384         Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
 385 
 386         List<Selector> selectors = new ArrayList<Selector>();
 387         Collections.addAll(selectors, root);
 388 
 389         List<Declaration> declarations = new ArrayList<Declaration>();
 390         Collections.addAll(declarations, fxBase, fxColor);
 391 
 392         Rule baseRule = RuleShim.getRule(selectors, declarations);
 393         rules.add(baseRule);
 394 
 395         //
 396         // .rect { -fx-fill: -fx-color; }
 397         //
 398         List<String> rectStyleClass = new ArrayList<String>();
 399         rectStyleClass.add("rect");
 400 
 401         Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
 402 
 403         ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
 404         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
 405 
 406         selectors = new ArrayList<Selector>();
 407         Collections.addAll(selectors, rect);
 408 
 409         declarations = new ArrayList<Declaration>();
 410         Collections.addAll(declarations, fxFill);
 411 
 412         Rule rectRule = RuleShim.getRule(selectors, declarations);
 413         rules.add(rectRule);
 414 
 415         // .rect:hover { -fx-fill: yellow; }
 416         List<String> pseudoclasses = new ArrayList<String>();
 417         pseudoclasses.add("hover");
 418 
 419         Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
 420 
 421         ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
 422         Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
 423 


 483     }
 484 
 485     @Test @org.junit.Ignore
 486     public void testGetMatchingStylesWithInlineStyleOnLeaf() {
 487 
 488 
 489         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
 490         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
 491         StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
 492 
 493         final List<Rule> rules = stylesheet.getRules();
 494 
 495         //
 496         // .root { -fx-base: red; -fx-color: -fx-base; }
 497         //
 498         List<String> rootStyleClass = new ArrayList<String>();
 499         rootStyleClass.add("root");
 500 
 501         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
 502 
 503         ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
 504         Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
 505 
 506         ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
 507         Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
 508 
 509         List<Selector> selectors = new ArrayList<Selector>();
 510         Collections.addAll(selectors, root);
 511 
 512         List<Declaration> declarations = new ArrayList<Declaration>();
 513         Collections.addAll(declarations, fxBase, fxColor);
 514 
 515         Rule baseRule = RuleShim.getRule(selectors, declarations);
 516         rules.add(baseRule);
 517 
 518         //
 519         // .rect { -fx-fill: -fx-color; }
 520         //
 521         List<String> rectStyleClass = new ArrayList<String>();
 522         rectStyleClass.add("rect");
 523 
 524         Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
 525 
 526         ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
 527         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
 528 
 529         selectors = new ArrayList<Selector>();
 530         Collections.addAll(selectors, rect);
 531 
 532         declarations = new ArrayList<Declaration>();
 533         Collections.addAll(declarations, fxFill);
 534 
 535         Rule rectRule = RuleShim.getRule(selectors, declarations);
 536         rules.add(rectRule);
 537 
 538         // .rect:hover { -fx-fill: yellow; }
 539         List<String> pseudoclasses = new ArrayList<String>();
 540         pseudoclasses.add("hover");
 541 
 542         Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
 543 
 544         ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
 545         Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
 546 


 606     }
 607 
 608     @Test @org.junit.Ignore
 609     public void testGetMatchingStylesWithInlineStyleOnRootAndLeaf() {
 610 
 611 
 612         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
 613         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
 614         StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
 615 
 616         final List<Rule> rules = stylesheet.getRules();
 617 
 618         //
 619         // .root { -fx-base: red; -fx-color: -fx-base; }
 620         //
 621         List<String> rootStyleClass = new ArrayList<String>();
 622         rootStyleClass.add("root");
 623 
 624         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
 625 
 626         ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
 627         Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
 628 
 629         ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
 630         Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
 631 
 632         List<Selector> selectors = new ArrayList<Selector>();
 633         Collections.addAll(selectors, root);
 634 
 635         List<Declaration> declarations = new ArrayList<Declaration>();
 636         Collections.addAll(declarations, fxBase, fxColor);
 637 
 638         Rule baseRule = RuleShim.getRule(selectors, declarations);
 639         rules.add(baseRule);
 640 
 641         //
 642         // .rect { -fx-fill: -fx-color; }
 643         //
 644         List<String> rectStyleClass = new ArrayList<String>();
 645         rectStyleClass.add("rect");
 646 
 647         Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
 648 
 649         ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
 650         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
 651 
 652         selectors = new ArrayList<Selector>();
 653         Collections.addAll(selectors, rect);
 654 
 655         declarations = new ArrayList<Declaration>();
 656         Collections.addAll(declarations, fxFill);
 657 
 658         Rule rectRule = RuleShim.getRule(selectors, declarations);
 659         rules.add(rectRule);
 660 
 661         // .rect:hover { -fx-fill: yellow; }
 662         List<String> pseudoclasses = new ArrayList<String>();
 663         pseudoclasses.add("hover");
 664 
 665         Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
 666 
 667         ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
 668         Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
 669 


 733     }
 734 
 735     @Test @org.junit.Ignore
 736     public void testGetMatchingStylesShouldNotReturnAncestorPropertyIfNotInherited() {
 737 
 738 
 739         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
 740         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
 741         StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
 742 
 743         final List<Rule> rules = stylesheet.getRules();
 744 
 745         //
 746         // .root { -fx-base: red; -fx-color: -fx-base; }
 747         //
 748         List<String> rootStyleClass = new ArrayList<String>();
 749         rootStyleClass.add("root");
 750 
 751         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
 752 
 753         ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
 754         Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
 755 
 756         ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
 757         Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
 758 
 759         ParsedValueImpl<Color,Color> fxFillShouldNotMatchValue = new ParsedValueImpl<Color,Color>(Color.RED, null);
 760         Declaration fxFillShouldNotMatch = DeclarationShim.getDeclaration("-fx-fill", fxFillShouldNotMatchValue, false);
 761 
 762         List<Selector> selectors = new ArrayList<Selector>();
 763         Collections.addAll(selectors, root);
 764 
 765         List<Declaration> declarations = new ArrayList<Declaration>();
 766         Collections.addAll(declarations, fxBase, fxColor, fxFillShouldNotMatch);
 767 
 768         Rule baseRule = RuleShim.getRule(selectors, declarations);
 769         rules.add(baseRule);
 770 
 771         //
 772         // .rect { -fx-fill: -fx-color; }
 773         //
 774         List<String> rectStyleClass = new ArrayList<String>();
 775         rectStyleClass.add("rect");
 776 
 777         Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
 778 
 779         ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
 780         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
 781 
 782         selectors = new ArrayList<Selector>();
 783         Collections.addAll(selectors, rect);
 784 
 785         declarations = new ArrayList<Declaration>();
 786         Collections.addAll(declarations, fxFill);
 787 
 788         Rule rectRule = RuleShim.getRule(selectors, declarations);
 789         rules.add(rectRule);
 790 
 791         // .rect:hover { -fx-fill: yellow; }
 792         List<String> pseudoclasses = new ArrayList<String>();
 793         pseudoclasses.add("hover");
 794 
 795         Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
 796 
 797         ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
 798         Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
 799 


 844     @Test @org.junit.Ignore
 845     public void testGetMatchingStylesShouldNotReturnInlineAncestorPropertyIfNotInherited() {
 846 
 847         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
 848         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
 849         StyleManager.getInstance().setDefaultUserAgentStylesheet(stylesheet);
 850 
 851         final List<Rule> rules = stylesheet.getRules();
 852 
 853         List<String> rootStyleClass = new ArrayList<String>();
 854         rootStyleClass.add("root");
 855 
 856         List<String> rectStyleClass = new ArrayList<String>();
 857         rectStyleClass.add("rect");
 858 
 859         //
 860         // .root { -fx-base: red; -fx-color: -fx-base; }
 861         //
 862         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
 863 
 864         ParsedValue fxBaseValue = new CssParser().parseExpr("-fx-base", "red");
 865         Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
 866 
 867         ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
 868         Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
 869 
 870         ParsedValueImpl<Color,Color> fxFillShouldNotMatchValue = new ParsedValueImpl<Color,Color>(Color.RED, null);
 871         Declaration fxFillShouldNotMatch = DeclarationShim.getDeclaration("-fx-fill", fxFillShouldNotMatchValue, false);
 872 
 873         List<Selector> selectors = new ArrayList<Selector>();
 874         Collections.addAll(selectors, root);
 875 
 876         List<Declaration> declarations = new ArrayList<Declaration>();
 877         Collections.addAll(declarations, fxBase, fxColor, fxFillShouldNotMatch);
 878 
 879         Rule baseRule = RuleShim.getRule(selectors, declarations);
 880         rules.add(baseRule);
 881 
 882         //
 883         // .rect { -fx-fill: -fx-color; }
 884         //
 885         Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
 886 
 887         ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "-fx-color");
 888         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
 889 
 890         selectors = new ArrayList<Selector>();
 891         Collections.addAll(selectors, rect);
 892 
 893         declarations = new ArrayList<Declaration>();
 894         Collections.addAll(declarations, fxFill);
 895 
 896         Rule rectRule = RuleShim.getRule(selectors, declarations);
 897         rules.add(rectRule);
 898 
 899         // .rect:hover { -fx-fill: yellow; }
 900         List<String> pseudoclasses = new ArrayList<String>();
 901         pseudoclasses.add("hover");
 902 
 903         Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
 904 
 905         ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
 906         Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
 907 


 947     }
 948 
 949     @Test @org.junit.Ignore
 950     public void testGetMatchingStylesReturnsInheritedProperty() {
 951 
 952 
 953         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
 954         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
 955         StyleManager.getInstance().setDefaultUserAgentStylesheet(stylesheet);
 956 
 957         final List<Rule> rules = stylesheet.getRules();
 958 
 959         //
 960         // .root { -fx-base: red; -fx-color: -fx-base; }
 961         //
 962         List<String> rootStyleClass = new ArrayList<String>();
 963         rootStyleClass.add("root");
 964 
 965         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
 966 
 967         ParsedValue<Color,Color> fxFontShouldInheritValue = new CssParser().parseExpr("-fx-font", "12px system");
 968         Declaration fxFontShouldInherit = DeclarationShim.getDeclaration("-fx-font", fxFontShouldInheritValue, false);
 969 
 970         List<Selector> selectors = new ArrayList<Selector>();
 971         Collections.addAll(selectors, root);
 972 
 973         List<Declaration> declarations = new ArrayList<Declaration>();
 974         Collections.addAll(declarations, fxFontShouldInherit);
 975 
 976         Rule baseRule = RuleShim.getRule(selectors, declarations);
 977         rules.add(baseRule);
 978 
 979         //
 980         // .text { -fx-fill: -fx-color; }
 981         //
 982         List<String> textStyleClass = new ArrayList<String>();
 983         textStyleClass.add("text");
 984 
 985         Selector textSelector = SimpleSelectorShim.getSimpleSelector("*", textStyleClass, null, null);
 986 
 987         ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "red");
 988         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
 989 
 990         selectors = new ArrayList<Selector>();
 991         Collections.addAll(selectors, textSelector);
 992 
 993         declarations = new ArrayList<Declaration>();
 994         Collections.addAll(declarations, fxFill);
 995 
 996         Rule rectRule = RuleShim.getRule(selectors, declarations);
 997         rules.add(rectRule);
 998 
 999         List<Style> expecteds = new ArrayList<Style>();
1000         Collections.addAll(expecteds,
1001                            new Style(root, fxFontShouldInherit)
1002         );
1003 
1004         final Text text = new Text("text");
1005         text.getStyleClass().add("text");
1006 
1007         final Group group = new Group();


1027         assertTrue(actuals.isEmpty());
1028     }
1029 
1030     @Test @org.junit.Ignore
1031     public void testGetMatchingStylesReturnsSubProperty() {
1032 
1033         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
1034         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
1035         StyleManager.getInstance().setDefaultUserAgentStylesheet(stylesheet);
1036 
1037         final List<Rule> rules = stylesheet.getRules();
1038 
1039         //
1040         // .root { -fx-base: red; -fx-color: -fx-base; }
1041         //
1042         List<String> rootStyleClass = new ArrayList<String>();
1043         rootStyleClass.add("root");
1044 
1045         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
1046 
1047         ParsedValue<Color,Color> fxFontShouldInheritValue = new CssParser().parseExpr("-fx-font", "12px system");
1048         Declaration fxFontShouldInherit = DeclarationShim.getDeclaration("-fx-font", fxFontShouldInheritValue, false);
1049 
1050         List<Selector> selectors = new ArrayList<Selector>();
1051         Collections.addAll(selectors, root);
1052 
1053         List<Declaration> declarations = new ArrayList<Declaration>();
1054         Collections.addAll(declarations, fxFontShouldInherit);
1055 
1056         Rule baseRule = RuleShim.getRule(selectors, declarations);
1057         rules.add(baseRule);
1058 
1059         //
1060         // .text { -fx-fill: -fx-color; }
1061         //
1062         List<String> rectStyleClass = new ArrayList<String>();
1063         rectStyleClass.add("text");
1064 
1065         Selector textSelector = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
1066 
1067         ParsedValue fxFillValue = new CssParser().parseExpr("-fx-fill", "red");
1068         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
1069 
1070         ParsedValue fxFontFamilyValue = new CssParser().parseExpr("-fx-font-family", "arial");
1071         Declaration fxFontFamily = DeclarationShim.getDeclaration("-fx-font-family", fxFontFamilyValue, false);
1072 
1073         selectors = new ArrayList<Selector>();
1074         Collections.addAll(selectors, textSelector);
1075 
1076         declarations = new ArrayList<Declaration>();
1077         Collections.addAll(declarations, fxFill, fxFontFamily);
1078 
1079         Rule rectRule = RuleShim.getRule(selectors, declarations);
1080         rules.add(rectRule);
1081 
1082         List<Style> expecteds = new ArrayList<Style>();
1083         Collections.addAll(expecteds,
1084                            new Style(textSelector, fxFontFamily),
1085                            new Style(root, fxFontShouldInherit)
1086         );
1087 
1088         final Text text  = new Text();
1089         text.getStyleClass().add("text");
1090 




  44 import test.com.sun.javafx.css.TestNodeBase;
  45 import com.sun.javafx.sg.prism.NGNode;
  46 import javafx.beans.value.WritableValue;
  47 import javafx.scene.Group;
  48 import javafx.scene.Node;
  49 import javafx.scene.Scene;
  50 import javafx.scene.paint.Color;
  51 import javafx.scene.shape.Rectangle;
  52 import javafx.scene.text.Font;
  53 import javafx.scene.text.Text;
  54 import javafx.stage.Stage;
  55 import javafx.css.converter.BooleanConverter;
  56 import com.sun.javafx.geom.BaseBounds;
  57 import com.sun.javafx.geom.transform.BaseTransform;
  58 import com.sun.javafx.jmx.MXNodeAlgorithm;
  59 import com.sun.javafx.jmx.MXNodeAlgorithmContext;
  60 import com.sun.javafx.scene.NodeHelper;
  61 import javafx.css.CompoundSelector;
  62 import javafx.css.CssMetaData;
  63 import javafx.css.CssParser;
  64 import javafx.css.CssParserShim;
  65 import javafx.css.Declaration;
  66 import javafx.css.DeclarationShim;
  67 import javafx.css.FontCssMetaData;
  68 import javafx.css.ParsedValue;
  69 import javafx.css.PseudoClass;
  70 import javafx.css.Rule;
  71 import javafx.css.RuleShim;
  72 import javafx.css.Selector;
  73 import javafx.css.SelectorShim;
  74 import javafx.css.SimpleSelector;
  75 import javafx.css.SimpleSelectorShim;
  76 import javafx.css.Style;
  77 import javafx.css.StyleConverter;
  78 import javafx.css.StyleOrigin;
  79 import javafx.css.Styleable;
  80 import javafx.css.StyleableProperty;
  81 import javafx.css.Stylesheet;
  82 import javafx.css.StylesheetShim;
  83 import org.junit.Test;
  84 


 256     }
 257 
 258     @Test @org.junit.Ignore
 259     public void testGetMatchingStyles() {
 260 
 261 
 262         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
 263         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
 264         StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
 265 
 266         final List<Rule> rules = stylesheet.getRules();
 267 
 268         //
 269         // .root { -fx-base: red; -fx-color: -fx-base; }
 270         //
 271         List<String> rootStyleClass = new ArrayList<String>();
 272         rootStyleClass.add("root");
 273 
 274         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
 275 
 276         ParsedValue fxBaseValue = new CssParserShim().parseExpr("-fx-base", "red");
 277         Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
 278 
 279         ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
 280         Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
 281 
 282         List<Selector> selectors = new ArrayList<Selector>();
 283         Collections.addAll(selectors, root);
 284 
 285         List<Declaration> declarations = new ArrayList<Declaration>();
 286         Collections.addAll(declarations, fxBase, fxColor);
 287 
 288         Rule baseRule = RuleShim.getRule(selectors, declarations);
 289         rules.add(baseRule);
 290 
 291         //
 292         // .rect { -fx-fill: -fx-color; }
 293         //
 294         List<String> rectStyleClass = new ArrayList<String>();
 295         rectStyleClass.add("rect");
 296 
 297         Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
 298 
 299         ParsedValue fxFillValue = new CssParserShim().parseExpr("-fx-fill", "-fx-color");
 300         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
 301 
 302         selectors = new ArrayList<Selector>();
 303         Collections.addAll(selectors, rect);
 304 
 305         declarations = new ArrayList<Declaration>();
 306         Collections.addAll(declarations, fxFill);
 307 
 308         Rule rectRule = RuleShim.getRule(selectors, declarations);
 309         rules.add(rectRule);
 310 
 311         // .rect:hover { -fx-fill: yellow; }
 312         List<String> pseudoclasses = new ArrayList<String>();
 313         pseudoclasses.add("hover");
 314 
 315         Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
 316 
 317         ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
 318         Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
 319 


 361     }
 362 
 363     @Test @org.junit.Ignore
 364     public void testGetMatchingStylesWithInlineStyleOnParent() {
 365 
 366 
 367         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
 368         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
 369         StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
 370 
 371         final List<Rule> rules = stylesheet.getRules();
 372 
 373         //
 374         // .root { -fx-base: red; -fx-color: -fx-base; }
 375         //
 376         List<String> rootStyleClass = new ArrayList<String>();
 377         rootStyleClass.add("root");
 378 
 379         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
 380 
 381         ParsedValue fxBaseValue = new CssParserShim().parseExpr("-fx-base", "red");
 382         Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
 383 
 384         ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
 385         Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
 386 
 387         List<Selector> selectors = new ArrayList<Selector>();
 388         Collections.addAll(selectors, root);
 389 
 390         List<Declaration> declarations = new ArrayList<Declaration>();
 391         Collections.addAll(declarations, fxBase, fxColor);
 392 
 393         Rule baseRule = RuleShim.getRule(selectors, declarations);
 394         rules.add(baseRule);
 395 
 396         //
 397         // .rect { -fx-fill: -fx-color; }
 398         //
 399         List<String> rectStyleClass = new ArrayList<String>();
 400         rectStyleClass.add("rect");
 401 
 402         Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
 403 
 404         ParsedValue fxFillValue = new CssParserShim().parseExpr("-fx-fill", "-fx-color");
 405         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
 406 
 407         selectors = new ArrayList<Selector>();
 408         Collections.addAll(selectors, rect);
 409 
 410         declarations = new ArrayList<Declaration>();
 411         Collections.addAll(declarations, fxFill);
 412 
 413         Rule rectRule = RuleShim.getRule(selectors, declarations);
 414         rules.add(rectRule);
 415 
 416         // .rect:hover { -fx-fill: yellow; }
 417         List<String> pseudoclasses = new ArrayList<String>();
 418         pseudoclasses.add("hover");
 419 
 420         Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
 421 
 422         ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
 423         Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
 424 


 484     }
 485 
 486     @Test @org.junit.Ignore
 487     public void testGetMatchingStylesWithInlineStyleOnLeaf() {
 488 
 489 
 490         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
 491         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
 492         StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
 493 
 494         final List<Rule> rules = stylesheet.getRules();
 495 
 496         //
 497         // .root { -fx-base: red; -fx-color: -fx-base; }
 498         //
 499         List<String> rootStyleClass = new ArrayList<String>();
 500         rootStyleClass.add("root");
 501 
 502         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
 503 
 504         ParsedValue fxBaseValue = new CssParserShim().parseExpr("-fx-base", "red");
 505         Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
 506 
 507         ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
 508         Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
 509 
 510         List<Selector> selectors = new ArrayList<Selector>();
 511         Collections.addAll(selectors, root);
 512 
 513         List<Declaration> declarations = new ArrayList<Declaration>();
 514         Collections.addAll(declarations, fxBase, fxColor);
 515 
 516         Rule baseRule = RuleShim.getRule(selectors, declarations);
 517         rules.add(baseRule);
 518 
 519         //
 520         // .rect { -fx-fill: -fx-color; }
 521         //
 522         List<String> rectStyleClass = new ArrayList<String>();
 523         rectStyleClass.add("rect");
 524 
 525         Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
 526 
 527         ParsedValue fxFillValue = new CssParserShim().parseExpr("-fx-fill", "-fx-color");
 528         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
 529 
 530         selectors = new ArrayList<Selector>();
 531         Collections.addAll(selectors, rect);
 532 
 533         declarations = new ArrayList<Declaration>();
 534         Collections.addAll(declarations, fxFill);
 535 
 536         Rule rectRule = RuleShim.getRule(selectors, declarations);
 537         rules.add(rectRule);
 538 
 539         // .rect:hover { -fx-fill: yellow; }
 540         List<String> pseudoclasses = new ArrayList<String>();
 541         pseudoclasses.add("hover");
 542 
 543         Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
 544 
 545         ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
 546         Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
 547 


 607     }
 608 
 609     @Test @org.junit.Ignore
 610     public void testGetMatchingStylesWithInlineStyleOnRootAndLeaf() {
 611 
 612 
 613         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
 614         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
 615         StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
 616 
 617         final List<Rule> rules = stylesheet.getRules();
 618 
 619         //
 620         // .root { -fx-base: red; -fx-color: -fx-base; }
 621         //
 622         List<String> rootStyleClass = new ArrayList<String>();
 623         rootStyleClass.add("root");
 624 
 625         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
 626 
 627         ParsedValue fxBaseValue = new CssParserShim().parseExpr("-fx-base", "red");
 628         Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
 629 
 630         ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
 631         Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
 632 
 633         List<Selector> selectors = new ArrayList<Selector>();
 634         Collections.addAll(selectors, root);
 635 
 636         List<Declaration> declarations = new ArrayList<Declaration>();
 637         Collections.addAll(declarations, fxBase, fxColor);
 638 
 639         Rule baseRule = RuleShim.getRule(selectors, declarations);
 640         rules.add(baseRule);
 641 
 642         //
 643         // .rect { -fx-fill: -fx-color; }
 644         //
 645         List<String> rectStyleClass = new ArrayList<String>();
 646         rectStyleClass.add("rect");
 647 
 648         Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
 649 
 650         ParsedValue fxFillValue = new CssParserShim().parseExpr("-fx-fill", "-fx-color");
 651         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
 652 
 653         selectors = new ArrayList<Selector>();
 654         Collections.addAll(selectors, rect);
 655 
 656         declarations = new ArrayList<Declaration>();
 657         Collections.addAll(declarations, fxFill);
 658 
 659         Rule rectRule = RuleShim.getRule(selectors, declarations);
 660         rules.add(rectRule);
 661 
 662         // .rect:hover { -fx-fill: yellow; }
 663         List<String> pseudoclasses = new ArrayList<String>();
 664         pseudoclasses.add("hover");
 665 
 666         Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
 667 
 668         ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
 669         Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
 670 


 734     }
 735 
 736     @Test @org.junit.Ignore
 737     public void testGetMatchingStylesShouldNotReturnAncestorPropertyIfNotInherited() {
 738 
 739 
 740         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
 741         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
 742         StyleManager.getInstance().getInstance().setDefaultUserAgentStylesheet(stylesheet);
 743 
 744         final List<Rule> rules = stylesheet.getRules();
 745 
 746         //
 747         // .root { -fx-base: red; -fx-color: -fx-base; }
 748         //
 749         List<String> rootStyleClass = new ArrayList<String>();
 750         rootStyleClass.add("root");
 751 
 752         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
 753 
 754         ParsedValue fxBaseValue = new CssParserShim().parseExpr("-fx-base", "red");
 755         Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
 756 
 757         ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
 758         Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
 759 
 760         ParsedValueImpl<Color,Color> fxFillShouldNotMatchValue = new ParsedValueImpl<Color,Color>(Color.RED, null);
 761         Declaration fxFillShouldNotMatch = DeclarationShim.getDeclaration("-fx-fill", fxFillShouldNotMatchValue, false);
 762 
 763         List<Selector> selectors = new ArrayList<Selector>();
 764         Collections.addAll(selectors, root);
 765 
 766         List<Declaration> declarations = new ArrayList<Declaration>();
 767         Collections.addAll(declarations, fxBase, fxColor, fxFillShouldNotMatch);
 768 
 769         Rule baseRule = RuleShim.getRule(selectors, declarations);
 770         rules.add(baseRule);
 771 
 772         //
 773         // .rect { -fx-fill: -fx-color; }
 774         //
 775         List<String> rectStyleClass = new ArrayList<String>();
 776         rectStyleClass.add("rect");
 777 
 778         Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
 779 
 780         ParsedValue fxFillValue = new CssParserShim().parseExpr("-fx-fill", "-fx-color");
 781         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
 782 
 783         selectors = new ArrayList<Selector>();
 784         Collections.addAll(selectors, rect);
 785 
 786         declarations = new ArrayList<Declaration>();
 787         Collections.addAll(declarations, fxFill);
 788 
 789         Rule rectRule = RuleShim.getRule(selectors, declarations);
 790         rules.add(rectRule);
 791 
 792         // .rect:hover { -fx-fill: yellow; }
 793         List<String> pseudoclasses = new ArrayList<String>();
 794         pseudoclasses.add("hover");
 795 
 796         Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
 797 
 798         ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
 799         Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
 800 


 845     @Test @org.junit.Ignore
 846     public void testGetMatchingStylesShouldNotReturnInlineAncestorPropertyIfNotInherited() {
 847 
 848         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
 849         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
 850         StyleManager.getInstance().setDefaultUserAgentStylesheet(stylesheet);
 851 
 852         final List<Rule> rules = stylesheet.getRules();
 853 
 854         List<String> rootStyleClass = new ArrayList<String>();
 855         rootStyleClass.add("root");
 856 
 857         List<String> rectStyleClass = new ArrayList<String>();
 858         rectStyleClass.add("rect");
 859 
 860         //
 861         // .root { -fx-base: red; -fx-color: -fx-base; }
 862         //
 863         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
 864 
 865         ParsedValue fxBaseValue = new CssParserShim().parseExpr("-fx-base", "red");
 866         Declaration fxBase = DeclarationShim.getDeclaration("-fx-base", fxBaseValue, false);
 867 
 868         ParsedValueImpl<String,String> fxColorValue = new ParsedValueImpl<String,String>(fxBase.getProperty(), null, true);
 869         Declaration fxColor = DeclarationShim.getDeclaration("-fx-color", fxColorValue, false);
 870 
 871         ParsedValueImpl<Color,Color> fxFillShouldNotMatchValue = new ParsedValueImpl<Color,Color>(Color.RED, null);
 872         Declaration fxFillShouldNotMatch = DeclarationShim.getDeclaration("-fx-fill", fxFillShouldNotMatchValue, false);
 873 
 874         List<Selector> selectors = new ArrayList<Selector>();
 875         Collections.addAll(selectors, root);
 876 
 877         List<Declaration> declarations = new ArrayList<Declaration>();
 878         Collections.addAll(declarations, fxBase, fxColor, fxFillShouldNotMatch);
 879 
 880         Rule baseRule = RuleShim.getRule(selectors, declarations);
 881         rules.add(baseRule);
 882 
 883         //
 884         // .rect { -fx-fill: -fx-color; }
 885         //
 886         Selector rect = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
 887 
 888         ParsedValue fxFillValue = new CssParserShim().parseExpr("-fx-fill", "-fx-color");
 889         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
 890 
 891         selectors = new ArrayList<Selector>();
 892         Collections.addAll(selectors, rect);
 893 
 894         declarations = new ArrayList<Declaration>();
 895         Collections.addAll(declarations, fxFill);
 896 
 897         Rule rectRule = RuleShim.getRule(selectors, declarations);
 898         rules.add(rectRule);
 899 
 900         // .rect:hover { -fx-fill: yellow; }
 901         List<String> pseudoclasses = new ArrayList<String>();
 902         pseudoclasses.add("hover");
 903 
 904         Selector rectHover = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, pseudoclasses, null);
 905 
 906         ParsedValueImpl<Color,Color> fxFillHoverValue = new ParsedValueImpl<Color,Color>(Color.YELLOW, null);
 907         Declaration fxFillHover = DeclarationShim.getDeclaration("-fx-fill", fxFillHoverValue, false);
 908 


 948     }
 949 
 950     @Test @org.junit.Ignore
 951     public void testGetMatchingStylesReturnsInheritedProperty() {
 952 
 953 
 954         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
 955         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
 956         StyleManager.getInstance().setDefaultUserAgentStylesheet(stylesheet);
 957 
 958         final List<Rule> rules = stylesheet.getRules();
 959 
 960         //
 961         // .root { -fx-base: red; -fx-color: -fx-base; }
 962         //
 963         List<String> rootStyleClass = new ArrayList<String>();
 964         rootStyleClass.add("root");
 965 
 966         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
 967 
 968         ParsedValue<Color,Color> fxFontShouldInheritValue = new CssParserShim().parseExpr("-fx-font", "12px system");
 969         Declaration fxFontShouldInherit = DeclarationShim.getDeclaration("-fx-font", fxFontShouldInheritValue, false);
 970 
 971         List<Selector> selectors = new ArrayList<Selector>();
 972         Collections.addAll(selectors, root);
 973 
 974         List<Declaration> declarations = new ArrayList<Declaration>();
 975         Collections.addAll(declarations, fxFontShouldInherit);
 976 
 977         Rule baseRule = RuleShim.getRule(selectors, declarations);
 978         rules.add(baseRule);
 979 
 980         //
 981         // .text { -fx-fill: -fx-color; }
 982         //
 983         List<String> textStyleClass = new ArrayList<String>();
 984         textStyleClass.add("text");
 985 
 986         Selector textSelector = SimpleSelectorShim.getSimpleSelector("*", textStyleClass, null, null);
 987 
 988         ParsedValue fxFillValue = new CssParserShim().parseExpr("-fx-fill", "red");
 989         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
 990 
 991         selectors = new ArrayList<Selector>();
 992         Collections.addAll(selectors, textSelector);
 993 
 994         declarations = new ArrayList<Declaration>();
 995         Collections.addAll(declarations, fxFill);
 996 
 997         Rule rectRule = RuleShim.getRule(selectors, declarations);
 998         rules.add(rectRule);
 999 
1000         List<Style> expecteds = new ArrayList<Style>();
1001         Collections.addAll(expecteds,
1002                            new Style(root, fxFontShouldInherit)
1003         );
1004 
1005         final Text text = new Text("text");
1006         text.getStyleClass().add("text");
1007 
1008         final Group group = new Group();


1028         assertTrue(actuals.isEmpty());
1029     }
1030 
1031     @Test @org.junit.Ignore
1032     public void testGetMatchingStylesReturnsSubProperty() {
1033 
1034         final Stylesheet stylesheet = StylesheetShim.getStylesheet();
1035         stylesheet.setOrigin(StyleOrigin.USER_AGENT);
1036         StyleManager.getInstance().setDefaultUserAgentStylesheet(stylesheet);
1037 
1038         final List<Rule> rules = stylesheet.getRules();
1039 
1040         //
1041         // .root { -fx-base: red; -fx-color: -fx-base; }
1042         //
1043         List<String> rootStyleClass = new ArrayList<String>();
1044         rootStyleClass.add("root");
1045 
1046         Selector root = SimpleSelectorShim.getSimpleSelector("*", rootStyleClass, null, null);
1047 
1048         ParsedValue<Color,Color> fxFontShouldInheritValue = new CssParserShim().parseExpr("-fx-font", "12px system");
1049         Declaration fxFontShouldInherit = DeclarationShim.getDeclaration("-fx-font", fxFontShouldInheritValue, false);
1050 
1051         List<Selector> selectors = new ArrayList<Selector>();
1052         Collections.addAll(selectors, root);
1053 
1054         List<Declaration> declarations = new ArrayList<Declaration>();
1055         Collections.addAll(declarations, fxFontShouldInherit);
1056 
1057         Rule baseRule = RuleShim.getRule(selectors, declarations);
1058         rules.add(baseRule);
1059 
1060         //
1061         // .text { -fx-fill: -fx-color; }
1062         //
1063         List<String> rectStyleClass = new ArrayList<String>();
1064         rectStyleClass.add("text");
1065 
1066         Selector textSelector = SimpleSelectorShim.getSimpleSelector("*", rectStyleClass, null, null);
1067 
1068         ParsedValue fxFillValue = new CssParserShim().parseExpr("-fx-fill", "red");
1069         Declaration fxFill = DeclarationShim.getDeclaration("-fx-fill", fxFillValue, false);
1070 
1071         ParsedValue fxFontFamilyValue = new CssParserShim().parseExpr("-fx-font-family", "arial");
1072         Declaration fxFontFamily = DeclarationShim.getDeclaration("-fx-font-family", fxFontFamilyValue, false);
1073 
1074         selectors = new ArrayList<Selector>();
1075         Collections.addAll(selectors, textSelector);
1076 
1077         declarations = new ArrayList<Declaration>();
1078         Collections.addAll(declarations, fxFill, fxFontFamily);
1079 
1080         Rule rectRule = RuleShim.getRule(selectors, declarations);
1081         rules.add(rectRule);
1082 
1083         List<Style> expecteds = new ArrayList<Style>();
1084         Collections.addAll(expecteds,
1085                            new Style(textSelector, fxFontFamily),
1086                            new Style(root, fxFontShouldInherit)
1087         );
1088 
1089         final Text text  = new Text();
1090         text.getStyleClass().add("text");
1091 


< prev index next >