1 17 18 19 20 package org.apache.fop.util; 21 22 import junit.framework.TestCase; 23 24 27 public class UnitConvTestCase extends TestCase { 28 29 33 public void testConversions() throws Exception { 34 assertEquals("in2mm", 25.4, UnitConv.in2mm(1), 0.00001); 35 assertEquals("mm2in", 1.0, UnitConv.mm2in(25.4), 0.00001); 36 assertEquals("mm2pt", 841.890, UnitConv.mm2pt(297), 0.001 / 2); assertEquals("mm2mpt", 841890, UnitConv.mm2mpt(297), 1.0 / 2); 38 assertEquals("pt2mm", 297, UnitConv.pt2mm(841.890), 0.0001); 39 assertEquals("in2mpt", 792000, UnitConv.in2mpt(11.0), 1.0 / 2); assertEquals("mpt2in", 11.0, UnitConv.mpt2in(792000), 0.01 / 2); 42 assertEquals("mm2px/72dpi", 841.8897764234434, UnitConv.mm2px(297.0, 72), 0); 43 assertEquals("mm2px/300dpi", 3507.8740684310146, UnitConv.mm2px(297.0, 300), 0); 44 } 45 46 } | Popular Tags |