Agregar archivos de proyecto.

This commit is contained in:
2026-05-27 17:09:59 +02:00
parent 73b30b7de7
commit 03813aff5a
9144 changed files with 4026729 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("TSpdf.Test.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("TSpdf")]
[assembly: AssemblyProduct("TSpdf")]
[assembly: AssemblyCopyright("Copyright (c) 1987-2023 TSpdf")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("f9880dc4-f015-4413-af86-66d0e9512774")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]

View File

@@ -0,0 +1,56 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<SignAssembly>True</SignAssembly>
<DelaySign>False</DelaySign>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net461;net48</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net461' ">
<OutputType>library</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<OutputType>Library</OutputType>
<DefineConstants>NETSTANDARD2_0</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>TSpdf.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ApplicationIcon />
<OutputTypeEx>library</OutputTypeEx>
<StartupObject></StartupObject>
<RootNamespace />
<AssemblyName>TSpdf.pdftest.tests</AssemblyName>
</PropertyGroup>
<PropertyGroup>
<NoWarn>1701;1702;1591;1570;1572;1573;1574;1580;1584;1658</NoWarn>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="TeamCity.VSTest.TestAdapter" Version="1.0.0" />
<PackageReference Include="NUnit" Version="3.7.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>15.0.0</Version>
</PackageReference>
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation">
<Version>4.3.0</Version>
</PackageReference>
</ItemGroup>
</Project>

Binary file not shown.

View File

@@ -0,0 +1,133 @@
/*
This file is part of the TSpdf (R) project.
Copyright (c) 1987-2023 TSpdf
Authors: TSpdf Software.
This program is offered under a commercial and under the AGPL license.
For commercial licensing, contact us at https://TSpdfpdf.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;
namespace TSpdf.Test {
[NUnit.Framework.Category("UnitTest")]
public class LoggerHelperTest : ExtendedTSpdfTest {
[NUnit.Framework.Test]
public virtual void NotEqualMessageWithSimilarStartTest() {
String pattern = "There might be a message: {0} with text.";
String example = "There might be a message: TEMP with text. And add some other text.";
NUnit.Framework.Assert.IsFalse(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
[NUnit.Framework.Test]
public virtual void NotEqualMessageWithSimilarEndTest() {
String pattern = "a message: {0} with text.";
String example = "There might be a message: TEMP with text.";
NUnit.Framework.Assert.IsFalse(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
[NUnit.Framework.Test]
public virtual void EqualsMessageByTemplate() {
String pattern = "There might be a message: {0}";
String example = String.Format(pattern, "message");
NUnit.Framework.Assert.IsTrue(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
[NUnit.Framework.Test]
public virtual void EqualsMessageByTemplateWithEmptyParameter() {
String pattern = "There might be a message: {0}";
String example = String.Format(pattern, "message");
NUnit.Framework.Assert.IsTrue(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
[NUnit.Framework.Test]
public virtual void EqualsMessageByTemplateWithMultipleParameters() {
String pattern = "There might be messages: {0} {1}";
String example = String.Format(pattern, "message1", "message2");
NUnit.Framework.Assert.IsTrue(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
[NUnit.Framework.Test]
public virtual void EqualsMessageByTemplateWithQuotes() {
String pattern = "There might be a message '': {0}";
String example = "There might be a message ': message";
NUnit.Framework.Assert.IsTrue(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
[NUnit.Framework.Test]
public virtual void EqualsMessageByTemplateWithCyrillic() {
String pattern = "There might be a cyrillic message: {0}";
String example = String.Format(pattern, "сообщение");
NUnit.Framework.Assert.IsTrue(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
[NUnit.Framework.Test]
public virtual void EqualsMessageByTemplateWithAsterisks() {
String pattern = "some text * *** {0}";
String example = String.Format(pattern, "message");
NUnit.Framework.Assert.IsTrue(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
[NUnit.Framework.Test]
public virtual void EqualsMessageByTemplateWithBrackets() {
String pattern = "some text ( ) (0) ( {0}";
String example = String.Format(pattern, "message");
NUnit.Framework.Assert.IsTrue(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
[NUnit.Framework.Test]
public virtual void EqualsMessageByTemplateWithSquareBrackets() {
String pattern = "some text [ ] [0] [ {0}";
String example = String.Format(pattern, "message");
NUnit.Framework.Assert.IsTrue(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
[NUnit.Framework.Test]
public virtual void EqualsMessageByTemplateWithQuestionSign() {
String pattern = "some text ? ??? .*? {0}";
String example = String.Format(pattern, "message");
NUnit.Framework.Assert.IsTrue(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
[NUnit.Framework.Test]
public virtual void EqualsMessageByTemplateWithDot() {
String pattern = "some text . ... .* {0}";
String example = String.Format(pattern, "message");
NUnit.Framework.Assert.IsTrue(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
[NUnit.Framework.Test]
public virtual void EqualsMessageByTemplateWithBraces() {
String pattern = "some text {} {a} { {0}";
String example = "some text {} {a} { message";
NUnit.Framework.Assert.IsTrue(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
[NUnit.Framework.Test]
public virtual void EqualsComplicatedMessageByTemplate() {
String pattern = "Not supported list style type ? {a} [b] . * (not working) {0}";
String example = "Not supported list style type ? {a} [b] . * (not working) *some phrase instead of template*";
NUnit.Framework.Assert.IsTrue(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
[NUnit.Framework.Test]
public virtual void NotEqualsMessageByTemplate() {
String pattern = "There might be a message: {0}";
String example = "There should be a message: message";
NUnit.Framework.Assert.IsFalse(LogListenerHelper.EqualsMessageByTemplate(example, pattern));
}
}
}

View File

@@ -0,0 +1,80 @@
/*
This file is part of the TSpdf (R) project.
Copyright (c) 1987-2023 TSpdf
Authors: TSpdf Software.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation with the addition of the
following permission added to Section 15 as permitted in Section 7(a):
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
TSpdf GROUP. TSpdf GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
OF THIRD PARTY RIGHTS
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 http://www.gnu.org/licenses or write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA, 02110-1301 USA, or download the license from the following URL:
http://TSpdfpdf.com/terms-of-use/
The interactive user interfaces in modified source and object code versions
of this program must display Appropriate Legal Notices, as required under
Section 5 of the GNU Affero General Public License.
In accordance with Section 7(b) of the GNU Affero General Public License,
a covered work must retain the producer line in every PDF that is created
or manipulated using TSpdf.
You can be released from the requirements of the license by purchasing
a commercial license. Buying such a license is mandatory as soon as you
develop commercial activities involving the TSpdf software without
disclosing the source code of your own applications.
These activities include: offering paid services to customers as an ASP,
serving PDFs on the fly in a web application, shipping TSpdf with a closed
source product.
For more information, please contact TSpdf Software Corp. at this
address: sales@TSpdfpdf.com
*/
using System;
using TSpdf.Test.Pdfa;
using TSpdf.Test.Utils;
namespace TSpdf.Test {
// Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf\a validation on Android)
[NUnit.Framework.Category("UnitTest")]
public class VeraPdfLoggerValidationTest : ExtendedTSpdfTest {
internal static readonly String SOURCE_FOLDER = TSpdf.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
.CurrentContext.TestDirectory) + "/resources/TSpdf/pdftest/cmp/VeraPdfLoggerValidationTest/";
internal static readonly String DESTINATION_FOLDER = NUnit.Framework.TestContext.CurrentContext.TestDirectory
+ "/test/TSpdf/pdftest/VeraPdfLoggerValidationTest/";
[NUnit.Framework.OneTimeSetUp]
public static void BeforeClass() {
CreateDestinationFolder(DESTINATION_FOLDER);
}
[NUnit.Framework.Test]
public virtual void CheckValidatorLogsTest() {
String fileNameWithWarnings = "cmp_pdfA2b_checkValidatorLogsTest_with_warnings.pdf";
String fileNameWithoutWarnings = "cmp_pdfA2b_checkValidatorLogsTest.pdf";
FileUtil.Copy(SOURCE_FOLDER + fileNameWithWarnings, DESTINATION_FOLDER + fileNameWithWarnings);
FileUtil.Copy(SOURCE_FOLDER + fileNameWithoutWarnings, DESTINATION_FOLDER + fileNameWithoutWarnings);
String expectedWarningsForFileWithWarnings = "The following warnings and errors were logged during validation:\n"
+ "WARNING: Invalid embedded cff font. Charset range exceeds number of glyphs\n" + "WARNING: Missing OutputConditionIdentifier in an output intent dictionary\n"
+ "WARNING: The Top DICT does not begin with ROS operator";
NUnit.Framework.Assert.AreEqual(expectedWarningsForFileWithWarnings, new VeraPdfValidator().Validate(DESTINATION_FOLDER
+ fileNameWithWarnings));
// Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf\a validation on Android)
//We check that the logs are empty after the first check
NUnit.Framework.Assert.IsNull(new VeraPdfValidator().Validate(DESTINATION_FOLDER + fileNameWithoutWarnings
));
}
// Android-Conversion-Skip-Line (TODO DEVSIX-7377 introduce pdf\a validation on Android)
}
}