forked from pipeline-foundation/itext7-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into devsecops
- Loading branch information
Showing
36 changed files
with
1,577 additions
and
156 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
itext.tests/itext.commons.tests/itext/commons/datastructures/Tuple2Test.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2023 Apryse Group NV | ||
Authors: Apryse Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using System; | ||
using iText.Test; | ||
|
||
namespace iText.Commons.Datastructures { | ||
[NUnit.Framework.Category("UnitTest")] | ||
public class Tuple2Test : ExtendedITextTest { | ||
[NUnit.Framework.Test] | ||
public virtual void TestTuple2_StringInt() { | ||
Tuple2<String, int> tuple = new Tuple2<String, int>("test", 1); | ||
NUnit.Framework.Assert.AreEqual("test", tuple.GetFirst()); | ||
NUnit.Framework.Assert.AreEqual(Convert.ToInt32(1), tuple.GetSecond()); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void TestTuple2_ToString() { | ||
Tuple2<String, int> tuple = new Tuple2<String, int>("test", 1); | ||
NUnit.Framework.Assert.AreEqual("Tuple2{first=test, second=1}", tuple.ToString()); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void TestTuple2_TestWithNullFirstValue() { | ||
Tuple2<String, int> tuple = new Tuple2<String, int>(null, 1); | ||
NUnit.Framework.Assert.IsNull(tuple.GetFirst()); | ||
NUnit.Framework.Assert.AreEqual(Convert.ToInt32(1), tuple.GetSecond()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
itext.tests/itext.kernel.tests/itext/kernel/utils/ValidationContainerTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2023 Apryse Group NV | ||
Authors: Apryse Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using System; | ||
using iText.Kernel.Pdf; | ||
using iText.Test; | ||
|
||
namespace iText.Kernel.Utils { | ||
[NUnit.Framework.Category("UnitTest")] | ||
public class ValidationContainerTest : ExtendedITextTest { | ||
[NUnit.Framework.Test] | ||
public virtual void ValidateObjectTest() { | ||
ValidationContainer container = new ValidationContainer(); | ||
container.Validate(null, IsoKey.FONT, null, null, null); | ||
ValidationContainerTest.CustomValidationChecker checker = new ValidationContainerTest.CustomValidationChecker | ||
(); | ||
container.AddChecker(checker); | ||
NUnit.Framework.Assert.IsTrue(container.ContainsChecker(checker)); | ||
NUnit.Framework.Assert.IsFalse(checker.objectValidationPerformed); | ||
container.Validate(null, IsoKey.FONT, null, null, null); | ||
NUnit.Framework.Assert.IsTrue(checker.objectValidationPerformed); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void ValidateDocumentTest() { | ||
ValidationContainer container = new ValidationContainer(); | ||
ValidationContext context = new ValidationContext().WithPdfDocument(null); | ||
container.Validate(context); | ||
ValidationContainerTest.CustomValidationChecker checker = new ValidationContainerTest.CustomValidationChecker | ||
(); | ||
container.AddChecker(checker); | ||
NUnit.Framework.Assert.IsFalse(checker.documentValidationPerformed); | ||
container.Validate(context); | ||
NUnit.Framework.Assert.IsTrue(checker.documentValidationPerformed); | ||
} | ||
|
||
private class CustomValidationChecker : IValidationChecker { | ||
public bool documentValidationPerformed = false; | ||
|
||
public bool objectValidationPerformed = false; | ||
|
||
public virtual void ValidateDocument(ValidationContext validationContext) { | ||
documentValidationPerformed = true; | ||
} | ||
|
||
public virtual void ValidateObject(Object obj, IsoKey key, PdfResources resources, PdfStream contentStream | ||
, Object extra) { | ||
objectValidationPerformed = true; | ||
} | ||
} | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
itext.tests/itext.kernel.tests/itext/kernel/utils/ValidationContextTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2023 Apryse Group NV | ||
Authors: Apryse Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using System.Collections.Generic; | ||
using iText.IO.Source; | ||
using iText.Kernel.Font; | ||
using iText.Kernel.Pdf; | ||
using iText.Test; | ||
|
||
namespace iText.Kernel.Utils { | ||
[NUnit.Framework.Category("UnitTest")] | ||
public class ValidationContextTest : ExtendedITextTest { | ||
[NUnit.Framework.Test] | ||
public virtual void WithDocumentsCheckTest() { | ||
ValidationContext context = new ValidationContext(); | ||
NUnit.Framework.Assert.IsNull(context.GetPdfDocument()); | ||
context.WithPdfDocument(new PdfDocument(new PdfWriter(new ByteArrayOutputStream()))); | ||
NUnit.Framework.Assert.IsNotNull(context.GetPdfDocument()); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void WithFontsCheckTest() { | ||
ValidationContext context = new ValidationContext(); | ||
NUnit.Framework.Assert.IsNull(context.GetFonts()); | ||
IList<PdfFont> fonts = new List<PdfFont>(); | ||
context.WithFonts(fonts); | ||
NUnit.Framework.Assert.IsNotNull(context.GetFonts()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+27.5 KB
itext.tests/itext.pdfa.tests/resources/itext/pdfa/cmp_tryToFlushFontTest.pdf
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
[assembly: AssemblyTitle("iText.Pdfua.Tests")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("Apryse Group NV")] | ||
[assembly: AssemblyProduct("iText")] | ||
[assembly: AssemblyCopyright("Copyright (c) 1998-2023 Apryse Group NV")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
[assembly: ComVisible(false)] | ||
|
||
[assembly: Guid("f542854e-7f6b-4207-b6ca-004a5d266e65")] | ||
|
||
[assembly: AssemblyVersion("8.0.3.0")] | ||
[assembly: AssemblyFileVersion("8.0.3.0")] | ||
[assembly: AssemblyInformationalVersion("8.0.3-SNAPSHOT")] | ||
|
||
#if !NETSTANDARD2_0 | ||
[assembly: NUnit.Framework.Timeout(300000)] | ||
#endif |
Oops, something went wrong.