modules/graphics/src/test/java/test/javafx/css/DeclarationTest.java
Print this page
rev 9250 : 8134762: Refactor Javafx graphics module tests for clear separation of tests
Reviewed-by:
@@ -21,20 +21,28 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package javafx.css;
+package test.javafx.css;
import javafx.scene.paint.Color;
import com.sun.javafx.css.ParsedValueImpl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import javafx.css.Declaration;
+import javafx.css.DeclarationShim;
+import javafx.css.Rule;
+import javafx.css.RuleShim;
+import javafx.css.SelectorShim;
+import javafx.css.StyleOrigin;
+import javafx.css.Stylesheet;
+import javafx.css.StylesheetShim;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -74,48 +82,48 @@
final int GA2 = n++; // green author 2
final int YA2 = n++; // yellow author 2
final Declaration[] DECLS = new Declaration[n];
- Stylesheet inlineSS = new Stylesheet() {
+ Stylesheet inlineSS = new StylesheetShim() {
{
setOrigin(StyleOrigin.INLINE);
- DECLS[GI] = new Declaration("-fx-base", new ParsedValueImpl<Color,Color>(Color.GREEN, null), false);
- DECLS[YI] = new Declaration("-fx-color", new ParsedValueImpl<Color,Color>(Color.YELLOW, null), false);
+ DECLS[GI] = DeclarationShim.getDeclaration("-fx-base", new ParsedValueImpl<Color,Color>(Color.GREEN, null), false);
+ DECLS[YI] = DeclarationShim.getDeclaration("-fx-color", new ParsedValueImpl<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]))
+ RuleShim.getRule(Arrays.asList(SelectorShim.getUniversalSelector()), Arrays.asList(DECLS[GI])),
+ RuleShim.getRule(Arrays.asList(SelectorShim.getUniversalSelector()), Arrays.asList(DECLS[YI]))
);
}
};
- Stylesheet authorSS_1 = new Stylesheet() {
+ Stylesheet authorSS_1 = new StylesheetShim() {
{
setOrigin(StyleOrigin.AUTHOR);
- DECLS[GA1] = new Declaration("-fx-base", new ParsedValueImpl<Color,Color>(Color.GREEN, null), false);
- DECLS[YA1] = new Declaration("-fx-color", new ParsedValueImpl<Color,Color>(Color.YELLOW, null), false);
+ DECLS[GA1] = DeclarationShim.getDeclaration("-fx-base", new ParsedValueImpl<Color,Color>(Color.GREEN, null), false);
+ DECLS[YA1] = DeclarationShim.getDeclaration("-fx-color", new ParsedValueImpl<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]))
+ RuleShim.getRule(Arrays.asList(SelectorShim.getUniversalSelector()), Arrays.asList(DECLS[GA1])),
+ RuleShim.getRule(Arrays.asList(SelectorShim.getUniversalSelector()), Arrays.asList(DECLS[YA1]))
);
}
};
- Stylesheet authorSS_2 = new Stylesheet() {
+ Stylesheet authorSS_2 = new StylesheetShim() {
{
setOrigin(StyleOrigin.AUTHOR);
- DECLS[GA2] = new Declaration("-fx-base", new ParsedValueImpl<Color,Color>(Color.GREEN, null), false);
- DECLS[YA2] = new Declaration("-fx-color", new ParsedValueImpl<Color,Color>(Color.YELLOW, null), false);
+ DECLS[GA2] = DeclarationShim.getDeclaration("-fx-base", new ParsedValueImpl<Color,Color>(Color.GREEN, null), false);
+ DECLS[YA2] = DeclarationShim.getDeclaration("-fx-color", new ParsedValueImpl<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]))
+ RuleShim.getRule(Arrays.asList(SelectorShim.getUniversalSelector()), Arrays.asList(DECLS[GA2])),
+ RuleShim.getRule(Arrays.asList(SelectorShim.getUniversalSelector()), Arrays.asList(DECLS[YA2]))
);
}
};
return Arrays.asList(new Object[] {