1 29 30 package nextapp.echo2.webcontainer.test; 31 32 import java.util.Locale ; 33 34 import junit.framework.TestCase; 35 import nextapp.echo2.app.LayoutDirection; 36 import nextapp.echo2.webcontainer.propertyrender.LayoutDirectionRender; 37 import nextapp.echo2.webrender.output.CssStyle; 38 39 43 public class LayoutDirectionRenderTest extends TestCase { 44 45 private static final Locale HEBREW = new Locale ("iw"); 46 47 public void test() { 48 CssStyle cssStyle = new CssStyle(); 49 LayoutDirectionRender.renderToStyle(cssStyle, LayoutDirection.LTR, null); 50 assertEquals("ltr", cssStyle.getAttribute("direction")); 51 LayoutDirectionRender.renderToStyle(cssStyle, LayoutDirection.RTL, null); 52 assertEquals("rtl", cssStyle.getAttribute("direction")); 53 54 LayoutDirectionRender.renderToStyle(cssStyle, LayoutDirection.LTR, Locale.US); 55 assertEquals("ltr", cssStyle.getAttribute("direction")); 56 LayoutDirectionRender.renderToStyle(cssStyle, LayoutDirection.RTL, HEBREW); 57 assertEquals("rtl", cssStyle.getAttribute("direction")); 58 59 LayoutDirectionRender.renderToStyle(cssStyle, LayoutDirection.LTR, Locale.US); 60 assertEquals("ltr", cssStyle.getAttribute("direction")); 61 LayoutDirectionRender.renderToStyle(cssStyle, LayoutDirection.RTL, HEBREW); 62 assertEquals("rtl", cssStyle.getAttribute("direction")); 63 64 LayoutDirectionRender.renderToStyle(cssStyle, null, Locale.US); 65 assertEquals("ltr", cssStyle.getAttribute("direction")); 66 LayoutDirectionRender.renderToStyle(cssStyle, null, HEBREW); 67 assertEquals("rtl", cssStyle.getAttribute("direction")); 68 } 69 70 public void testRenderCssAttributeValue() { 71 assertEquals("ltr", LayoutDirectionRender.renderCssAttributeValue(LayoutDirection.LTR)); 72 assertEquals("rtl", LayoutDirectionRender.renderCssAttributeValue(LayoutDirection.RTL)); 73 } 74 } 75 | Popular Tags |