1 /* 2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 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 com.sun.javafx.css; 27 28 import static org.junit.Assert.assertNotNull; 29 import static org.junit.Assert.fail; 30 import javafx.css.CssMetaData; 31 import javafx.css.ParsedValue; 32 import org.junit.Test; 33 34 35 public class TypeTest { 36 37 // Key key = TypeTest.getKeyByName("-fx-cursor", Node.impl_CSS_KEYS); 38 public static CssMetaData getCssMetaDataByName(String name, CssMetaData[] keys) { 39 CssMetaData keyForName = null; 40 for (CssMetaData k : keys) { 41 if (k.getProperty().equals(name)) { 42 keyForName = k; 43 break; 44 } 45 } 46 assertNotNull(keyForName); 47 return keyForName; 48 } 49 50 // ParsedValue value = TypeTest.getValueFor(stylesheet, "-fx-cursor") 51 public static ParsedValue getValueFor(Stylesheet stylesheet, String property ) { 52 for (Rule rule : stylesheet.getRules()) { 53 for (Declaration decl : rule.getUnobservedDeclarationList()) { 54 if (property.equals(decl.getProperty())) { 55 return decl.getParsedValue(); 56 } 57 } 58 } 59 fail("getValueFor " + property); 60 return null; 61 } 62 63 public TypeTest() { 64 } 65 66 @Test 67 public void testType() { 68 // All the tests have been stubbed out for now (since 69 // the other tests implicitly or explicitly test Type). 70 // But a unit test has to have a runnable method. 71 } 72 73 /** 74 * Test of ENUM method, of class Type. 75 */ 76 // @Test 77 // public void testENUM() { 78 // System.out.println("ENUM"); 79 // Class type = null; 80 // Type expResult = null; 81 // Type result = Type.ENUM(type); 82 // assertEquals(expResult, result); 83 // // TODO review the generated test code and remove the default call to fail. 84 // fail("The test case is a prototype."); 85 // } 86 87 /** 88 * Test of convert method, of class Type. 89 */ 90 // @Test 91 // public void testConvert_Value_Font() { 92 // System.out.println("convert"); 93 // ParsedValue<Font> value = null; 94 // Font font = null; 95 // Type instance = new Type(); 96 // Object expResult = null; 97 // Object result = instance.convert(value, font); 98 // assertEquals(expResult, result); 99 // // TODO review the generated test code and remove the default call to fail. 100 // fail("The test case is a prototype."); 101 // } 102 103 /** 104 * Test of convert method, of class Type. 105 */ 106 // @Test 107 // public void testConvert_KeyArr() { 108 // System.out.println("convert"); 109 // Key[] keys = null; 110 // Type instance = new Type(); 111 // Object expResult = null; 112 // Object result = instance.convert(keys); 113 // assertEquals(expResult, result); 114 // // TODO review the generated test code and remove the default call to fail. 115 // fail("The test case is a prototype."); 116 // } 117 118 /** 119 * Test of writeCssSerializable method, of class Type. 120 */ 121 // @Test 122 // public void testWriteCssSerializable() throws Exception { 123 // System.out.println("writeCssSerializable"); 124 // DataOutputStream stream = null; 125 // StringStore ss = null; 126 // CssSerializable cs = null; 127 // Type instance = new Type(); 128 // instance.writeCssSerializable(stream, ss, cs); 129 // // TODO review the generated test code and remove the default call to fail. 130 // fail("The test case is a prototype."); 131 // } 132 133 /** 134 * Test of readCssSerializable method, of class Type. 135 */ 136 // @Test 137 // public void testReadCssSerializable() throws Exception { 138 // System.out.println("readCssSerializable"); 139 // DataInputStream stream = null; 140 // String[] strings = null; 141 // Type instance = new Type(); 142 // Object expResult = null; 143 // Object result = instance.readCssSerializable(stream, strings); 144 // assertEquals(expResult, result); 145 // // TODO review the generated test code and remove the default call to fail. 146 // fail("The test case is a prototype."); 147 // } 148 149 /** 150 * Test of writePaint method, of class Type. 151 */ 152 // @Test 153 // public void testWritePaint() throws Exception { 154 // System.out.println("writePaint"); 155 // DataOutputStream stream = null; 156 // Paint paint = null; 157 // Type.writePaint(stream, paint); 158 // // TODO review the generated test code and remove the default call to fail. 159 // fail("The test case is a prototype."); 160 // } 161 162 /** 163 * Test of readPaint method, of class Type. 164 */ 165 // @Test 166 // public void testReadPaint() throws Exception { 167 // System.out.println("readPaint"); 168 // DataInputStream stream = null; 169 // Paint expResult = null; 170 // Paint result = Type.readPaint(stream); 171 // assertEquals(expResult, result); 172 // // TODO review the generated test code and remove the default call to fail. 173 // fail("The test case is a prototype."); 174 // } 175 176 /** 177 * Test of writeColor method, of class Type. 178 */ 179 // @Test 180 // public void testWriteColor() throws Exception { 181 // System.out.println("writeColor"); 182 // DataOutputStream stream = null; 183 // Color color = null; 184 // Type.writeColor(stream, color); 185 // // TODO review the generated test code and remove the default call to fail. 186 // fail("The test case is a prototype."); 187 // } 188 189 /** 190 * Test of readColor method, of class Type. 191 */ 192 // @Test 193 // public void testReadColor() throws Exception { 194 // System.out.println("readColor"); 195 // DataInputStream stream = null; 196 // Color expResult = null; 197 // Color result = Type.readColor(stream); 198 // assertEquals(expResult, result); 199 // // TODO review the generated test code and remove the default call to fail. 200 // fail("The test case is a prototype."); 201 // } 202 203 /** 204 * Test of writeLinearGradient method, of class Type. 205 */ 206 // @Test 207 // public void testWriteLinearGradient() throws Exception { 208 // System.out.println("writeLinearGradient"); 209 // DataOutputStream stream = null; 210 // LinearGradient lg = null; 211 // Type.writeLinearGradient(stream, lg); 212 // // TODO review the generated test code and remove the default call to fail. 213 // fail("The test case is a prototype."); 214 // } 215 216 /** 217 * Test of readLinearGradient method, of class Type. 218 */ 219 // @Test 220 // public void testReadLinearGradient() throws Exception { 221 // System.out.println("readLinearGradient"); 222 // DataInputStream stream = null; 223 // LinearGradient expResult = null; 224 // LinearGradient result = Type.readLinearGradient(stream); 225 // assertEquals(expResult, result); 226 // // TODO review the generated test code and remove the default call to fail. 227 // fail("The test case is a prototype."); 228 // } 229 230 /** 231 * Test of writeRadialGradient method, of class Type. 232 */ 233 // @Test 234 // public void testWriteRadialGradient() throws Exception { 235 // System.out.println("writeRadialGradient"); 236 // DataOutputStream stream = null; 237 // RadialGradient rg = null; 238 // Type.writeRadialGradient(stream, rg); 239 // // TODO review the generated test code and remove the default call to fail. 240 // fail("The test case is a prototype."); 241 // } 242 243 /** 244 * Test of readRadialGradient method, of class Type. 245 */ 246 // @Test 247 // public void testReadRadialGradient() throws Exception { 248 // System.out.println("readRadialGradient"); 249 // DataInputStream stream = null; 250 // RadialGradient expResult = null; 251 // RadialGradient result = Type.readRadialGradient(stream); 252 // assertEquals(expResult, result); 253 // // TODO review the generated test code and remove the default call to fail. 254 // fail("The test case is a prototype."); 255 // } 256 257 /** 258 * Test of readCycleMethod method, of class Type. 259 */ 260 // @Test 261 // public void testReadCycleMethod() throws Exception { 262 // System.out.println("readCycleMethod"); 263 // DataInputStream stream = null; 264 // CycleMethod expResult = null; 265 // CycleMethod result = Type.readCycleMethod(stream); 266 // assertEquals(expResult, result); 267 // // TODO review the generated test code and remove the default call to fail. 268 // fail("The test case is a prototype."); 269 // } 270 271 /** 272 * Test of writeStop method, of class Type. 273 */ 274 // @Test 275 // public void testWriteStop() throws Exception { 276 // System.out.println("writeStop"); 277 // DataOutputStream stream = null; 278 // Stop stop = null; 279 // Type.writeStop(stream, stop); 280 // // TODO review the generated test code and remove the default call to fail. 281 // fail("The test case is a prototype."); 282 // } 283 284 /** 285 * Test of readStop method, of class Type. 286 */ 287 // @Test 288 // public void testReadStop() throws Exception { 289 // System.out.println("readStop"); 290 // DataInputStream stream = null; 291 // Stop expResult = null; 292 // Stop result = Type.readStop(stream); 293 // assertEquals(expResult, result); 294 // // TODO review the generated test code and remove the default call to fail. 295 // fail("The test case is a prototype."); 296 // } 297 298 /** 299 * Test of isMightHaveLookups method, of class Type. 300 */ 301 // @Test 302 // public void testIsMightHaveLookups() { 303 // System.out.println("isMightHaveLookups"); 304 // Type instance = new Type(); 305 // boolean expResult = false; 306 // boolean result = instance.isMightHaveLookups(); 307 // assertEquals(expResult, result); 308 // // TODO review the generated test code and remove the default call to fail. 309 // fail("The test case is a prototype."); 310 // } 311 312 }