--- old/modules/graphics/src/test/java/javafx/css/RuleTest.java 2015-09-11 21:25:54.261285980 -0400 +++ /dev/null 2015-09-11 11:06:08.592686920 -0400 @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package javafx.css; - -import com.sun.javafx.css.ParsedValueImpl; -import javafx.css.StyleConverter.StringStore; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import javafx.scene.Node; -import org.junit.AfterClass; -import org.junit.Test; -import static org.junit.Assert.*; -import org.junit.BeforeClass; -import org.junit.Ignore; - - -public class RuleTest { - - public RuleTest() { - } - - @BeforeClass - public static void setUpClass() throws Exception { - } - - @AfterClass - public static void tearDownClass() throws Exception { - } - - @Test - public void testGetUnobservedSelectorList() { - List expResult = new ArrayList(); - expResult.add(Selector.createSelector("One.two#three")); - expResult.add(Selector.createSelector("Four.five#six")); - Rule instance = new Rule(expResult, Collections.EMPTY_LIST); - List result = instance.getUnobservedSelectorList(); - assertEquals(expResult, result); - } - - @Test - public void testGetUnobservedDeclarationList() { - List expResult = new ArrayList(); - expResult.add(new Declaration("one", new ParsedValueImpl("one", null), false)); - expResult.add(new Declaration("two", new ParsedValueImpl("two", null), false)); - expResult.add(new Declaration("three", new ParsedValueImpl("three", null), false)); - Rule instance = new Rule(Collections.EMPTY_LIST, expResult); - List result = instance.getUnobservedDeclarationList(); - assertEquals(expResult, result); - } - - @Test - public void testGetSelectors() { - List expResult = new ArrayList(); - expResult.add(Selector.createSelector("One.two#three")); - expResult.add(Selector.createSelector("Four.five#six")); - Rule instance = new Rule(expResult, Collections.EMPTY_LIST); - List result = instance.getSelectors(); - assertEquals(expResult, result); - } - - @Test - public void testGetDeclarations() { - List expResult = new ArrayList(); - expResult.add(new Declaration("one", new ParsedValueImpl("one", null), false)); - expResult.add(new Declaration("two", new ParsedValueImpl("two", null), false)); - expResult.add(new Declaration("three", new ParsedValueImpl("three", null), false)); - Rule instance = new Rule(Collections.EMPTY_LIST, expResult); - List result = instance.getDeclarations(); - assertEquals(expResult, result); - } - - @Test - public void testGetStylesheet() { - Rule instance = new Rule(Collections.EMPTY_LIST, Collections.EMPTY_LIST); - Stylesheet expResult = new Stylesheet(); - expResult.getRules().add(instance); - Stylesheet result = instance.getStylesheet(); - assertEquals(expResult, result); - } - - @Test - public void testGetOriginAfterSettingOriginAfterAddingRuleToStylesheet() { - Rule instance = new Rule(Collections.EMPTY_LIST, Collections.EMPTY_LIST); - Stylesheet stylesheet = new Stylesheet(); - stylesheet.getRules().add(instance); - stylesheet.setOrigin(StyleOrigin.INLINE); - StyleOrigin expResult = StyleOrigin.INLINE; - StyleOrigin result = instance.getOrigin(); - assertEquals(expResult, result); - } - - @Test - public void testGetOriginAfterSettingOriginBeforeAddingRuleToStylesheet() { - Rule instance = new Rule(Collections.EMPTY_LIST, Collections.EMPTY_LIST); - Stylesheet stylesheet = new Stylesheet(); - stylesheet.setOrigin(StyleOrigin.INLINE); - stylesheet.getRules().add(instance); - StyleOrigin expResult = StyleOrigin.INLINE; - StyleOrigin result = instance.getOrigin(); - assertEquals(expResult, result); - } - - @Test - public void testGetOriginWithoutAddingRuleToStylesheet() { - Rule instance = new Rule(Collections.EMPTY_LIST, Collections.EMPTY_LIST); - StyleOrigin result = instance.getOrigin(); - assertNull(result); - } - - @Test - public void testGetOriginAfterRemovingRuleFromStylesheet() { - Rule instance = new Rule(Collections.EMPTY_LIST, Collections.EMPTY_LIST); - Stylesheet stylesheet = new Stylesheet(); - stylesheet.getRules().add(instance); - stylesheet.setOrigin(StyleOrigin.INLINE); - stylesheet.getRules().remove(instance); - StyleOrigin result = instance.getOrigin(); - assertNull(result); - } - - @Ignore @Test - public void testApplies() { - System.out.println("applies"); - Node node = null; - Rule instance = null; - long expResult = 0l; - long result = instance.applies(node, null); - assertEquals(expResult, result); - fail("The test case is a prototype."); - } - - @Ignore @Test - public void testToString() { - System.out.println("toString"); - Rule instance = null; - String expResult = ""; - String result = instance.toString(); - assertEquals(expResult, result); - fail("The test case is a prototype."); - } - - @Ignore @Test - public void testWriteBinary() throws Exception { - System.out.println("writeBinary"); - DataOutputStream os = null; - StringStore stringStore = null; - Rule instance = null; - instance.writeBinary(os, stringStore); - fail("The test case is a prototype."); - } - - @Ignore @Test - public void testReadBinary() throws Exception { - System.out.println("readBinary"); - DataInputStream is = null; - String[] strings = null; - Rule expResult = null; - Rule result = Rule.readBinary(Stylesheet.BINARY_CSS_VERSION, is, strings); - assertEquals(expResult, result); - fail("The test case is a prototype."); - } -} --- /dev/null 2015-09-11 11:06:08.592686920 -0400 +++ new/modules/graphics/src/test/java/test/javafx/css/RuleTest.java 2015-09-11 21:25:54.077285982 -0400 @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package test.javafx.css; + +import com.sun.javafx.css.ParsedValueImpl; +import javafx.css.StylesheetShim; +import javafx.css.StyleConverter.StringStore; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.util.ArrayList; +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.Selector; +import javafx.css.StyleOrigin; +import javafx.css.Stylesheet; +import javafx.css.StylesheetShim; +import javafx.scene.Node; +import org.junit.AfterClass; +import org.junit.Test; +import static org.junit.Assert.*; +import org.junit.BeforeClass; +import org.junit.Ignore; + + +public class RuleTest { + + public RuleTest() { + } + + @BeforeClass + public static void setUpClass() throws Exception { + } + + @AfterClass + public static void tearDownClass() throws Exception { + } + + @Test + public void testGetUnobservedSelectorList() { + List expResult = new ArrayList(); + expResult.add(Selector.createSelector("One.two#three")); + expResult.add(Selector.createSelector("Four.five#six")); + Rule instance = RuleShim.getRule(expResult, Collections.EMPTY_LIST); + List result = RuleShim.getUnobservedSelectorList(instance); + assertEquals(expResult, result); + } + + @Test + public void testGetUnobservedDeclarationList() { + List expResult = new ArrayList(); + expResult.add(DeclarationShim.getDeclaration("one", new ParsedValueImpl("one", null), false)); + expResult.add(DeclarationShim.getDeclaration("two", new ParsedValueImpl("two", null), false)); + expResult.add(DeclarationShim.getDeclaration("three", new ParsedValueImpl("three", null), false)); + Rule instance = RuleShim.getRule(Collections.EMPTY_LIST, expResult); + List result = RuleShim.getUnobservedDeclarationList(instance); + assertEquals(expResult, result); + } + + @Test + public void testGetSelectors() { + List expResult = new ArrayList(); + expResult.add(Selector.createSelector("One.two#three")); + expResult.add(Selector.createSelector("Four.five#six")); + Rule instance = RuleShim.getRule(expResult, Collections.EMPTY_LIST); + List result = instance.getSelectors(); + assertEquals(expResult, result); + } + + @Test + public void testGetDeclarations() { + List expResult = new ArrayList(); + expResult.add(DeclarationShim.getDeclaration("one", new ParsedValueImpl("one", null), false)); + expResult.add(DeclarationShim.getDeclaration("two", new ParsedValueImpl("two", null), false)); + expResult.add(DeclarationShim.getDeclaration("three", new ParsedValueImpl("three", null), false)); + Rule instance = RuleShim.getRule(Collections.EMPTY_LIST, expResult); + List result = instance.getDeclarations(); + assertEquals(expResult, result); + } + + @Test + public void testGetStylesheet() { + Rule instance = RuleShim.getRule(Collections.EMPTY_LIST, Collections.EMPTY_LIST); + Stylesheet expResult = new StylesheetShim(); + expResult.getRules().add(instance); + Stylesheet result = instance.getStylesheet(); + assertEquals(expResult, result); + } + + @Test + public void testGetOriginAfterSettingOriginAfterAddingRuleToStylesheet() { + Rule instance = RuleShim.getRule(Collections.EMPTY_LIST, Collections.EMPTY_LIST); + Stylesheet stylesheet = new StylesheetShim(); + stylesheet.getRules().add(instance); + stylesheet.setOrigin(StyleOrigin.INLINE); + StyleOrigin expResult = StyleOrigin.INLINE; + StyleOrigin result = instance.getOrigin(); + assertEquals(expResult, result); + } + + @Test + public void testGetOriginAfterSettingOriginBeforeAddingRuleToStylesheet() { + Rule instance = RuleShim.getRule(Collections.EMPTY_LIST, Collections.EMPTY_LIST); + Stylesheet stylesheet = new StylesheetShim(); + stylesheet.setOrigin(StyleOrigin.INLINE); + stylesheet.getRules().add(instance); + StyleOrigin expResult = StyleOrigin.INLINE; + StyleOrigin result = instance.getOrigin(); + assertEquals(expResult, result); + } + + @Test + public void testGetOriginWithoutAddingRuleToStylesheet() { + Rule instance = RuleShim.getRule(Collections.EMPTY_LIST, Collections.EMPTY_LIST); + StyleOrigin result = instance.getOrigin(); + assertNull(result); + } + + @Test + public void testGetOriginAfterRemovingRuleFromStylesheet() { + Rule instance = RuleShim.getRule(Collections.EMPTY_LIST, Collections.EMPTY_LIST); + Stylesheet stylesheet = new StylesheetShim(); + stylesheet.getRules().add(instance); + stylesheet.setOrigin(StyleOrigin.INLINE); + stylesheet.getRules().remove(instance); + StyleOrigin result = instance.getOrigin(); + assertNull(result); + } + + @Ignore @Test + public void testApplies() { + System.out.println("applies"); + Node node = null; + Rule instance = null; + long expResult = 0l; + long result = RuleShim.applies(instance, node, null); + assertEquals(expResult, result); + fail("The test case is a prototype."); + } + + @Ignore @Test + public void testToString() { + System.out.println("toString"); + Rule instance = null; + String expResult = ""; + String result = instance.toString(); + assertEquals(expResult, result); + fail("The test case is a prototype."); + } + + @Ignore @Test + public void testWriteBinary() throws Exception { + System.out.println("writeBinary"); + DataOutputStream os = null; + StringStore stringStore = null; + Rule instance = null; + RuleShim.writeBinary(instance, os, stringStore); + fail("The test case is a prototype."); + } + + @Ignore @Test + public void testReadBinary() throws Exception { + System.out.println("readBinary"); + DataInputStream is = null; + String[] strings = null; + Rule expResult = null; + Rule result = RuleShim.readBinary(StylesheetShim.BINARY_CSS_VERSION, is, strings); + assertEquals(expResult, result); + fail("The test case is a prototype."); + } +}