ParagraphCssApplier implements CssApplier<Paragraph> { public Paragraph apply(final Paragraph p, final Tag t, final MarginMemory configuration) { return apply(p, t, configuration, null, null); } ParagraphCssApplier(final CssAppliers appliers); Paragraph apply(final Paragraph p, final Tag t, final MarginMemory configuration); Paragraph apply(final Paragraph p, final Tag t, final MarginMemory configuration, final PageSizeContainable psc, final HtmlPipelineContext ctx);  }
@Test public void resolveAlignment() throws IOException { assertEquals(Element.ALIGN_LEFT, firstPara.getAlignment(), 0); first.getCSS().put("text-align", "right"); applier.apply(firstPara, first, configuration); assertEquals(Element.ALIGN_RIGHT, firstPara.getAlignment(), 0); first.getCSS().put("text-align", "left"); applier.apply(firstPara, first, configuration); assertEquals(Element.ALIGN_LEFT, firstPara.getAlignment(), 0); first.getCSS().put("text-align", "center"); applier.apply(firstPara, first, configuration); assertEquals(Element.ALIGN_CENTER, firstPara.getAlignment(), 0); }
@Test public void resolveFirstLineIndent() throws IOException { assertEquals(0f, firstPara.getFirstLineIndent(), 0); first.getCSS().put("text-indent", "16pt"); applier.apply(firstPara, first, configuration); assertEquals(16, firstPara.getFirstLineIndent(), 0); }
@Test public void resolveIndentationLeft() throws IOException { assertEquals(0f, firstPara.getIndentationLeft(), 0); first.getCSS().put("margin-left", "10pt"); applier.apply(firstPara, first, configuration); assertEquals(10, firstPara.getIndentationLeft(), 0); }
@Test public void resolveIndentationRight() throws IOException { assertEquals(0f, firstPara.getIndentationRight(), 0); first.getCSS().put("margin-right", "10pt"); applier.apply(firstPara, first, configuration); assertEquals(10, firstPara.getIndentationRight(), 0); }
@Test @Ignore public void resolveLeading() throws IOException { assertEquals(18f, firstPara.getLeading(), 0); first.getCSS().put("line-height", "25pt"); applier.apply(firstPara, first, configuration); assertEquals(25, firstPara.getLeading(), 0); child.getCSS().put("line-height", "19pt"); applier.apply(firstPara, first, configuration); assertEquals(25, firstPara.getLeading(), 0); child.getCSS().put("line-height", "30pt"); applier.apply(firstPara, first, configuration); assertEquals(30, firstPara.getLeading(), 0); }
@Test public void resolveSpacingAfter() throws IOException { assertEquals(0, firstPara.getSpacingBefore(), 0); second.getCSS().put("margin-bottom", "25pt"); applier.apply(secondPara, second, configuration); assertEquals(25, secondPara.getSpacingAfter(), 0); }
@Test public void resolveSpacingBeforeIs10() throws IOException { parent.addChild(second); first.getCSS().put("margin-bottom", "12pt"); second.getCSS().put("margin-top", "22pt"); applier.apply(firstPara, first, configuration); applier.apply(secondPara, second, configuration); assertEquals(22 - 12, secondPara.getSpacingBefore(), 0); }
@Test public void resolveSpacingBeforeIs5() throws IOException { parent.addChild(second); first.getCSS().put("margin-bottom", "25pt"); second.getCSS().put("margin-top", "30pt"); applier.apply(firstPara, first, configuration); applier.apply(secondPara, second, configuration); assertEquals(30 - 25, secondPara.getSpacingBefore(), 0); }
@Test public void resolveSpacingBeforeIs0() throws IOException { parent.addChild(second); first.getCSS().put("margin-bottom", "35pt"); second.getCSS().put("margin-top", "30pt"); applier.apply(firstPara, first, configuration); applier.apply(secondPara, second, configuration); assertEquals(0, secondPara.getSpacingBefore(), 0); }
@Test public void resolveSpacingBeforeIs6() throws IOException { parent.addChild(second); first.getCSS().put("margin-bottom", "2em"); second.getCSS().put("margin-top", "30pt"); applier.apply(firstPara, first, configuration); applier.apply(secondPara, second, configuration); assertEquals(30 - (2 * 12), secondPara.getSpacingBefore(), 0); }
@Test public void resolveSpacingBeforeIs24() throws IOException { parent.addChild(second); first.getCSS().put("margin-bottom", "2em"); first.getCSS().put(CSS.Property.FONT_SIZE, "18"); first.getCSS().put(CSS.Property.FONT_SIZE, fst.translateFontSize(first) + "pt"); second.getCSS().put("margin-top", "60pt"); applier.apply(firstPara, first, configuration); applier.apply(secondPara, second, configuration); assertEquals(60 - (2 * 13.5f), secondPara.getSpacingBefore(), 0); }
@Test public void resolveSpacingBeforeIs12() throws IOException { parent.addChild(second); first.getCSS().put("margin-bottom", "2em"); first.getCSS().put(CSS.Property.FONT_SIZE, "2em"); first.getCSS().put(CSS.Property.FONT_SIZE, fst.translateFontSize(first) + "pt"); second.getCSS().put("margin-top", "60pt"); applier.apply(firstPara, first, configuration); applier.apply(secondPara, second, configuration); assertEquals(60 - (2 * 12 * 2), secondPara.getSpacingBefore(), 0); }