6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package javafx.css;
27
28 import com.sun.javafx.css.ParsedValueImpl;
29 import javafx.css.StyleConverter.StringStore;
30
31 import java.io.DataInputStream;
32 import java.io.DataOutputStream;
33 import java.util.ArrayList;
34 import java.util.Collections;
35 import java.util.List;
36 import javafx.scene.Node;
37 import org.junit.AfterClass;
38 import org.junit.Test;
39 import static org.junit.Assert.*;
40 import org.junit.BeforeClass;
41 import org.junit.Ignore;
42
43
44 public class RuleTest {
45
46 public RuleTest() {
47 }
48
49 @BeforeClass
50 public static void setUpClass() throws Exception {
51 }
52
53 @AfterClass
54 public static void tearDownClass() throws Exception {
55 }
56
57 @Test
58 public void testGetUnobservedSelectorList() {
59 List<Selector> expResult = new ArrayList<Selector>();
60 expResult.add(Selector.createSelector("One.two#three"));
61 expResult.add(Selector.createSelector("Four.five#six"));
62 Rule instance = new Rule(expResult, Collections.EMPTY_LIST);
63 List result = instance.getUnobservedSelectorList();
64 assertEquals(expResult, result);
65 }
66
67 @Test
68 public void testGetUnobservedDeclarationList() {
69 List<Declaration> expResult = new ArrayList<Declaration>();
70 expResult.add(new Declaration("one", new ParsedValueImpl<String,String>("one", null), false));
71 expResult.add(new Declaration("two", new ParsedValueImpl<String,String>("two", null), false));
72 expResult.add(new Declaration("three", new ParsedValueImpl<String,String>("three", null), false));
73 Rule instance = new Rule(Collections.EMPTY_LIST, expResult);
74 List result = instance.getUnobservedDeclarationList();
75 assertEquals(expResult, result);
76 }
77
78 @Test
79 public void testGetSelectors() {
80 List<Selector> expResult = new ArrayList<Selector>();
81 expResult.add(Selector.createSelector("One.two#three"));
82 expResult.add(Selector.createSelector("Four.five#six"));
83 Rule instance = new Rule(expResult, Collections.EMPTY_LIST);
84 List result = instance.getSelectors();
85 assertEquals(expResult, result);
86 }
87
88 @Test
89 public void testGetDeclarations() {
90 List<Declaration> expResult = new ArrayList<Declaration>();
91 expResult.add(new Declaration("one", new ParsedValueImpl<String,String>("one", null), false));
92 expResult.add(new Declaration("two", new ParsedValueImpl<String,String>("two", null), false));
93 expResult.add(new Declaration("three", new ParsedValueImpl<String,String>("three", null), false));
94 Rule instance = new Rule(Collections.EMPTY_LIST, expResult);
95 List result = instance.getDeclarations();
96 assertEquals(expResult, result);
97 }
98
99 @Test
100 public void testGetStylesheet() {
101 Rule instance = new Rule(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
102 Stylesheet expResult = new Stylesheet();
103 expResult.getRules().add(instance);
104 Stylesheet result = instance.getStylesheet();
105 assertEquals(expResult, result);
106 }
107
108 @Test
109 public void testGetOriginAfterSettingOriginAfterAddingRuleToStylesheet() {
110 Rule instance = new Rule(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
111 Stylesheet stylesheet = new Stylesheet();
112 stylesheet.getRules().add(instance);
113 stylesheet.setOrigin(StyleOrigin.INLINE);
114 StyleOrigin expResult = StyleOrigin.INLINE;
115 StyleOrigin result = instance.getOrigin();
116 assertEquals(expResult, result);
117 }
118
119 @Test
120 public void testGetOriginAfterSettingOriginBeforeAddingRuleToStylesheet() {
121 Rule instance = new Rule(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
122 Stylesheet stylesheet = new Stylesheet();
123 stylesheet.setOrigin(StyleOrigin.INLINE);
124 stylesheet.getRules().add(instance);
125 StyleOrigin expResult = StyleOrigin.INLINE;
126 StyleOrigin result = instance.getOrigin();
127 assertEquals(expResult, result);
128 }
129
130 @Test
131 public void testGetOriginWithoutAddingRuleToStylesheet() {
132 Rule instance = new Rule(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
133 StyleOrigin result = instance.getOrigin();
134 assertNull(result);
135 }
136
137 @Test
138 public void testGetOriginAfterRemovingRuleFromStylesheet() {
139 Rule instance = new Rule(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
140 Stylesheet stylesheet = new Stylesheet();
141 stylesheet.getRules().add(instance);
142 stylesheet.setOrigin(StyleOrigin.INLINE);
143 stylesheet.getRules().remove(instance);
144 StyleOrigin result = instance.getOrigin();
145 assertNull(result);
146 }
147
148 @Ignore @Test
149 public void testApplies() {
150 System.out.println("applies");
151 Node node = null;
152 Rule instance = null;
153 long expResult = 0l;
154 long result = instance.applies(node, null);
155 assertEquals(expResult, result);
156 fail("The test case is a prototype.");
157 }
158
159 @Ignore @Test
160 public void testToString() {
161 System.out.println("toString");
162 Rule instance = null;
163 String expResult = "";
164 String result = instance.toString();
165 assertEquals(expResult, result);
166 fail("The test case is a prototype.");
167 }
168
169 @Ignore @Test
170 public void testWriteBinary() throws Exception {
171 System.out.println("writeBinary");
172 DataOutputStream os = null;
173 StringStore stringStore = null;
174 Rule instance = null;
175 instance.writeBinary(os, stringStore);
176 fail("The test case is a prototype.");
177 }
178
179 @Ignore @Test
180 public void testReadBinary() throws Exception {
181 System.out.println("readBinary");
182 DataInputStream is = null;
183 String[] strings = null;
184 Rule expResult = null;
185 Rule result = Rule.readBinary(Stylesheet.BINARY_CSS_VERSION, is, strings);
186 assertEquals(expResult, result);
187 fail("The test case is a prototype.");
188 }
189 }
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package test.javafx.css;
27
28 import com.sun.javafx.css.ParsedValueImpl;
29 import javafx.css.StylesheetShim;
30 import javafx.css.StyleConverter.StringStore;
31
32 import java.io.DataInputStream;
33 import java.io.DataOutputStream;
34 import java.util.ArrayList;
35 import java.util.Collections;
36 import java.util.List;
37 import javafx.css.Declaration;
38 import javafx.css.DeclarationShim;
39 import javafx.css.Rule;
40 import javafx.css.RuleShim;
41 import javafx.css.Selector;
42 import javafx.css.StyleOrigin;
43 import javafx.css.Stylesheet;
44 import javafx.css.StylesheetShim;
45 import javafx.scene.Node;
46 import org.junit.AfterClass;
47 import org.junit.Test;
48 import static org.junit.Assert.*;
49 import org.junit.BeforeClass;
50 import org.junit.Ignore;
51
52
53 public class RuleTest {
54
55 public RuleTest() {
56 }
57
58 @BeforeClass
59 public static void setUpClass() throws Exception {
60 }
61
62 @AfterClass
63 public static void tearDownClass() throws Exception {
64 }
65
66 @Test
67 public void testGetUnobservedSelectorList() {
68 List<Selector> expResult = new ArrayList<Selector>();
69 expResult.add(Selector.createSelector("One.two#three"));
70 expResult.add(Selector.createSelector("Four.five#six"));
71 Rule instance = RuleShim.getRule(expResult, Collections.EMPTY_LIST);
72 List result = RuleShim.getUnobservedSelectorList(instance);
73 assertEquals(expResult, result);
74 }
75
76 @Test
77 public void testGetUnobservedDeclarationList() {
78 List<Declaration> expResult = new ArrayList<Declaration>();
79 expResult.add(DeclarationShim.getDeclaration("one", new ParsedValueImpl<String,String>("one", null), false));
80 expResult.add(DeclarationShim.getDeclaration("two", new ParsedValueImpl<String,String>("two", null), false));
81 expResult.add(DeclarationShim.getDeclaration("three", new ParsedValueImpl<String,String>("three", null), false));
82 Rule instance = RuleShim.getRule(Collections.EMPTY_LIST, expResult);
83 List result = RuleShim.getUnobservedDeclarationList(instance);
84 assertEquals(expResult, result);
85 }
86
87 @Test
88 public void testGetSelectors() {
89 List<Selector> expResult = new ArrayList<Selector>();
90 expResult.add(Selector.createSelector("One.two#three"));
91 expResult.add(Selector.createSelector("Four.five#six"));
92 Rule instance = RuleShim.getRule(expResult, Collections.EMPTY_LIST);
93 List result = instance.getSelectors();
94 assertEquals(expResult, result);
95 }
96
97 @Test
98 public void testGetDeclarations() {
99 List<Declaration> expResult = new ArrayList<Declaration>();
100 expResult.add(DeclarationShim.getDeclaration("one", new ParsedValueImpl<String,String>("one", null), false));
101 expResult.add(DeclarationShim.getDeclaration("two", new ParsedValueImpl<String,String>("two", null), false));
102 expResult.add(DeclarationShim.getDeclaration("three", new ParsedValueImpl<String,String>("three", null), false));
103 Rule instance = RuleShim.getRule(Collections.EMPTY_LIST, expResult);
104 List result = instance.getDeclarations();
105 assertEquals(expResult, result);
106 }
107
108 @Test
109 public void testGetStylesheet() {
110 Rule instance = RuleShim.getRule(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
111 Stylesheet expResult = new StylesheetShim();
112 expResult.getRules().add(instance);
113 Stylesheet result = instance.getStylesheet();
114 assertEquals(expResult, result);
115 }
116
117 @Test
118 public void testGetOriginAfterSettingOriginAfterAddingRuleToStylesheet() {
119 Rule instance = RuleShim.getRule(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
120 Stylesheet stylesheet = new StylesheetShim();
121 stylesheet.getRules().add(instance);
122 stylesheet.setOrigin(StyleOrigin.INLINE);
123 StyleOrigin expResult = StyleOrigin.INLINE;
124 StyleOrigin result = instance.getOrigin();
125 assertEquals(expResult, result);
126 }
127
128 @Test
129 public void testGetOriginAfterSettingOriginBeforeAddingRuleToStylesheet() {
130 Rule instance = RuleShim.getRule(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
131 Stylesheet stylesheet = new StylesheetShim();
132 stylesheet.setOrigin(StyleOrigin.INLINE);
133 stylesheet.getRules().add(instance);
134 StyleOrigin expResult = StyleOrigin.INLINE;
135 StyleOrigin result = instance.getOrigin();
136 assertEquals(expResult, result);
137 }
138
139 @Test
140 public void testGetOriginWithoutAddingRuleToStylesheet() {
141 Rule instance = RuleShim.getRule(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
142 StyleOrigin result = instance.getOrigin();
143 assertNull(result);
144 }
145
146 @Test
147 public void testGetOriginAfterRemovingRuleFromStylesheet() {
148 Rule instance = RuleShim.getRule(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
149 Stylesheet stylesheet = new StylesheetShim();
150 stylesheet.getRules().add(instance);
151 stylesheet.setOrigin(StyleOrigin.INLINE);
152 stylesheet.getRules().remove(instance);
153 StyleOrigin result = instance.getOrigin();
154 assertNull(result);
155 }
156
157 @Ignore @Test
158 public void testApplies() {
159 System.out.println("applies");
160 Node node = null;
161 Rule instance = null;
162 long expResult = 0l;
163 long result = RuleShim.applies(instance, node, null);
164 assertEquals(expResult, result);
165 fail("The test case is a prototype.");
166 }
167
168 @Ignore @Test
169 public void testToString() {
170 System.out.println("toString");
171 Rule instance = null;
172 String expResult = "";
173 String result = instance.toString();
174 assertEquals(expResult, result);
175 fail("The test case is a prototype.");
176 }
177
178 @Ignore @Test
179 public void testWriteBinary() throws Exception {
180 System.out.println("writeBinary");
181 DataOutputStream os = null;
182 StringStore stringStore = null;
183 Rule instance = null;
184 RuleShim.writeBinary(instance, os, stringStore);
185 fail("The test case is a prototype.");
186 }
187
188 @Ignore @Test
189 public void testReadBinary() throws Exception {
190 System.out.println("readBinary");
191 DataInputStream is = null;
192 String[] strings = null;
193 Rule expResult = null;
194 Rule result = RuleShim.readBinary(StylesheetShim.BINARY_CSS_VERSION, is, strings);
195 assertEquals(expResult, result);
196 fail("The test case is a prototype.");
197 }
198 }
|