Skip to content

Commit bef08aa

Browse files
AlexanderRasolkoiText-CI
authored andcommitted
Add setFont3Ways test
Autoported commit. Original commit hash: [45f468b06]
1 parent 6348c03 commit bef08aa

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

itext.tests/itext.forms.tests/itext/forms/PdfFormFieldTest.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,5 +1109,32 @@ private void FillAcroForm(PdfDocument pdfDocument, String text) {
11091109
field.SetValue(text);
11101110
}
11111111
}
1112+
1113+
/// <exception cref="System.IO.IOException"/>
1114+
/// <exception cref="System.Exception"/>
1115+
[NUnit.Framework.Test]
1116+
public virtual void SetFont3Ways() {
1117+
String filename = destinationFolder + "setFont3Ways.pdf";
1118+
String cmpFilename = sourceFolder + "cmp_setFont3Ways.pdf";
1119+
String testString = "Don't cry over spilt milk";
1120+
PdfDocument pdfDocument = new PdfDocument(new PdfWriter(filename));
1121+
PdfAcroForm form = PdfAcroForm.GetAcroForm(pdfDocument, true);
1122+
PdfFont font = PdfFontFactory.CreateFont(sourceFolder + "SILEOT.ttf", PdfEncodings.IDENTITY_H);
1123+
Rectangle rect1 = new Rectangle(10, 700, 200, 25);
1124+
Rectangle rect2 = new Rectangle(30, 600, 200, 25);
1125+
Rectangle rect3 = new Rectangle(50, 500, 200, 25);
1126+
PdfButtonFormField pushButton1 = PdfFormField.CreatePushButton(pdfDocument, rect1, "Name1", testString, font
1127+
, 12);
1128+
form.AddField(pushButton1);
1129+
PdfButtonFormField pushButton2 = PdfFormField.CreatePushButton(pdfDocument, rect2, "Name2", testString);
1130+
pushButton2.SetFontAndSize(font, 12f);
1131+
form.AddField(pushButton2);
1132+
PdfButtonFormField pushButton3 = PdfFormField.CreatePushButton(pdfDocument, rect3, "Name3", testString);
1133+
pushButton3.SetFont(font).SetFontSize(12);
1134+
form.AddField(pushButton3);
1135+
pdfDocument.Close();
1136+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(filename, cmpFilename, destinationFolder,
1137+
"diff_"));
1138+
}
11121139
}
11131140
}

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6a55637d164803cefe92a179be8a4ba89ace0fc8
1+
45f468b0629c65f523da4a10581c348cc1be541e

0 commit comments

Comments
 (0)