Skip to content

Commit 971430f

Browse files
iText-CIpavel-alay
authored andcommitted
[RELEASE] Merge branch 'release/7.1.3'
2 parents a83e371 + adaac4d commit 971430f

File tree

345 files changed

+8118
-874
lines changed

Some content is hidden

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

345 files changed

+8118
-874
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

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

17-
[assembly: AssemblyVersion("7.1.2.0")]
18-
[assembly: AssemblyFileVersion("7.1.2.0")]
19-
[assembly: AssemblyInformationalVersion("7.1.2")]
17+
[assembly: AssemblyVersion("7.1.3.0")]
18+
[assembly: AssemblyFileVersion("7.1.3.0")]
19+
[assembly: AssemblyInformationalVersion("7.1.3")]
2020

2121
#if !NETSTANDARD1_6
2222
[assembly: NUnit.Framework.Timeout(300000)]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
<WarningLevel>4</WarningLevel>
3535
</PropertyGroup>
3636
<ItemGroup>
37-
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
38-
<HintPath>$(SolutionDir)\packages\NUnit.3.4.1\lib\net40\nunit.framework.dll</HintPath>
37+
<Reference Include="nunit.framework, Version=3.7.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
38+
<HintPath>$(SolutionDir)\packages\NUnit.3.7.1\lib\net40\nunit.framework.dll</HintPath>
3939
</Reference>
4040
<Reference Include="System" />
4141
<Reference Include="System.Core" />

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodeDataMatrixTest.cs

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,5 +175,102 @@ public virtual void Barcode06Test() {
175175
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
176176
+ "cmp_" + filename, destinationFolder, "diff_"));
177177
}
178+
179+
[NUnit.Framework.Test]
180+
public virtual void Barcode07Test() {
181+
BarcodeDataMatrix bc = new BarcodeDataMatrix();
182+
bc.SetOptions(BarcodeDataMatrix.DM_AUTO);
183+
bc.SetWidth(10);
184+
bc.SetHeight(10);
185+
String aCode = "aBCdeFG12";
186+
int result = bc.SetCode(aCode);
187+
NUnit.Framework.Assert.AreEqual(result, BarcodeDataMatrix.DM_ERROR_TEXT_TOO_BIG);
188+
}
189+
190+
[NUnit.Framework.Test]
191+
public virtual void Barcode08Test() {
192+
BarcodeDataMatrix barcodeDataMatrix = new BarcodeDataMatrix();
193+
barcodeDataMatrix.SetWidth(18);
194+
barcodeDataMatrix.SetHeight(18);
195+
int result = barcodeDataMatrix.SetCode("AbcdFFghijklmnopqrstuWXSQ");
196+
NUnit.Framework.Assert.AreEqual(BarcodeDataMatrix.DM_ERROR_TEXT_TOO_BIG, result);
197+
}
198+
199+
[NUnit.Framework.Test]
200+
public virtual void Barcode09Test() {
201+
BarcodeDataMatrix barcodeDataMatrix = new BarcodeDataMatrix();
202+
barcodeDataMatrix.SetWidth(17);
203+
barcodeDataMatrix.SetHeight(17);
204+
int result = barcodeDataMatrix.SetCode("AbcdFFghijklmnopqrstuWXSQ");
205+
NUnit.Framework.Assert.AreEqual(BarcodeDataMatrix.DM_ERROR_INVALID_SQUARE, result);
206+
}
207+
208+
[NUnit.Framework.Test]
209+
public virtual void Barcode10Test() {
210+
BarcodeDataMatrix barcodeDataMatrix = new BarcodeDataMatrix();
211+
barcodeDataMatrix.SetWidth(26);
212+
barcodeDataMatrix.SetHeight(12);
213+
int result = barcodeDataMatrix.SetCode("AbcdFFghijklmnopqrstuWXSQ");
214+
NUnit.Framework.Assert.AreEqual(BarcodeDataMatrix.DM_ERROR_TEXT_TOO_BIG, result);
215+
}
216+
217+
[NUnit.Framework.Test]
218+
public virtual void Barcode11Test() {
219+
BarcodeDataMatrix barcodeDataMatrix = new BarcodeDataMatrix();
220+
barcodeDataMatrix.SetWidth(18);
221+
barcodeDataMatrix.SetHeight(18);
222+
byte[] str = "AbcdFFghijklmnop".GetBytes();
223+
int result = barcodeDataMatrix.SetCode(str, 0, str.Length);
224+
NUnit.Framework.Assert.AreEqual(BarcodeDataMatrix.DM_NO_ERROR, result);
225+
}
226+
227+
[NUnit.Framework.Test]
228+
public virtual void Barcode12Test() {
229+
NUnit.Framework.Assert.That(() => {
230+
BarcodeDataMatrix barcodeDataMatrix = new BarcodeDataMatrix();
231+
barcodeDataMatrix.SetWidth(18);
232+
barcodeDataMatrix.SetHeight(18);
233+
byte[] str = "AbcdFFghijklmnop".GetBytes();
234+
barcodeDataMatrix.SetCode(str, -1, str.Length);
235+
}
236+
, NUnit.Framework.Throws.TypeOf<IndexOutOfRangeException>());
237+
;
238+
}
239+
240+
[NUnit.Framework.Test]
241+
public virtual void Barcode13Test() {
242+
NUnit.Framework.Assert.That(() => {
243+
BarcodeDataMatrix barcodeDataMatrix = new BarcodeDataMatrix();
244+
barcodeDataMatrix.SetWidth(18);
245+
barcodeDataMatrix.SetHeight(18);
246+
byte[] str = "AbcdFFghijklmnop".GetBytes();
247+
barcodeDataMatrix.SetCode(str, 0, str.Length + 1);
248+
}
249+
, NUnit.Framework.Throws.TypeOf<IndexOutOfRangeException>());
250+
;
251+
}
252+
253+
[NUnit.Framework.Test]
254+
public virtual void Barcode14Test() {
255+
NUnit.Framework.Assert.That(() => {
256+
BarcodeDataMatrix barcodeDataMatrix = new BarcodeDataMatrix();
257+
barcodeDataMatrix.SetWidth(18);
258+
barcodeDataMatrix.SetHeight(18);
259+
byte[] str = "AbcdFFghijklmnop".GetBytes();
260+
barcodeDataMatrix.SetCode(str, 0, -1);
261+
}
262+
, NUnit.Framework.Throws.TypeOf<IndexOutOfRangeException>());
263+
;
264+
}
265+
266+
[NUnit.Framework.Test]
267+
public virtual void Barcode15Test() {
268+
BarcodeDataMatrix barcodeDataMatrix = new BarcodeDataMatrix();
269+
barcodeDataMatrix.SetWidth(18);
270+
barcodeDataMatrix.SetHeight(18);
271+
byte[] str = "AbcdFFghijklmnop".GetBytes();
272+
int result = barcodeDataMatrix.SetCode(str, str.Length, 0);
273+
NUnit.Framework.Assert.AreEqual(BarcodeDataMatrix.DM_NO_ERROR, result);
274+
}
178275
}
179276
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2018 iText Group NV
4+
Authors: iText Software.
5+
6+
This program is free software; you can redistribute it and/or modify
7+
it under the terms of the GNU Affero General Public License version 3
8+
as published by the Free Software Foundation with the addition of the
9+
following permission added to Section 15 as permitted in Section 7(a):
10+
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
11+
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
12+
OF THIRD PARTY RIGHTS
13+
14+
This program is distributed in the hope that it will be useful, but
15+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16+
or FITNESS FOR A PARTICULAR PURPOSE.
17+
See the GNU Affero General Public License for more details.
18+
You should have received a copy of the GNU Affero General Public License
19+
along with this program; if not, see http://www.gnu.org/licenses or write to
20+
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21+
Boston, MA, 02110-1301 USA, or download the license from the following URL:
22+
http://itextpdf.com/terms-of-use/
23+
24+
The interactive user interfaces in modified source and object code versions
25+
of this program must display Appropriate Legal Notices, as required under
26+
Section 5 of the GNU Affero General Public License.
27+
28+
In accordance with Section 7(b) of the GNU Affero General Public License,
29+
a covered work must retain the producer line in every PDF that is created
30+
or manipulated using iText.
31+
32+
You can be released from the requirements of the license by purchasing
33+
a commercial license. Buying such a license is mandatory as soon as you
34+
develop commercial activities involving the iText software without
35+
disclosing the source code of your own applications.
36+
These activities include: offering paid services to customers as an ASP,
37+
serving PDFs on the fly in a web application, shipping iText with a closed
38+
source product.
39+
40+
For more information, please contact iText Software Corp. at this
41+
42+
*/
43+
using System.Threading;
44+
using NUnit.Framework;
45+
46+
namespace iText.Barcodes
47+
{
48+
public class BarcodeMultiThreadingTest
49+
{
50+
[Test]
51+
public void test() {
52+
Thread[] threads = new Thread[20];
53+
for (int i = 0; i < threads.Length; i++)
54+
{
55+
threads[i] = new Thread(DoWork);
56+
threads[i].Start();
57+
}
58+
59+
foreach (Thread thread in threads)
60+
thread.Join();
61+
}
62+
63+
private static void DoWork() {
64+
BarcodeDataMatrix bc = new BarcodeDataMatrix();
65+
bc.SetOptions(BarcodeDataMatrix.DM_AUTO);
66+
bc.SetWidth(10);
67+
bc.SetHeight(10);
68+
int result = bc.SetCode("AB01");
69+
Assert.AreEqual(BarcodeDataMatrix.DM_NO_ERROR, result);
70+
}
71+
}
72+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="NUnit" version="3.4.1" targetFramework="net40" />
3+
<package id="NUnit" version="3.7.1" targetFramework="net40" />
44
</packages>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

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

17-
[assembly: AssemblyVersion("7.1.2.0")]
18-
[assembly: AssemblyFileVersion("7.1.2.0")]
19-
[assembly: AssemblyInformationalVersion("7.1.2")]
17+
[assembly: AssemblyVersion("7.1.3.0")]
18+
[assembly: AssemblyFileVersion("7.1.3.0")]
19+
[assembly: AssemblyInformationalVersion("7.1.3")]
2020

2121
#if !NETSTANDARD1_6
2222
[assembly: NUnit.Framework.Timeout(300000)]

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
<WarningLevel>4</WarningLevel>
3434
</PropertyGroup>
3535
<ItemGroup>
36-
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
37-
<HintPath>$(SolutionDir)\packages\NUnit.3.4.1\lib\net40\nunit.framework.dll</HintPath>
36+
<Reference Include="nunit.framework, Version=3.7.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
37+
<HintPath>$(SolutionDir)\packages\NUnit.3.7.1\lib\net40\nunit.framework.dll</HintPath>
3838
</Reference>
3939
<Reference Include="System" />
4040
<Reference Include="System.Core" />
41-
<Reference Include="System.XML" />
41+
<Reference Include="System.Xml" />
4242
<Reference Include="System.Xml.Linq" />
4343
</ItemGroup>
4444
<ItemGroup>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' ">
2929
<Reference Include="System" />
3030
<Reference Include="System.Core" />
31-
<Reference Include="System.XML" />
31+
<Reference Include="System.Xml" />
3232
<Reference Include="System.Xml.Linq" />
3333
</ItemGroup>
3434
<ItemGroup>
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2018 iText Group NV
4+
Authors: iText Software.
5+
6+
This program is free software; you can redistribute it and/or modify
7+
it under the terms of the GNU Affero General Public License version 3
8+
as published by the Free Software Foundation with the addition of the
9+
following permission added to Section 15 as permitted in Section 7(a):
10+
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
11+
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
12+
OF THIRD PARTY RIGHTS
13+
14+
This program is distributed in the hope that it will be useful, but
15+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16+
or FITNESS FOR A PARTICULAR PURPOSE.
17+
See the GNU Affero General Public License for more details.
18+
You should have received a copy of the GNU Affero General Public License
19+
along with this program; if not, see http://www.gnu.org/licenses or write to
20+
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21+
Boston, MA, 02110-1301 USA, or download the license from the following URL:
22+
http://itextpdf.com/terms-of-use/
23+
24+
The interactive user interfaces in modified source and object code versions
25+
of this program must display Appropriate Legal Notices, as required under
26+
Section 5 of the GNU Affero General Public License.
27+
28+
In accordance with Section 7(b) of the GNU Affero General Public License,
29+
a covered work must retain the producer line in every PDF that is created
30+
or manipulated using iText.
31+
32+
You can be released from the requirements of the license by purchasing
33+
a commercial license. Buying such a license is mandatory as soon as you
34+
develop commercial activities involving the iText software without
35+
disclosing the source code of your own applications.
36+
These activities include: offering paid services to customers as an ASP,
37+
serving PDFs on the fly in a web application, shipping iText with a closed
38+
source product.
39+
40+
For more information, please contact iText Software Corp. at this
41+
42+
*/
43+
using System;
44+
using iText.Forms.Fields;
45+
using iText.IO.Util;
46+
using iText.Kernel.Pdf;
47+
using iText.Kernel.Utils;
48+
using iText.Test;
49+
50+
namespace iText.Forms {
51+
public class FlatteningRotatedTest : ExtendedITextTest {
52+
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
53+
.CurrentContext.TestDirectory) + "/resources/itext/forms/FlatteningRotatedTest/";
54+
55+
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
56+
+ "/test/itext/forms/FlatteningRotatedTest/";
57+
58+
[NUnit.Framework.OneTimeSetUp]
59+
public static void BeforeClass() {
60+
CreateOrClearDestinationFolder(destinationFolder);
61+
}
62+
63+
/// <exception cref="System.IO.IOException"/>
64+
/// <exception cref="System.Exception"/>
65+
[NUnit.Framework.Test]
66+
public virtual void FormFlatteningTest_DefaultAppearanceGeneration_Rot() {
67+
String srcFilePatternPattern = "FormFlatteningDefaultAppearance_{0}_";
68+
String destPatternPattern = "FormFlatteningDefaultAppearance_{0}_";
69+
String[] rotAngle = new String[] { "0", "90", "180", "270" };
70+
foreach (String angle in rotAngle) {
71+
String srcFilePattern = MessageFormatUtil.Format(srcFilePatternPattern, angle);
72+
String destPattern = MessageFormatUtil.Format(destPatternPattern, angle);
73+
for (int i = 0; i < 360; i += 90) {
74+
String src = sourceFolder + srcFilePattern + i + ".pdf";
75+
String dest = destinationFolder + destPattern + i + "_flattened.pdf";
76+
String cmp = sourceFolder + "cmp_" + srcFilePattern + i + ".pdf";
77+
PdfDocument doc = new PdfDocument(new PdfReader(src), new PdfWriter(dest));
78+
PdfAcroForm form = PdfAcroForm.GetAcroForm(doc, true);
79+
foreach (PdfFormField field in form.GetFormFields().Values) {
80+
field.SetValue("Test");
81+
}
82+
form.FlattenFields();
83+
doc.Close();
84+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(dest, cmp, destinationFolder, "diff_"));
85+
}
86+
}
87+
}
88+
}
89+
}

0 commit comments

Comments
 (0)