1 29 30 package nextapp.echo2.webcontainer.test; 31 32 import junit.framework.TestCase; 33 import nextapp.echo2.app.Extent; 34 import nextapp.echo2.app.Insets; 35 import nextapp.echo2.webcontainer.propertyrender.InsetsRender; 36 import nextapp.echo2.webrender.output.CssStyle; 37 38 41 public class InsetsRenderTest extends TestCase { 42 43 private static final Extent EXTENT_1_PX = new Extent(1, Extent.PX); 44 private static final Extent EXTENT_2_PX = new Extent(2, Extent.PX); 45 private static final Extent EXTENT_3_PX = new Extent(3, Extent.PX); 46 private static final Extent EXTENT_4_PX = new Extent(4, Extent.PX); 47 private static final Extent EXTENT_2_PT = new Extent(2, Extent.PT); 48 49 public void testRenderUnique() { 50 CssStyle cssStyle = new CssStyle(); 51 InsetsRender.renderToStyle(cssStyle, "padding", new Insets(EXTENT_1_PX, EXTENT_2_PX, EXTENT_3_PX, EXTENT_4_PX)); 52 assertEquals("2px 3px 4px 1px", cssStyle.getAttribute("padding")); 53 } 54 55 public void testRenderHV() { 56 CssStyle cssStyle = new CssStyle(); 57 InsetsRender.renderToStyle(cssStyle, "padding", new Insets(EXTENT_2_PX, EXTENT_2_PT)); 58 assertEquals("2pt 2px 2pt 2px", cssStyle.getAttribute("padding")); 59 } 60 61 public void testRenderSame() { 62 CssStyle cssStyle = new CssStyle(); 63 InsetsRender.renderToStyle(cssStyle, "padding", new Insets(EXTENT_2_PT)); 64 assertEquals("2pt", cssStyle.getAttribute("padding")); 65 } 66 } 67 | Popular Tags |