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

Print this page
rev 9240 : 8076423: JEP 253: Prepare JavaFX UI Controls & CSS APIs for Modularization


   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     /**




   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 static org.junit.Assert.assertNotNull;
  29 import static org.junit.Assert.fail;


  30 import org.junit.Test;
  31 
  32 
  33 public class TypeTest {
  34 
  35     // Key key = TypeTest.getKeyByName("-fx-cursor", Node.impl_CSS_KEYS);
  36     public static CssMetaData getCssMetaDataByName(String name, CssMetaData[] keys) {
  37         CssMetaData keyForName = null;
  38         for (CssMetaData k : keys) {
  39             if (k.getProperty().equals(name)) {
  40                 keyForName = k;
  41                 break;
  42             }
  43         }
  44         assertNotNull(keyForName);
  45         return keyForName;
  46     }
  47 
  48     // ParsedValue value = TypeTest.getValueFor(stylesheet, "-fx-cursor")
  49     public static ParsedValue getValueFor(Stylesheet stylesheet, String property ) {
  50         for (Rule rule : stylesheet.getRules()) {
  51             // for (Declaration decl : rule.getUnobservedDeclarationList()) {
  52             for (Declaration decl : rule.getDeclarations()) {
  53                 if (property.equals(decl.getProperty())) {
  54                     return decl.getParsedValue();
  55                 }
  56             }
  57         }
  58         fail("getValueFor " + property);
  59         return null;
  60     }
  61 
  62     public TypeTest() {
  63     }
  64 
  65     @Test
  66     public void testType() {
  67         // All the tests have been stubbed out for now (since
  68         // the other tests implicitly or explicitly test Type).
  69         // But a unit test has to have a runnable method.
  70     }
  71 
  72     /**