Skip to content

Commit a019509

Browse files
committed
Add a test to demonstrate how a tab character is processed differently with different ways of paragraph creation.
DEVSIX-2473
1 parent a1a408c commit a019509

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

layout/src/test/java/com/itextpdf/layout/TabsTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,23 @@ public void tabsAnchorSemicolonTest03() throws IOException, InterruptedException
505505
Assert.assertNull(new CompareTool().compareByContent(outFileName, cmpFileName, destinationFolder, "diff"));
506506
}
507507

508+
@Test
509+
public void fillParagraphWithTabsDifferently() throws IOException, InterruptedException {
510+
String outFileName = destinationFolder + "fillParagraphWithTabsDifferently.pdf";
511+
String cmpFileName = sourceFolder + "cmp_fillParagraphWithTabsDifferently.pdf";
512+
513+
PdfDocument pdfDoc = new PdfDocument(new PdfWriter(outFileName));
514+
Document doc = new Document(pdfDoc);
515+
516+
doc.add(new Paragraph("a\tb"));
517+
doc.add(new Paragraph().add("a").add("\t").add("b"));
518+
doc.add(new Paragraph().add(new Text("a")).add(new Text("\t")).add(new Text("b")));
519+
520+
doc.close();
521+
522+
Assert.assertNull(new CompareTool().compareByContent(outFileName, cmpFileName, destinationFolder, "diff"));
523+
}
524+
508525
private Document initDocument(String outFileName) throws FileNotFoundException {
509526
return initDocument(outFileName, false);
510527
}

0 commit comments

Comments
 (0)