Skip to content

Commit c4c121e

Browse files
author
Benoit Lagae
committed
Add second test to ascertain right field is found
DEVSIX-1357
1 parent 741b02f commit c4c121e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

forms/src/test/java/com/itextpdf/forms/PdfFormFieldTest.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,17 @@ public void unicodeFormFieldTest() throws IOException {
136136
PdfDocument pdfDoc = new PdfDocument(new PdfReader(filename));
137137
PdfAcroForm form = PdfAcroForm.getAcroForm(pdfDoc, true);
138138
Map<String, PdfFormField> formFields = form.getFormFields();
139-
byte[] result = {(byte) 0xFE,(byte) 0xFF,(byte) 0x5E,(byte) 0x10,(byte) 0x53,(byte) 0xF7,(byte) 0x00,(byte) 0x31}; // 帐号1: account number 1
140-
Assert.assertArrayEquals(formFields.keySet().toArray(new String[1])[0].getBytes(), result);
139+
String fieldName = "\u5E10\u53F71"; // 帐号1: account number 1
140+
Assert.assertEquals(formFields.keySet().toArray(new String[1])[0], fieldName);
141+
}
142+
143+
@Test
144+
public void unicodeFormFieldTest2() throws IOException {
145+
String filename = sourceFolder + "unicodeFormFieldFile.pdf";
146+
PdfDocument pdfDoc = new PdfDocument(new PdfReader(filename));
147+
PdfAcroForm form = PdfAcroForm.getAcroForm(pdfDoc, true);
148+
String fieldName = "\u5E10\u53F71"; // 帐号1: account number 1
149+
Assert.assertNotNull(form.getField(fieldName));
141150
}
142151

143152
@Test

0 commit comments

Comments
 (0)