Skip to content

Commit bf1c184

Browse files
guustysebieiText-CI
authored andcommitted
Enable interactivity for form fields with identical names across multiple pages
DEVSIX-7738 Autoported commit. Original commit hash: [381be881d]
1 parent 62c164a commit bf1c184

File tree

43 files changed

+8059
-11
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+8059
-11
lines changed

itext.tests/itext.html2pdf.tests/itext/html2pdf/element/FormTest.cs

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ You should have received a copy of the GNU Affero General Public License
2626
using iText.Forms.Fields;
2727
using iText.Forms.Logs;
2828
using iText.Html2pdf;
29+
using iText.Html2pdf.Logs;
30+
using iText.IO.Source;
2931
using iText.IO.Util;
3032
using iText.Kernel.Pdf;
3133
using iText.Kernel.Utils;
@@ -57,6 +59,38 @@ public virtual void TextFieldWithPlaceholderTest() {
5759
RunTest("textFieldWithPlaceholder");
5860
}
5961

62+
[NUnit.Framework.Test]
63+
public virtual void TextFieldHeadersFootersTest() {
64+
RunTest("textFieldHeadersFooters");
65+
}
66+
67+
[NUnit.Framework.Test]
68+
public virtual void TextFieldHeadersFootersWithValueTest() {
69+
RunTest("textFieldHeadersFootersWithValue");
70+
}
71+
72+
[NUnit.Framework.Test]
73+
public virtual void TextAreaHeadersFootersWithValueTest() {
74+
RunTest("textAreaHeadersFooters");
75+
}
76+
77+
[NUnit.Framework.Test]
78+
public virtual void CheckBoxHeadersFootersWithValueTest() {
79+
//TODO DEVSIX-7760 Adding formfield elements to header generates strange results
80+
RunTest("checkBoxHeadersFooters");
81+
}
82+
83+
[NUnit.Framework.Test]
84+
public virtual void RadioHeadersFootersWithValueTest() {
85+
//TODO DEVSIX-7760 Adding formfield elements to header generates strange results
86+
RunTest("radioHeadersFooters");
87+
}
88+
89+
[NUnit.Framework.Test]
90+
public virtual void DropDownHeadersFootersWithValueTest() {
91+
RunTest("dropDownHeadersFooters");
92+
}
93+
6094
[NUnit.Framework.Test]
6195
public virtual void SplitTextFieldTest() {
6296
RunTest("splitTextField");
@@ -218,6 +252,54 @@ public virtual void RadioButtonNoPageCounterTest() {
218252
, destinationFolder));
219253
}
220254

255+
[NUnit.Framework.Test]
256+
[LogMessage(Html2PdfLogMessageConstant.IMMEDIATE_FLUSH_DISABLED, LogLevel = LogLevelConstants.INFO)]
257+
public virtual void CheckLogInfo() {
258+
String html = sourceFolder + "radiobox1.html";
259+
using (FileStream fileInputStream = new FileStream(html, FileMode.Open, FileAccess.Read)) {
260+
using (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
261+
HtmlConverter.ConvertToPdf(fileInputStream, baos, new ConverterProperties().SetCreateAcroForm(true));
262+
}
263+
}
264+
}
265+
266+
[NUnit.Framework.Test]
267+
[LogMessage(Html2PdfLogMessageConstant.IMMEDIATE_FLUSH_DISABLED, LogLevel = LogLevelConstants.INFO, Count =
268+
0)]
269+
public virtual void CheckLogInfoNoAcroForm() {
270+
String html = sourceFolder + "radiobox1.html";
271+
using (FileStream fileInputStream = new FileStream(html, FileMode.Open, FileAccess.Read)) {
272+
using (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
273+
HtmlConverter.ConvertToPdf(fileInputStream, baos, new ConverterProperties().SetCreateAcroForm(false));
274+
}
275+
}
276+
}
277+
278+
[NUnit.Framework.Test]
279+
[LogMessage(Html2PdfLogMessageConstant.IMMEDIATE_FLUSH_DISABLED, LogLevel = LogLevelConstants.INFO, Count =
280+
0)]
281+
public virtual void CheckLogInfoAcroFormFlushDisabled() {
282+
String html = sourceFolder + "radiobox1.html";
283+
using (FileStream fileInputStream = new FileStream(html, FileMode.Open, FileAccess.Read)) {
284+
using (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
285+
HtmlConverter.ConvertToPdf(fileInputStream, baos, new ConverterProperties().SetCreateAcroForm(true).SetImmediateFlush
286+
(false));
287+
}
288+
}
289+
}
290+
291+
[NUnit.Framework.Test]
292+
[LogMessage(Html2PdfLogMessageConstant.IMMEDIATE_FLUSH_DISABLED, LogLevel = LogLevelConstants.INFO, Count =
293+
0)]
294+
public virtual void CheckLogInfoDefault() {
295+
String html = sourceFolder + "radiobox1.html";
296+
using (FileStream fileInputStream = new FileStream(html, FileMode.Open, FileAccess.Read)) {
297+
using (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
298+
HtmlConverter.ConvertToPdf(fileInputStream, baos);
299+
}
300+
}
301+
}
302+
221303
private void RunTest(String name) {
222304
RunTest(name, true);
223305
}

itext.tests/itext.html2pdf.tests/itext/html2pdf/element/TaggedPdfFormTest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,9 @@ public virtual void FieldSetFormTagged() {
9898
}
9999

100100
[NUnit.Framework.Test]
101+
[NUnit.Framework.Ignore("DEVSIX-4601 exception is thrown on \"convert tagged PDF with acroform\" stage")]
101102
public virtual void InputFormPrematureFlush() {
102103
NUnit.Framework.Assert.That(() => {
103-
// TODO DEVSIX-4601
104-
// exception is thrown on "convert tagged PDF with acroform" stage
105104
ConvertToPdfAcroformFlattenAndCompare("inputFormPrematureFlush", sourceFolder, destinationFolder, true);
106105
}
107106
, NUnit.Framework.Throws.InstanceOf<PdfException>().With.Message.EqualTo(KernelExceptionMessageConstant.TAG_STRUCTURE_FLUSHING_FAILED_IT_MIGHT_BE_CORRUPTED))

itext.tests/itext.html2pdf.tests/itext/html2pdf/element/TagsInsideButtonTest.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ You should have received a copy of the GNU Affero General Public License
2222
*/
2323
using System;
2424
using iText.Html2pdf;
25-
using iText.Kernel.Exceptions;
2625

2726
namespace iText.Html2pdf.Element {
2827
[NUnit.Framework.Category("IntegrationTest")]
@@ -65,12 +64,8 @@ public virtual void ButtonWithPInsideTagged() {
6564

6665
[NUnit.Framework.Test]
6766
public virtual void ButtonInsideMoreThanTwoAreas() {
68-
NUnit.Framework.Assert.That(() => {
69-
ConvertToPdfAcroformFlattenAndCompare("buttonInsideMoreThanTwoAreas", sourceFolder, destinationFolder, true
70-
);
71-
}
72-
, NUnit.Framework.Throws.InstanceOf<PdfException>())
73-
;
67+
ConvertToPdfAcroformFlattenAndCompare("buttonInsideMoreThanTwoAreas", sourceFolder, destinationFolder, true
68+
);
7469
}
7570
}
7671
}

0 commit comments

Comments
 (0)