naps2/NAPS2.Sdk.Tests/ImportExport/PdfATests.cs
Ben Olden-Cooligan 2f2211e1fc Partition most WinForms and non-SDK classes into appropriate projects
Tried this a couple times previously and failed due to difficulty getting it to compile, but now enough things have been rewritten that the extra work is minimal.
2022-06-18 17:25:19 -07:00

33 lines
1.0 KiB
C#

using NAPS2.Images.Gdi;
using NAPS2.ImportExport.Pdf;
using NAPS2.Sdk.Tests.Asserts;
using NAPS2.Sdk.Tests.Images;
using Xunit;
namespace NAPS2.Sdk.Tests.ImportExport;
public class PdfATests : ContextualTexts
{
[Fact]
public void Validate()
{
var pdfExporter = new PdfSharpExporter(ScanningContext);
var testCases = new (PdfCompat pdfCompat, string profile, string fileName)[]
{
(PdfCompat.PdfA1B, "PDF/A-1B", "pdfa1b_test.pdf"),
(PdfCompat.PdfA2B, "PDF/A-2B", "pdfa2b_test.pdf"),
(PdfCompat.PdfA3B, "PDF/A-3B", "pdfa3b_test.pdf"),
(PdfCompat.PdfA3U, "PDF/A-3U", "pdfa3u_test.pdf")
};
Parallel.ForEach(testCases, testCase =>
{
using var image = CreateScannedImage();
pdfExporter.Export(testCase.fileName, new[] { image }, new PdfExportParams
{
Compat = testCase.pdfCompat
}).Wait();
PdfAsserts.AssertCompliant(testCase.profile, testCase.fileName);
});
}
}