Skip to content

Commit 5620b00

Browse files
Kate IvanovaiText-CI
authored andcommitted
Add checkParentTreeIfFormXObjectTaggedTest
DEVSIX-3351
1 parent eec31c2 commit 5620b00

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,19 @@ This file is part of the iText (R) project.
5858
import com.itextpdf.kernel.pdf.PdfDictionary;
5959
import com.itextpdf.kernel.pdf.PdfDocument;
6060
import com.itextpdf.kernel.pdf.PdfName;
61+
import com.itextpdf.kernel.pdf.PdfPage;
6162
import com.itextpdf.kernel.pdf.PdfReader;
6263
import com.itextpdf.kernel.pdf.PdfVersion;
6364
import com.itextpdf.kernel.pdf.PdfWriter;
6465
import com.itextpdf.kernel.pdf.WriterProperties;
6566
import com.itextpdf.kernel.pdf.action.PdfAction;
6667
import com.itextpdf.kernel.pdf.annot.PdfLinkAnnotation;
68+
import com.itextpdf.kernel.pdf.canvas.PdfCanvas;
6769
import com.itextpdf.kernel.pdf.canvas.draw.SolidLine;
6870
import com.itextpdf.kernel.pdf.tagging.PdfStructureAttributes;
6971
import com.itextpdf.kernel.pdf.tagging.StandardRoles;
7072
import com.itextpdf.kernel.pdf.tagutils.TagTreePointer;
73+
import com.itextpdf.kernel.pdf.xobject.PdfFormXObject;
7174
import com.itextpdf.kernel.utils.CompareTool;
7275
import com.itextpdf.layout.borders.SolidBorder;
7376
import com.itextpdf.layout.element.IBlockElement;
@@ -1012,6 +1015,32 @@ public void notAsciiCharTest() throws IOException, InterruptedException, SAXExce
10121015
compareResult("notAsciiCharTest.pdf", "cmp_notAsciiCharTest.pdf");
10131016
}
10141017

1018+
@Test
1019+
//TODO update cmp-file after DEVSIX-3351 fixed
1020+
public void checkParentTreeIfFormXObjectTaggedTest() throws IOException, InterruptedException {
1021+
String outFileName = destinationFolder + "checkParentTreeIfFormXObjectTaggedTest.pdf";
1022+
String cmpPdf = sourceFolder + "cmp_checkParentTreeIfFormXObjectTaggedTest.pdf";
1023+
1024+
PdfDocument pdfDoc = new PdfDocument(new PdfWriter(outFileName));
1025+
pdfDoc.setTagged();
1026+
1027+
PdfPage page1 = pdfDoc.addNewPage();
1028+
1029+
Text txt = new Text("Text from XObject");
1030+
1031+
PdfFormXObject template = new PdfFormXObject(new Rectangle(150, 150));
1032+
Canvas canvas = new Canvas(template, pdfDoc);
1033+
canvas.enableAutoTagging(page1);
1034+
canvas.add(new Paragraph(txt));
1035+
1036+
PdfCanvas canvas1 = new PdfCanvas(page1);
1037+
canvas1.addXObject(template, 10, 10);
1038+
1039+
pdfDoc.close();
1040+
1041+
Assert.assertNull(new CompareTool().compareByContent(outFileName, cmpPdf, destinationFolder, "diff"));
1042+
}
1043+
10151044
@Test
10161045
public void createTaggedVersionOneDotFourTest01() throws IOException, InterruptedException, ParserConfigurationException, SAXException {
10171046
PdfDocument pdfDocument = new PdfDocument(new PdfWriter(destinationFolder + "createTaggedVersionOneDotFourTest01.pdf", new WriterProperties().setPdfVersion(PdfVersion.PDF_1_4)));

0 commit comments

Comments
 (0)