Skip to content

Commit 61935ad

Browse files
committed
Add test on conversion to a tagged doc with acroform
DEVSIX-4601
1 parent 6c9a7b2 commit 61935ad

10 files changed

+30
-4
lines changed

src/test/java/com/itextpdf/html2pdf/element/TaggedPdfFormTest.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ This file is part of the iText (R) project.
4646
import com.itextpdf.forms.PdfAcroForm;
4747
import com.itextpdf.html2pdf.ConverterProperties;
4848
import com.itextpdf.html2pdf.HtmlConverter;
49+
import com.itextpdf.kernel.PdfException;
4950
import com.itextpdf.kernel.pdf.PdfDocument;
5051
import com.itextpdf.kernel.pdf.PdfReader;
5152
import com.itextpdf.kernel.pdf.PdfWriter;
@@ -55,8 +56,10 @@ This file is part of the iText (R) project.
5556
import org.junit.Assert;
5657
import org.junit.BeforeClass;
5758
import org.junit.Ignore;
59+
import org.junit.Rule;
5860
import org.junit.Test;
5961
import org.junit.experimental.categories.Category;
62+
import org.junit.rules.ExpectedException;
6063

6164
import java.io.FileInputStream;
6265
import java.io.IOException;
@@ -73,6 +76,9 @@ public static void beforeClass() {
7376
createDestinationFolder(destinationFolder);
7477
}
7578

79+
@Rule
80+
public ExpectedException junitExpectedException = ExpectedException.none();
81+
7682
@Test
7783
public void simpleTextFieldTagged() throws IOException, InterruptedException {
7884
runTest("simpleTextFieldTagged");
@@ -124,13 +130,22 @@ public void simpleRadioFormTagged() throws IOException, InterruptedException {
124130

125131
@Test
126132
@Ignore("DEVSIX-980. DefaultHtmlProcessor ERROR No worker found for tag datalist")
127-
public void datalistFormTagged() throws IOException, InterruptedException {
128-
runTest("datalistFormTagged");
133+
public void dataListFormTagged() throws IOException, InterruptedException {
134+
runTest("dataListFormTagged");
135+
}
136+
137+
@Test
138+
public void fieldSetFormTagged() throws IOException, InterruptedException {
139+
runTest("fieldSetFormTagged");
129140
}
130141

131142
@Test
132-
public void fieldsetFormTagged() throws IOException, InterruptedException {
133-
runTest("fieldsetFormTagged");
143+
// TODO DEVSIX-4601
144+
// exception is thrown on "convert tagged PDF with acroform" stage
145+
public void inputFormPrematureFlush() throws IOException, InterruptedException {
146+
junitExpectedException.expect(PdfException.class);
147+
junitExpectedException.expectMessage(PdfException.TagStructureFlushingFailedItMightBeCorrupted);
148+
runTest("inputFormPrematureFlush");
134149
}
135150

136151
private void runTest(String name) throws IOException, InterruptedException {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
</head>
5+
<body>
6+
<form>
7+
<input type="text" value="value">
8+
<div style="page-break-before: always; font-size: 250px">Many words to result in many pages. Huge font to result in many pages.</div>
9+
</form>
10+
</body>
11+
</html>

0 commit comments

Comments
 (0)