Skip to content

Commit a304a94

Browse files
committed
Merge branch 'release/7.0.1'
2 parents cd26d56 + d321ea7 commit a304a94

File tree

588 files changed

+22005
-7782
lines changed

Some content is hidden

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

588 files changed

+22005
-7782
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*.txt text eol=lf
1717
*.xfdf text eol=lf
1818
*.xml text eol=lf
19+
port-hash text eol=lf
1920

2021
# Declare files that will always have CRLF line endings on checkout.
2122
*.bat text eol=crlf

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*.user
1010
*.userosscache
1111
*.sln.docstates
12+
*.sln.metaproj
1213

1314
# User-specific files (MonoDevelop/Xamarin Studio)
1415
*.userprefs

itext.tests/itext.barcodes.tests/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
[assembly: AssemblyTitle("iText.Barcodes.Tests")]
@@ -15,5 +14,7 @@
1514

1615
[assembly: Guid("d015a3aa-613c-45d9-b908-7d47c4b613af")]
1716

18-
[assembly: AssemblyVersion("7.0.0.0")]
19-
[assembly: AssemblyFileVersion("7.0.0.0")]
17+
[assembly: AssemblyVersion("7.0.1.0")]
18+
[assembly: AssemblyFileVersion("7.0.1.0")]
19+
20+
[assembly: NUnit.Framework.Timeout(300000)]

itext.tests/itext.barcodes.tests/itext.barcodes.tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<Reference Include="System" />
3838
<Reference Include="System.Core" />
3939
<Reference Include="nunit.framework">
40-
<HintPath>..\..\packages\NUnit.3.2.1\lib\net40\nunit.framework.dll</HintPath>
40+
<HintPath>$(SolutionDir)\packages\NUnit.3.2.1\lib\net40\nunit.framework.dll</HintPath>
4141
</Reference>
4242
</ItemGroup>
4343
<ItemGroup>

itext.tests/itext.barcodes.tests/itext/barcodes/Barcode39Test.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ public static void BeforeClass() {
2424
[NUnit.Framework.Test]
2525
public virtual void Barcode01Test() {
2626
String filename = "barcode39_01.pdf";
27-
PdfWriter writer = new PdfWriter(destinationFolder + filename);
28-
PdfDocument document = new PdfDocument(writer);
27+
PdfDocument document = new PdfDocument(new PdfWriter(destinationFolder + filename));
2928
PdfPage page = document.AddNewPage();
3029
PdfCanvas canvas = new PdfCanvas(page);
3130
Barcode1D barcode = new Barcode39(document);
@@ -43,9 +42,8 @@ public virtual void Barcode01Test() {
4342
[NUnit.Framework.Test]
4443
public virtual void Barcode02Test() {
4544
String filename = "barcode39_02.pdf";
46-
PdfWriter writer = new PdfWriter(destinationFolder + filename);
47-
PdfReader reader = new PdfReader(sourceFolder + "DocumentWithTrueTypeFont1.pdf");
48-
PdfDocument document = new PdfDocument(reader, writer);
45+
PdfDocument document = new PdfDocument(new PdfReader(sourceFolder + "DocumentWithTrueTypeFont1.pdf"), new
46+
PdfWriter(destinationFolder + filename));
4947
PdfCanvas canvas = new PdfCanvas(document.GetLastPage());
5048
Barcode1D barcode = new Barcode39(document);
5149
barcode.SetCode("9781935182610");
@@ -58,8 +56,7 @@ public virtual void Barcode02Test() {
5856

5957
[NUnit.Framework.Test]
6058
public virtual void Barcode03Test() {
61-
PdfWriter writer = new PdfWriter(new ByteArrayOutputStream());
62-
PdfDocument document = new PdfDocument(writer);
59+
PdfDocument document = new PdfDocument(new PdfWriter(new ByteArrayOutputStream()));
6360
Barcode39 barcode = new Barcode39(document);
6461
try {
6562
Barcode39.GetBarsCode39("9781935*182610");

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodeQRCodeTest.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,27 @@ public virtual void Barcode02Test() {
5656
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
5757
+ "cmp_" + filename, destinationFolder, "diff_"));
5858
}
59+
60+
/// <exception cref="System.IO.IOException"/>
61+
/// <exception cref="iText.Kernel.PdfException"/>
62+
/// <exception cref="System.Exception"/>
63+
[NUnit.Framework.Test]
64+
public virtual void BarcodeVersioningTest() {
65+
String filename = "barcodeQRCodeVersioning.pdf";
66+
PdfWriter writer = new PdfWriter(destinationFolder + filename);
67+
PdfDocument document = new PdfDocument(writer);
68+
for (int i = -9; i < 42; i += 10) {
69+
PdfPage page1 = document.AddNewPage();
70+
PdfCanvas canvas = new PdfCanvas(page1);
71+
IDictionary<EncodeHintType, Object> hints = new Dictionary<EncodeHintType, Object>();
72+
hints[EncodeHintType.CHARACTER_SET] = "UTF-8";
73+
hints[EncodeHintType.MIN_VERSION_NR] = i;
74+
BarcodeQRCode barcode1 = new BarcodeQRCode("дима", hints);
75+
barcode1.PlaceBarcode(canvas, Color.GRAY, 3);
76+
}
77+
document.Close();
78+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
79+
+ "cmp_" + filename, destinationFolder, "diff_"));
80+
}
5981
}
6082
}
Binary file not shown.

itext.tests/itext.forms.tests/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
[assembly: AssemblyTitle("iText.Forms.Tests")]
@@ -15,5 +14,7 @@
1514

1615
[assembly: Guid("6fe2f714-6b3e-4b20-8c70-28bfce084ed2")]
1716

18-
[assembly: AssemblyVersion("7.0.0.0")]
19-
[assembly: AssemblyFileVersion("7.0.0.0")]
17+
[assembly: AssemblyVersion("7.0.1.0")]
18+
[assembly: AssemblyFileVersion("7.0.1.0")]
19+
20+
[assembly: NUnit.Framework.Timeout(300000)]

itext.tests/itext.forms.tests/itext.forms.tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<Reference Include="System" />
3737
<Reference Include="System.Core" />
3838
<Reference Include="nunit.framework">
39-
<HintPath>..\..\packages\NUnit.3.2.1\lib\net40\nunit.framework.dll</HintPath>
39+
<HintPath>$(SolutionDir)\packages\NUnit.3.2.1\lib\net40\nunit.framework.dll</HintPath>
4040
</Reference>
4141
<Reference Include="System.XML" />
4242
<Reference Include="System.Xml.Linq" />

itext.tests/itext.forms.tests/itext/forms/FormFieldFlatteningTest.cs

Lines changed: 102 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System;
2-
using System.IO;
2+
using iText.Forms.Fields;
33
using iText.Kernel.Pdf;
44
using iText.Kernel.Utils;
55
using iText.Test;
@@ -22,8 +22,7 @@ public static void BeforeClass() {
2222
public virtual void FormFlatteningTest01() {
2323
String srcFilename = sourceFolder + "formFlatteningSource.pdf";
2424
String filename = destinationFolder + "formFlatteningTest01.pdf";
25-
PdfDocument doc = new PdfDocument(new PdfReader(new FileStream(srcFilename, FileMode.Open, FileAccess.Read
26-
)), new PdfWriter(new FileStream(filename, FileMode.Create)));
25+
PdfDocument doc = new PdfDocument(new PdfReader(srcFilename), new PdfWriter(filename));
2726
PdfAcroForm form = PdfAcroForm.GetAcroForm(doc, true);
2827
form.FlattenFields();
2928
doc.Close();
@@ -34,5 +33,105 @@ public virtual void FormFlatteningTest01() {
3433
NUnit.Framework.Assert.Fail(errorMessage);
3534
}
3635
}
36+
37+
/// <exception cref="System.IO.IOException"/>
38+
/// <exception cref="System.Exception"/>
39+
[NUnit.Framework.Test]
40+
public virtual void FormFlatteningTest_DefaultAppearanceGeneration_Rot0() {
41+
String srcFilePattern = "FormFlatteningDefaultAppearance_0_";
42+
String destPattern = "FormFlatteningDefaultAppearance_0_";
43+
for (int i = 0; i < 360; i += 90) {
44+
String src = sourceFolder + srcFilePattern + i + ".pdf";
45+
String dest = destinationFolder + destPattern + i + "_flattened.pdf";
46+
String cmp = sourceFolder + "cmp_" + srcFilePattern + i + ".pdf";
47+
PdfDocument doc = new PdfDocument(new PdfReader(src), new PdfWriter(dest));
48+
PdfAcroForm form = PdfAcroForm.GetAcroForm(doc, true);
49+
foreach (PdfFormField field in form.GetFormFields().Values) {
50+
field.SetValue("Test");
51+
}
52+
form.FlattenFields();
53+
doc.Close();
54+
CompareTool compareTool = new CompareTool();
55+
String errorMessage = compareTool.CompareByContent(dest, cmp, destinationFolder, "diff_");
56+
if (errorMessage != null) {
57+
NUnit.Framework.Assert.Fail(errorMessage);
58+
}
59+
}
60+
}
61+
62+
/// <exception cref="System.IO.IOException"/>
63+
/// <exception cref="System.Exception"/>
64+
[NUnit.Framework.Test]
65+
public virtual void FormFlatteningTest_DefaultAppearanceGeneration_Rot90() {
66+
String srcFilePattern = "FormFlatteningDefaultAppearance_90_";
67+
String destPattern = "FormFlatteningDefaultAppearance_90_";
68+
for (int i = 0; i < 360; i += 90) {
69+
String src = sourceFolder + srcFilePattern + i + ".pdf";
70+
String dest = destinationFolder + destPattern + i + "_flattened.pdf";
71+
String cmp = sourceFolder + "cmp_" + srcFilePattern + i + ".pdf";
72+
PdfDocument doc = new PdfDocument(new PdfReader(src), new PdfWriter(dest));
73+
PdfAcroForm form = PdfAcroForm.GetAcroForm(doc, true);
74+
foreach (PdfFormField field in form.GetFormFields().Values) {
75+
field.SetValue("Test");
76+
}
77+
form.FlattenFields();
78+
doc.Close();
79+
CompareTool compareTool = new CompareTool();
80+
String errorMessage = compareTool.CompareByContent(dest, cmp, destinationFolder, "diff_");
81+
if (errorMessage != null) {
82+
NUnit.Framework.Assert.Fail(errorMessage);
83+
}
84+
}
85+
}
86+
87+
/// <exception cref="System.IO.IOException"/>
88+
/// <exception cref="System.Exception"/>
89+
[NUnit.Framework.Test]
90+
public virtual void FormFlatteningTest_DefaultAppearanceGeneration_Rot180() {
91+
String srcFilePattern = "FormFlatteningDefaultAppearance_180_";
92+
String destPattern = "FormFlatteningDefaultAppearance_180_";
93+
for (int i = 0; i < 360; i += 90) {
94+
String src = sourceFolder + srcFilePattern + i + ".pdf";
95+
String dest = destinationFolder + destPattern + i + "_flattened.pdf";
96+
String cmp = sourceFolder + "cmp_" + srcFilePattern + i + ".pdf";
97+
PdfDocument doc = new PdfDocument(new PdfReader(src), new PdfWriter(dest));
98+
PdfAcroForm form = PdfAcroForm.GetAcroForm(doc, true);
99+
foreach (PdfFormField field in form.GetFormFields().Values) {
100+
field.SetValue("Test");
101+
}
102+
form.FlattenFields();
103+
doc.Close();
104+
CompareTool compareTool = new CompareTool();
105+
String errorMessage = compareTool.CompareByContent(dest, cmp, destinationFolder, "diff_");
106+
if (errorMessage != null) {
107+
NUnit.Framework.Assert.Fail(errorMessage);
108+
}
109+
}
110+
}
111+
112+
/// <exception cref="System.IO.IOException"/>
113+
/// <exception cref="System.Exception"/>
114+
[NUnit.Framework.Test]
115+
public virtual void FormFlatteningTest_DefaultAppearanceGeneration_Rot270() {
116+
String srcFilePattern = "FormFlatteningDefaultAppearance_270_";
117+
String destPattern = "FormFlatteningDefaultAppearance_270_";
118+
for (int i = 0; i < 360; i += 90) {
119+
String src = sourceFolder + srcFilePattern + i + ".pdf";
120+
String dest = destinationFolder + destPattern + i + "_flattened.pdf";
121+
String cmp = sourceFolder + "cmp_" + srcFilePattern + i + ".pdf";
122+
PdfDocument doc = new PdfDocument(new PdfReader(src), new PdfWriter(dest));
123+
PdfAcroForm form = PdfAcroForm.GetAcroForm(doc, true);
124+
foreach (PdfFormField field in form.GetFormFields().Values) {
125+
field.SetValue("Test");
126+
}
127+
form.FlattenFields();
128+
doc.Close();
129+
CompareTool compareTool = new CompareTool();
130+
String errorMessage = compareTool.CompareByContent(dest, cmp, destinationFolder, "diff_");
131+
if (errorMessage != null) {
132+
NUnit.Framework.Assert.Fail(errorMessage);
133+
}
134+
}
135+
}
37136
}
38137
}

0 commit comments

Comments
 (0)