1 33 34 package edu.rice.cs.drjava.config; 35 36 import edu.rice.cs.drjava.DrJavaTestCase; 37 import java.awt.Font ; 38 39 44 public final class FontOptionTest extends DrJavaTestCase { 45 46 public void testParse() { 47 FontOption fo = new FontOption("font.test1", Font.decode(null)); 48 assertEquals(new Font ("monospaced", 0, 12), fo.parse("monospaced-12")); 49 assertEquals(new Font ("sansserif", 1, 10), fo.parse("sansserif-BOLD-10")); 50 assertEquals(new Font ("sansserif", 3, 10), fo.parse("sansserif-BOLDITALIC-10")); 51 52 assertTrue("defaults to a font", (fo.parse("true") instanceof Font )); 54 } 55 56 public void testFormat() { 57 FontOption fO1 = new FontOption("font.test2", Font.decode(null)); 58 59 assertEquals("monospaced-12", fO1.format(new Font ("monospaced", 0, 12))); 60 assertEquals("sansserif-BOLD-10", fO1.format(new Font ("sansserif", 1, 10))); 61 assertEquals("sansserif-BOLDITALIC-10", fO1.format(new Font ("sansserif", 3, 10))); 62 } 63 } 64 | Popular Tags |