modules/graphics/src/test/java/com/sun/javafx/css/FontSizeTypeTest.java

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


   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 com.sun.javafx.css.converters.SizeConverter;
  29 import javafx.css.ParsedValue;


  30 import javafx.scene.text.Font;
  31 import static org.junit.Assert.assertEquals;
  32 import org.junit.Test;
  33 
  34 
  35 public class FontSizeTypeTest {
  36 
  37     public FontSizeTypeTest() {
  38     }
  39 
  40     /**
  41      * Test of convert method, of class FontSizeType.
  42      */
  43     @Test
  44     public void testConvertToPixels() {
  45         ParsedValue<Size,Size> size = new ParsedValueImpl<Size,Size>(new Size(2.0f, SizeUnits.EM), null);
  46         ParsedValue<ParsedValue<?,Size>,Number> value = new ParsedValueImpl<ParsedValue<?,Size>,Number>(size, SizeConverter.getInstance());
  47         Font font = Font.getDefault();
  48         double expResult = SizeUnits.EM.pixels(2, 1, font);
  49         double result = SizeConverter.getInstance().convert(value, font).doubleValue();




   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 javafx.css.converter.SizeConverter;
  29 import javafx.css.ParsedValue;
  30 import javafx.css.Size;
  31 import javafx.css.SizeUnits;
  32 import javafx.scene.text.Font;
  33 import static org.junit.Assert.assertEquals;
  34 import org.junit.Test;
  35 
  36 
  37 public class FontSizeTypeTest {
  38 
  39     public FontSizeTypeTest() {
  40     }
  41 
  42     /**
  43      * Test of convert method, of class FontSizeType.
  44      */
  45     @Test
  46     public void testConvertToPixels() {
  47         ParsedValue<Size,Size> size = new ParsedValueImpl<Size,Size>(new Size(2.0f, SizeUnits.EM), null);
  48         ParsedValue<ParsedValue<?,Size>,Number> value = new ParsedValueImpl<ParsedValue<?,Size>,Number>(size, SizeConverter.getInstance());
  49         Font font = Font.getDefault();
  50         double expResult = SizeUnits.EM.pixels(2, 1, font);
  51         double result = SizeConverter.getInstance().convert(value, font).doubleValue();