Skip to content

Commit 5a694e8

Browse files
committed
[RELEASE] iText 7 7.2.1
2 parents 196af4a + d3118a1 commit 5a694e8

File tree

1,484 files changed

+7293
-2994
lines changed

Some content is hidden

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

1,484 files changed

+7293
-2994
lines changed

doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
3232
# title of most generated pages and in a few other places.
3333
# The default value is: My Project.
3434

35-
PROJECT_NAME = "iText 7 7.2.0 API"
35+
PROJECT_NAME = "iText 7 7.2.1 API"
3636

3737
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
3838
# could be handy for archiving the generated documentation or if some version

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.2.0.0")]
18-
[assembly: AssemblyFileVersion("7.2.0.0")]
19-
[assembly: AssemblyInformationalVersion("7.2.0")]
17+
[assembly: AssemblyVersion("7.2.1.0")]
18+
[assembly: AssemblyFileVersion("7.2.1.0")]
19+
[assembly: AssemblyInformationalVersion("7.2.1")]
2020

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

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodePDF417Test.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public virtual void Barcode417XObjectTest() {
160160
BarcodePDF417 barcode = new BarcodePDF417();
161161
barcode.SetCode(text);
162162
PdfFormXObject xObject = barcode.CreateFormXObject(document);
163-
canvas.AddXObject(xObject, 10, 650);
163+
canvas.AddXObjectAt(xObject, 10, 650);
164164
document.Close();
165165
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
166166
+ "cmp_" + filename, destinationFolder));

itext.tests/itext.commons.tests/Properties/AssemblyInfo.cs

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

1616
[assembly: Guid("502eda37-c014-4822-8e5c-4e5d21b085e9")]
1717

18-
[assembly: AssemblyVersion("7.2.0.0")]
19-
[assembly: AssemblyFileVersion("7.2.0.0")]
20-
[assembly: AssemblyInformationalVersion("7.2.0")]
18+
[assembly: AssemblyVersion("7.2.1.0")]
19+
[assembly: AssemblyFileVersion("7.2.1.0")]
20+
[assembly: AssemblyInformationalVersion("7.2.1")]
2121

2222
#if !NETSTANDARD2_0
2323
[assembly: NUnit.Framework.Timeout(300000)]

itext.tests/itext.commons.tests/itext/commons/actions/ProductEventHandlerTest.cs

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2020
You should have received a copy of the GNU Affero General Public License
2121
along with this program. If not, see <https://www.gnu.org/licenses/>.
2222
*/
23+
using System;
2324
using iText.Commons.Actions.Confirmations;
25+
using iText.Commons.Actions.Processors;
2426
using iText.Commons.Actions.Sequence;
2527
using iText.Commons.Ecosystem;
2628
using iText.Commons.Exceptions;
@@ -29,14 +31,20 @@ You should have received a copy of the GNU Affero General Public License
2931

3032
namespace iText.Commons.Actions {
3133
public class ProductEventHandlerTest : ExtendedITextTest {
34+
[NUnit.Framework.SetUp]
35+
public virtual void ClearProcessors() {
36+
ProductEventHandler.INSTANCE.ClearProcessors();
37+
}
38+
3239
[NUnit.Framework.Test]
3340
public virtual void UnknownProductTest() {
3441
ProductEventHandler handler = ProductEventHandler.INSTANCE;
35-
NUnit.Framework.Assert.That(() => {
36-
handler.OnAcceptedEvent(new ITextTestEvent(new SequenceId(), null, "test-event", "Unknown Product"));
37-
}
38-
, NUnit.Framework.Throws.InstanceOf<UnknownProductException>().With.Message.EqualTo(MessageFormatUtil.Format(UnknownProductException.UNKNOWN_PRODUCT, "Unknown Product")))
39-
;
42+
AbstractContextBasedITextEvent @event = new ITextTestEvent(new SequenceId(), null, "test-event", "Unknown Product"
43+
);
44+
Exception ex = NUnit.Framework.Assert.Catch(typeof(UnknownProductException), () => handler.OnAcceptedEvent
45+
(@event));
46+
NUnit.Framework.Assert.AreEqual(MessageFormatUtil.Format(UnknownProductException.UNKNOWN_PRODUCT, "Unknown Product"
47+
), ex.Message);
4048
}
4149

4250
[NUnit.Framework.Test]
@@ -83,5 +91,63 @@ public virtual void ConfirmEventTest() {
8391
NUnit.Framework.Assert.AreEqual(@event, ((ConfirmedEventWrapper)handler.GetEvents(sequenceId)[0]).GetEvent
8492
());
8593
}
94+
95+
[NUnit.Framework.Test]
96+
public virtual void RepeatEventHandlingWithFiveExceptionOnProcessingTest() {
97+
ProductEventHandler handler = ProductEventHandler.INSTANCE;
98+
handler.AddProcessor(new ProductEventHandlerTest.RepeatEventProcessor(5));
99+
AbstractContextBasedITextEvent @event = new ITextTestEvent(new SequenceId(), null, "test", ProductNameConstant
100+
.ITEXT_CORE);
101+
Exception e = NUnit.Framework.Assert.Catch(typeof(ProductEventHandlerRepeatException), () => handler.OnAcceptedEvent
102+
(@event));
103+
NUnit.Framework.Assert.AreEqual("customMessage5", e.Message);
104+
}
105+
106+
[NUnit.Framework.Test]
107+
public virtual void RepeatEventHandlingWithFourExceptionOnProcessingTest() {
108+
ProductEventHandler handler = ProductEventHandler.INSTANCE;
109+
handler.AddProcessor(new ProductEventHandlerTest.RepeatEventProcessor(4));
110+
AbstractContextBasedITextEvent @event = new ITextTestEvent(new SequenceId(), null, "test", ProductNameConstant
111+
.ITEXT_CORE);
112+
NUnit.Framework.Assert.DoesNotThrow(() => handler.OnAcceptedEvent(@event));
113+
}
114+
115+
[NUnit.Framework.Test]
116+
public virtual void RepeatEventHandlingWithOneExceptionOnProcessingTest() {
117+
ProductEventHandler handler = ProductEventHandler.INSTANCE;
118+
handler.AddProcessor(new ProductEventHandlerTest.RepeatEventProcessor(1));
119+
AbstractContextBasedITextEvent @event = new ITextTestEvent(new SequenceId(), null, "test", ProductNameConstant
120+
.ITEXT_CORE);
121+
NUnit.Framework.Assert.DoesNotThrow(() => handler.OnAcceptedEvent(@event));
122+
}
123+
124+
private class RepeatEventProcessor : ITextProductEventProcessor {
125+
private readonly int exceptionsCount;
126+
127+
private int exceptionCounter = 0;
128+
129+
public RepeatEventProcessor(int exceptionsCount) {
130+
this.exceptionsCount = exceptionsCount;
131+
}
132+
133+
public virtual void OnEvent(AbstractProductProcessITextEvent @event) {
134+
if (exceptionCounter < exceptionsCount) {
135+
exceptionCounter++;
136+
throw new ProductEventHandlerRepeatException("customMessage" + exceptionCounter);
137+
}
138+
}
139+
140+
public virtual String GetProductName() {
141+
return ProductNameConstant.ITEXT_CORE;
142+
}
143+
144+
public virtual String GetUsageType() {
145+
return "someUsage";
146+
}
147+
148+
public virtual String GetProducer() {
149+
return "someProducer";
150+
}
151+
}
86152
}
87153
}

itext.tests/itext.commons.tests/itext/commons/actions/data/ProductDataTest.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ public virtual void ProductDataCreationTest() {
3434
NUnit.Framework.Assert.AreEqual(2100, productData.GetToCopyrightYear());
3535
}
3636

37+
[NUnit.Framework.Test]
38+
public virtual void ProductDataAnotherCreationTest() {
39+
ProductData productData = new ProductData("publicProductName", "productName", "1.2", "4.0.0", 1900, 2100);
40+
NUnit.Framework.Assert.AreEqual("publicProductName", productData.GetPublicProductName());
41+
NUnit.Framework.Assert.AreEqual("productName", productData.GetProductName());
42+
NUnit.Framework.Assert.AreEqual("1.2", productData.GetVersion());
43+
NUnit.Framework.Assert.AreEqual("4.0.0", productData.GetMinCompatibleLicensingModuleVersion());
44+
NUnit.Framework.Assert.AreEqual(1900, productData.GetSinceCopyrightYear());
45+
NUnit.Framework.Assert.AreEqual(2100, productData.GetToCopyrightYear());
46+
}
47+
3748
[NUnit.Framework.Test]
3849
public virtual void EqualsTest() {
3950
ProductData a = new ProductData("publicProductName", "productName", "1.2", 1900, 2100);

itext.tests/itext.commons.tests/itext/commons/utils/DateTimeUtilTest.cs

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,51 @@ You should have received a copy of the GNU Affero General Public License
2222
*/
2323
using System;
2424
using iText.Test;
25+
using NUnit.Framework;
2526

2627
namespace iText.Commons.Utils {
2728
public class DateTimeUtilTest : ExtendedITextTest {
28-
[NUnit.Framework.Test]
29+
30+
private const double ZERO_DELTA = 1e-6;
31+
private const double ONE_SECOND_DELTA = 1000.0;
32+
33+
[Test]
2934
public virtual void GetCurrentTest() {
3035
DateTime date = DateTime.Now;
31-
NUnit.Framework.Assert.AreEqual(date.ToString(), DateTimeUtil.GetCurrentTime().ToString());
36+
Assert.AreEqual(date.ToString(), DateTimeUtil.GetCurrentTime().ToString());
3237
}
3338

34-
[NUnit.Framework.Test]
39+
[Test]
3540
public virtual void IsInPastTest() {
3641
DateTime date = new DateTime(1);
37-
NUnit.Framework.Assert.IsTrue(DateTimeUtil.IsInPast(date));
42+
Assert.IsTrue(DateTimeUtil.IsInPast(date));
43+
}
44+
45+
[Test]
46+
[NUnit.Framework.Ignore("DEVSIX-6043 - Unignore this tests after the specified ticket will be resolved")]
47+
public void ParseDateAndGetUtcMillisFromEpochTest() {
48+
DateTime parsedDate = DateTimeUtil.GetCalendar(DateTimeUtil.ParseWithDefaultPattern("2020-05-05"));
49+
double millisFromEpochTo2020_05_05 = DateTimeUtil.GetUtcMillisFromEpoch(parsedDate);
50+
51+
long offset = DateTimeUtil.GetCurrentTimeZoneOffset();
52+
Assert.AreEqual(1588636800000d - offset, millisFromEpochTo2020_05_05, ZERO_DELTA);
53+
}
54+
55+
[Test]
56+
public void CompareUtcMillisFromEpochWithNullParamAndCurrentTimeTest() {
57+
double getUtcMillisFromEpochWithNullParam = DateTimeUtil.GetUtcMillisFromEpoch(null);
58+
double millisFromEpochToCurrentTime = DateTimeUtil.GetUtcMillisFromEpoch(DateTimeUtil.GetCurrentUtcTime());
59+
60+
Assert.AreEqual(millisFromEpochToCurrentTime, getUtcMillisFromEpochWithNullParam, ONE_SECOND_DELTA);
61+
}
62+
63+
[Test]
64+
[NUnit.Framework.Ignore("DEVSIX-6043 - Unignore this tests after the specified ticket will be resolved")]
65+
public void ParseDateAndGetRelativeTimeTest() {
66+
long relativeTime = DateTimeUtil.GetRelativeTime(DateTimeUtil.ParseWithDefaultPattern("2020-05-05"));
67+
68+
long offset = DateTimeUtil.GetCurrentTimeZoneOffset();
69+
Assert.AreEqual(1588636800000d - offset, relativeTime, ZERO_DELTA);
3870
}
3971
}
4072
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2021 iText Group NV
4+
Authors: iText Software.
5+
6+
This program is offered under a commercial and under the AGPL license.
7+
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below.
8+
9+
AGPL licensing:
10+
This program is free software: you can redistribute it and/or modify
11+
it under the terms of the GNU Affero General Public License as published by
12+
the Free Software Foundation, either version 3 of the License, or
13+
(at your option) any later version.
14+
15+
This program is distributed in the hope that it will be useful,
16+
but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
GNU Affero General Public License for more details.
19+
20+
You should have received a copy of the GNU Affero General Public License
21+
along with this program. If not, see <https://www.gnu.org/licenses/>.
22+
*/
23+
using System;
24+
using iText.Test;
25+
26+
namespace iText.Commons.Utils {
27+
public class ProcessInfoTest : ExtendedITextTest {
28+
[NUnit.Framework.Test]
29+
public virtual void GetExitCodeTest() {
30+
int exitCode = 1;
31+
ProcessInfo processInfo = new ProcessInfo(exitCode, null, null);
32+
NUnit.Framework.Assert.AreEqual(exitCode, processInfo.GetExitCode());
33+
}
34+
35+
[NUnit.Framework.Test]
36+
public virtual void GetProcessStdOutput() {
37+
String stdOutput = "output";
38+
ProcessInfo processInfo = new ProcessInfo(0, stdOutput, null);
39+
NUnit.Framework.Assert.AreEqual(stdOutput, processInfo.GetProcessStdOutput());
40+
}
41+
42+
[NUnit.Framework.Test]
43+
public virtual void GetProcessErrOutput() {
44+
String stdOutput = "output";
45+
ProcessInfo processInfo = new ProcessInfo(0, null, stdOutput);
46+
NUnit.Framework.Assert.AreEqual(stdOutput, processInfo.GetProcessErrOutput());
47+
}
48+
}
49+
}

itext.tests/itext.commons.tests/itext/commons/utils/SystemUtilTest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,5 +158,18 @@ public virtual void RunProcessAndWaitWithWorkingDirectoryTest() {
158158
NUnit.Framework.Assert.False(result);
159159
NUnit.Framework.Assert.True(FileUtil.FileExists(diff));
160160
}
161+
162+
[NUnit.Framework.Test]
163+
public void RunProcessAndGetProcessInfoTest() {
164+
String imageMagickPath = SystemUtil.GetEnvironmentVariable(MAGICK_COMPARE_ENVIRONMENT_VARIABLE);
165+
if (imageMagickPath == null) {
166+
imageMagickPath = SystemUtil.GetEnvironmentVariable(MAGICK_COMPARE_ENVIRONMENT_VARIABLE_LEGACY);
167+
}
168+
169+
ProcessInfo processInfo = SystemUtil.RunProcessAndGetProcessInfo(imageMagickPath,"--version");
170+
171+
NUnit.Framework.Assert.NotNull(processInfo);
172+
NUnit.Framework.Assert.AreEqual(0, processInfo.GetExitCode());
173+
}
161174
}
162175
}

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.2.0.0")]
18-
[assembly: AssemblyFileVersion("7.2.0.0")]
19-
[assembly: AssemblyInformationalVersion("7.2.0")]
17+
[assembly: AssemblyVersion("7.2.1.0")]
18+
[assembly: AssemblyFileVersion("7.2.1.0")]
19+
[assembly: AssemblyInformationalVersion("7.2.1")]
2020

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

itext.tests/itext.io.tests/Properties/AssemblyInfo.cs

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

1616
[assembly: Guid("a53a5dd3-787b-4563-8778-1d76bdad57ba")]
1717

18-
[assembly: AssemblyVersion("7.2.0.0")]
19-
[assembly: AssemblyFileVersion("7.2.0.0")]
20-
[assembly: AssemblyInformationalVersion("7.2.0")]
18+
[assembly: AssemblyVersion("7.2.1.0")]
19+
[assembly: AssemblyFileVersion("7.2.1.0")]
20+
[assembly: AssemblyInformationalVersion("7.2.1")]
2121

2222
#if !NETSTANDARD2_0
2323
[assembly: NUnit.Framework.Timeout(300000)]

0 commit comments

Comments
 (0)