CssUtils { public Map<String, String> parseBorder(final String border) { return parseBorder(border, null); } private  CssUtils(); static CssUtils getInstance(); Map<String, String> parseBoxValues(final java.lang.String box,
                                             final java.lang.String pre, final java.lang.String post); Map<String, String> parseBoxValues(final String box,
                                              final String pre, final String post, String preKey); Map<String, String> parseBorder(final String border); Map<String, String> parseBorder(final String border, final String borderKey); String stripDoubleSpacesAndTrim(final String str); String stripDoubleSpacesTrimAndToLowerCase(final String str); Map<String, String> processBackground(final String background); Map<String, String> processListStyle(final String listStyle); Map<String, String> processFont(final String font); float checkMetricStyle(final Tag t, final String style); Float checkMetricStyle(final Map<String,String> css, final String style); boolean isMetricValue(final String value); boolean isRelativeValue(final String value); boolean isNumericValue(final String value); float parseValueToPt(final String value, final float baseValue); float parseRelativeValue(final String relativeValue, final float baseValue); float parsePxInCmMmPcToPt(final String length, final String defaultMetric); float parsePxInCmMmPcToPt(final String length); int determinePositionBetweenValueAndUnit(final String string); float getLeftAndRightMargin(final Tag t, final float pageWidth); String extractUrl(final String url); float validateTextHeight(final Map<String, String> css,
			float textHeight); float calculateMarginTop(final String value, final float largestFont, final MarginMemory configuration); float calculateMarginTop(final float value, final MarginMemory configuration); String trimAndRemoveQuoutes(String s); String[] splitComplexCssStyle(String s); static final int DEFAULT_FONT_SIZE_PT; }
@Test public void parseBorder() { String border = "dashed"; Map<String, String> map = css.parseBorder(border); Assert.assertTrue(map.containsKey("border-left-style")); Assert.assertEquals("dashed", map.get("border-left-style")); Assert.assertTrue(map.containsKey("border-top-style")); Assert.assertEquals("dashed", map.get("border-top-style")); Assert.assertTrue(map.containsKey("border-bottom-style")); Assert.assertEquals("dashed", map.get("border-bottom-style")); Assert.assertTrue(map.containsKey("border-right-style")); Assert.assertEquals("dashed", map.get("border-right-style")); }
@Test public void parseBorder2() { String border = "dashed green"; Map<String, String> map = css.parseBorder(border); Assert.assertTrue(map.containsKey("border-left-style")); Assert.assertEquals("dashed", map.get("border-left-style")); Assert.assertTrue(map.containsKey("border-top-style")); Assert.assertEquals("dashed", map.get("border-top-style")); Assert.assertTrue(map.containsKey("border-bottom-style")); Assert.assertEquals("dashed", map.get("border-bottom-style")); Assert.assertTrue(map.containsKey("border-right-style")); Assert.assertEquals("dashed", map.get("border-right-style")); Assert.assertTrue(map.containsKey("border-left-color")); Assert.assertEquals("green", map.get("border-left-color")); Assert.assertTrue(map.containsKey("border-top-color")); Assert.assertEquals("green", map.get("border-top-color")); Assert.assertTrue(map.containsKey("border-bottom-color")); Assert.assertEquals("green", map.get("border-bottom-color")); Assert.assertTrue(map.containsKey("border-right-color")); Assert.assertEquals("green", map.get("border-right-color")); }
@Test public void parseBorder3() { String border = "1px dashed"; Map<String, String> map = css.parseBorder(border); Assert.assertTrue(map.containsKey("border-left-style")); Assert.assertEquals("dashed", map.get("border-left-style")); Assert.assertTrue(map.containsKey("border-top-style")); Assert.assertEquals("dashed", map.get("border-top-style")); Assert.assertTrue(map.containsKey("border-bottom-style")); Assert.assertEquals("dashed", map.get("border-bottom-style")); Assert.assertTrue(map.containsKey("border-right-style")); Assert.assertEquals("dashed", map.get("border-right-style")); Assert.assertTrue(map.containsKey("border-left-width")); Assert.assertEquals("1px", map.get("border-left-width")); Assert.assertTrue(map.containsKey("border-top-width")); Assert.assertEquals("1px", map.get("border-top-width")); Assert.assertTrue(map.containsKey("border-bottom-width")); Assert.assertEquals("1px", map.get("border-bottom-width")); Assert.assertTrue(map.containsKey("border-right-width")); Assert.assertEquals("1px", map.get("border-right-width")); }
@Test public void parseBorder4() { String border = "1px dashed green"; Map<String, String> map = css.parseBorder(border); Assert.assertTrue(map.containsKey("border-left-style")); Assert.assertEquals("dashed", map.get("border-left-style")); Assert.assertTrue(map.containsKey("border-top-style")); Assert.assertEquals("dashed", map.get("border-top-style")); Assert.assertTrue(map.containsKey("border-bottom-style")); Assert.assertEquals("dashed", map.get("border-bottom-style")); Assert.assertTrue(map.containsKey("border-right-style")); Assert.assertEquals("dashed", map.get("border-right-style")); Assert.assertTrue(map.containsKey("border-left-color")); Assert.assertEquals("green", map.get("border-left-color")); Assert.assertTrue(map.containsKey("border-top-color")); Assert.assertEquals("green", map.get("border-top-color")); Assert.assertTrue(map.containsKey("border-bottom-color")); Assert.assertEquals("green", map.get("border-bottom-color")); Assert.assertTrue(map.containsKey("border-right-color")); Assert.assertEquals("green", map.get("border-right-color")); Assert.assertTrue(map.containsKey("border-left-width")); Assert.assertEquals("1px", map.get("border-left-width")); Assert.assertTrue(map.containsKey("border-top-width")); Assert.assertEquals("1px", map.get("border-top-width")); Assert.assertTrue(map.containsKey("border-bottom-width")); Assert.assertEquals("1px", map.get("border-bottom-width")); Assert.assertTrue(map.containsKey("border-right-width")); Assert.assertEquals("1px", map.get("border-right-width")); Assert.assertTrue(map.containsKey("border-left-width")); Assert.assertEquals("1px", map.get("border-left-width")); Assert.assertTrue(map.containsKey("border-top-width")); Assert.assertEquals("1px", map.get("border-top-width")); Assert.assertTrue(map.containsKey("border-bottom-width")); Assert.assertEquals("1px", map.get("border-bottom-width")); Assert.assertTrue(map.containsKey("border-right-width")); Assert.assertEquals("1px", map.get("border-right-width")); }