create changelog entry
[debian/openrocket] / core / test / net / sf / openrocket / gui / print / PrintUnitTest.java
1 package net.sf.openrocket.gui.print;
2
3 import org.junit.Assert;
4 import org.junit.Test;
5
6 /**
7 * PrintUnit Tester.
8 *
9 */
10 public class PrintUnitTest {
11
12     /**
13      *
14      * Method: toMillis(double length)
15      *
16      */
17     @Test
18     public void testToMillis() throws Exception {
19         Assert.assertEquals(25.400000, PrintUnit.INCHES.toMillis(1), 0.00001);
20         Assert.assertEquals(1, PrintUnit.MILLIMETERS.toInches(PrintUnit.INCHES.toMillis(1)), 0.000001);
21     }
22
23     /**
24      *
25      * Method: toCentis(double length)
26      *
27      */
28     @Test
29     public void testToCentis() throws Exception {
30         Assert.assertEquals(4, PrintUnit.CENTIMETERS.toMeters(PrintUnit.METERS.toCentis(4)), 0.000001);
31         Assert.assertEquals(4, PrintUnit.CENTIMETERS.toPoints(PrintUnit.POINTS.toCentis(4)), 0.000001);
32     }
33
34     /**
35      *
36      * Method: toPoints(double length)
37      *
38      */
39     @Test
40     public void testToPoints() throws Exception {
41         Assert.assertEquals(1, PrintUnit.POINTS.toInches(72), 0.00001);
42         Assert.assertEquals(25.4, PrintUnit.POINTS.toMillis(72), 0.00001);
43         Assert.assertEquals(1, PrintUnit.MILLIMETERS.toPoints(PrintUnit.POINTS.toMillis(1)), 0.000001);
44
45         Assert.assertEquals(28.3464567, PrintUnit.CENTIMETERS.toPoints(1), 0.000001d);
46     }
47
48
49 }