|
| 1 | +package com.itextpdf.layout.renderer; |
| 2 | + |
| 3 | +import com.itextpdf.kernel.pdf.PdfDocument; |
| 4 | +import com.itextpdf.kernel.pdf.PdfWriter; |
| 5 | +import com.itextpdf.kernel.utils.CompareTool; |
| 6 | +import com.itextpdf.layout.Document; |
| 7 | +import com.itextpdf.layout.element.Cell; |
| 8 | +import com.itextpdf.layout.element.Table; |
| 9 | +import com.itextpdf.test.ExtendedITextTest; |
| 10 | +import com.itextpdf.test.annotations.type.IntegrationTest; |
| 11 | +import org.junit.Assert; |
| 12 | +import org.junit.Test; |
| 13 | +import org.junit.experimental.categories.Category; |
| 14 | + |
| 15 | +import java.io.File; |
| 16 | +import java.io.IOException; |
| 17 | + |
| 18 | +/** |
| 19 | + */ |
| 20 | +@Category(IntegrationTest.class) |
| 21 | +public class EmptyNestedTableTest extends ExtendedITextTest { |
| 22 | + |
| 23 | + public static final String sourceFolder = "./src/test/resources/com/itextpdf/layout/EmptyNestedTableTest/"; |
| 24 | + public static final String destinationFolder = "./target/test/com/itextpdf/layout/EmptyNestedTableTest/"; |
| 25 | + |
| 26 | + @Test |
| 27 | + public void buildEmptyTable() throws IOException, InterruptedException { |
| 28 | + |
| 29 | + String outFileName = destinationFolder + "emptNestedTableTest.pdf"; |
| 30 | + String cmpFileName = sourceFolder + "cmp_emptNestedTableTest.pdf"; |
| 31 | + |
| 32 | + // setup document |
| 33 | + PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFileName)); |
| 34 | + pdfDocument.setTagged(); |
| 35 | + Document layoutDocument = new Document(pdfDocument); |
| 36 | + |
| 37 | + // add table to document |
| 38 | + Table x = new Table(1).addCell(new Cell().add(new Table(1))); |
| 39 | + layoutDocument.add(x); |
| 40 | + |
| 41 | + // close document |
| 42 | + layoutDocument.close(); |
| 43 | + |
| 44 | + // compare |
| 45 | + Assert.assertNull(new CompareTool().compareByContent(outFileName, cmpFileName, destinationFolder, "diff")); |
| 46 | + } |
| 47 | + |
| 48 | +} |
0 commit comments