1 29 30 package nextapp.echo2.app.test; 31 32 import junit.framework.TestCase; 33 import nextapp.echo2.app.Color; 34 import nextapp.echo2.app.Component; 35 import nextapp.echo2.app.MutableStyle; 36 import nextapp.echo2.app.TextField; 37 38 41 public class StyleTest extends TestCase { 42 43 46 public void testStyle() { 47 MutableStyle style = new MutableStyle(); 48 style.setProperty(Component.PROPERTY_BACKGROUND, Color.GREEN); 49 50 TextField textField = new TextField(); 51 textField.setForeground(Color.YELLOW); 52 53 assertEquals(Color.YELLOW, textField.getRenderProperty(Component.PROPERTY_FOREGROUND)); 54 55 textField.setStyle(style); 56 57 assertEquals(Color.GREEN, textField.getRenderProperty(Component.PROPERTY_BACKGROUND)); 58 59 textField.setBackground(Color.BLUE); 60 61 assertEquals(Color.BLUE, textField.getRenderProperty(Component.PROPERTY_BACKGROUND)); 62 63 assertNull(textField.getRenderProperty(Component.PROPERTY_FONT)); 64 } 65 } 66 | Popular Tags |