1 29 30 package nextapp.echo2.app.test.componentxml; 31 32 import java.io.InputStream ; 33 34 import nextapp.echo2.app.Color; 35 import nextapp.echo2.app.Component; 36 import nextapp.echo2.app.ImageReference; 37 import nextapp.echo2.app.Insets; 38 import nextapp.echo2.app.ResourceImageReference; 39 import nextapp.echo2.app.Column; 40 import nextapp.echo2.app.Style; 41 import nextapp.echo2.app.StyleSheet; 42 import nextapp.echo2.app.componentxml.StyleSheetLoader; 43 import nextapp.echo2.app.layout.SplitPaneLayoutData; 44 import junit.framework.TestCase; 45 46 49 public class SplitPaneLayoutDataPeerTest extends TestCase { 50 51 private StyleSheet styleSheet; 52 53 56 public void setUp() 57 throws Exception { 58 InputStream in = FillImagePeerTest.class.getResourceAsStream("SplitPaneLayoutDataPeerTest.stylesheet"); 59 styleSheet = StyleSheetLoader.load(in, StyleSheetLoaderTest.class.getClassLoader()); 60 in.close(); 61 } 62 63 public void testBasic() { 64 Style alphaStyle = styleSheet.getStyle(Column.class, "alpha"); 65 SplitPaneLayoutData layoutData = (SplitPaneLayoutData) alphaStyle.getProperty(Component.PROPERTY_LAYOUT_DATA); 66 assertEquals(new Color(0xabcdef), layoutData.getBackground()); 67 assertEquals(new Insets(20, 30), layoutData.getInsets()); 68 assertNotNull(layoutData.getBackgroundImage()); 69 ImageReference imageReference = layoutData.getBackgroundImage().getImage(); 70 assertNotNull(imageReference); 71 assertTrue(imageReference instanceof ResourceImageReference); 72 assertEquals("nextapp/echo2/test/componentxml/BackgroundImage.png", 73 ((ResourceImageReference) imageReference).getResource()); 74 } 75 } 76 | Popular Tags |