1 29 30 package nextapp.echo2.app.test.componentxml; 31 32 import java.io.InputStream ; 33 34 import nextapp.echo2.app.Alignment; 35 import nextapp.echo2.app.Label; 36 import nextapp.echo2.app.Style; 37 import nextapp.echo2.app.StyleSheet; 38 import nextapp.echo2.app.componentxml.StyleSheetLoader; 39 import junit.framework.TestCase; 40 41 44 public class AlignmentPeerTest extends TestCase { 45 46 private StyleSheet styleSheet; 47 48 51 public void setUp() 52 throws Exception { 53 InputStream in = AlignmentPeerTest.class.getResourceAsStream("AlignmentPeerTest.stylesheet"); 54 styleSheet = StyleSheetLoader.load(in, StyleSheetLoaderTest.class.getClassLoader()); 55 in.close(); 56 } 57 58 public void testAlignment() { 59 Style alphaStyle = styleSheet.getStyle(Label.class, "alpha"); 60 Alignment alignment = (Alignment) alphaStyle.getProperty(Label.PROPERTY_TEXT_POSITION); 61 assertNotNull(alignment); 62 assertEquals(Alignment.CENTER, alignment.getHorizontal()); 63 assertEquals(Alignment.BOTTOM, alignment.getVertical()); 64 } 65 66 public void testDefault() { 67 Style bravoStyle = styleSheet.getStyle(Label.class, "bravo"); 68 Alignment alignment = (Alignment) bravoStyle.getProperty(Label.PROPERTY_TEXT_POSITION); 69 assertNotNull(alignment); 70 assertEquals(Alignment.DEFAULT, alignment.getHorizontal()); 71 assertEquals(Alignment.DEFAULT, alignment.getVertical()); 72 } 73 } 74 | Popular Tags |