Skip to content

Commit 0e17d65

Browse files
JonPReillyiText-CI
authored andcommitted
Add test. DEVSIX-2187
Autoported commit. Original commit hash: [5b04a612e]
1 parent 7b23118 commit 0e17d65

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

itext.tests/itext.forms.tests/itext/forms/PdfFormCopyTest.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,31 @@ public virtual void CopyFieldsTest05() {
168168
, destinationFolder, "diff_"));
169169
}
170170

171+
/// <exception cref="System.IO.IOException"/>
172+
/// <exception cref="System.Exception"/>
173+
[NUnit.Framework.Test]
174+
[LogMessage(iText.IO.LogMessageConstant.DOCUMENT_ALREADY_HAS_FIELD, Count = 2)]
175+
public virtual void CopyMultipleSubfieldsTest01() {
176+
String srcFilename = sourceFolder + "copyMultipleSubfieldsTest01.pdf";
177+
String destFilename = destinationFolder + "copyMultipleSubfieldsTest01.pdf";
178+
PdfDocument srcDoc = new PdfDocument(new PdfReader(srcFilename));
179+
PdfDocument destDoc = new PdfDocument(new PdfWriter(destFilename));
180+
PdfPageFormCopier pdfPageFormCopier = new PdfPageFormCopier();
181+
// copying the same page from the same document twice
182+
for (int i = 0; i < 2; ++i) {
183+
srcDoc.CopyPagesTo(1, 1, destDoc, pdfPageFormCopier);
184+
}
185+
PdfAcroForm acroForm = PdfAcroForm.GetAcroForm(destDoc, false);
186+
acroForm.GetField("text_1").SetValue("Text 1!");
187+
acroForm.GetField("text_2").SetValue("Text 2!");
188+
acroForm.GetField("text.3").SetValue("Text 3!");
189+
acroForm.GetField("text.4").SetValue("Text 4!");
190+
destDoc.Close();
191+
srcDoc.Close();
192+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destFilename, sourceFolder + "cmp_copyMultipleSubfieldsTest01.pdf"
193+
, destinationFolder, "diff_"));
194+
}
195+
171196
/// <exception cref="System.IO.IOException"/>
172197
/// <exception cref="System.Exception"/>
173198
[NUnit.Framework.Test]

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c8dc9feec441f2ed9b46c8a5c3b75978eb017f6b
1+
5b04a612e5541d864c1d8bbc4932176e39ece268

0 commit comments

Comments
 (0)