mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-07-16 06:53:57 +08:00
more build system c# version fixes
This commit is contained in:
parent
44ee6d394f
commit
92f9af613f
@ -758,14 +758,17 @@
|
||||
var one = IntegrationHelpers.GetDocumentPath("Single Page Simple - from open office.pdf");
|
||||
var two = IntegrationHelpers.GetDocumentPath("Single Page Simple - from inkscape.pdf");
|
||||
|
||||
using var docOne = PdfDocument.Open(one);
|
||||
using var docTwo = PdfDocument.Open(two);
|
||||
|
||||
using (var docOne = PdfDocument.Open(one))
|
||||
using (var docTwo = PdfDocument.Open(two))
|
||||
{
|
||||
var builder = new PdfDocumentBuilder();
|
||||
builder.AddPage(docOne, 1);
|
||||
builder.AddPage(docTwo, 1);
|
||||
var result = builder.Build();
|
||||
PdfMergerTests.CanMerge2SimpleDocumentsAssertions(new MemoryStream(result), "I am a simple pdf.", "Write something inInkscape", false);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanMerge2SimpleDocuments_Builder()
|
||||
@ -773,23 +776,28 @@
|
||||
var one = IntegrationHelpers.GetDocumentPath("Single Page Simple - from inkscape.pdf");
|
||||
var two = IntegrationHelpers.GetDocumentPath("Single Page Simple - from open office.pdf");
|
||||
|
||||
using var docOne = PdfDocument.Open(one);
|
||||
using var docTwo = PdfDocument.Open(two);
|
||||
var builder = new PdfDocumentBuilder();
|
||||
using (var docOne = PdfDocument.Open(one))
|
||||
using (var docTwo = PdfDocument.Open(two))
|
||||
using (var builder = new PdfDocumentBuilder())
|
||||
{
|
||||
|
||||
builder.AddPage(docOne, 1);
|
||||
builder.AddPage(docTwo, 1);
|
||||
var result = builder.Build();
|
||||
PdfMergerTests.CanMerge2SimpleDocumentsAssertions(new MemoryStream(result), "Write something inInkscape", "I am a simple pdf.", false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanDedupObjectsFromSameDoc_Builder()
|
||||
{
|
||||
var one = IntegrationHelpers.GetDocumentPath("Multiple Page - from Mortality Statistics.pdf");
|
||||
|
||||
using var doc = PdfDocument.Open(one);
|
||||
|
||||
using var builder = new PdfDocumentBuilder();
|
||||
using (var doc = PdfDocument.Open(one))
|
||||
{
|
||||
var builder = new PdfDocumentBuilder();
|
||||
builder.AddPage(doc, 1);
|
||||
builder.AddPage(doc, 1);
|
||||
|
||||
@ -802,16 +810,16 @@
|
||||
"Expected object count to be lower than 30"); // 45 objects with duplicates, 29 with correct re-use
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanDedupObjectsFromDifferentDoc_HashBuilder()
|
||||
{
|
||||
var one = IntegrationHelpers.GetDocumentPath("Multiple Page - from Mortality Statistics.pdf");
|
||||
|
||||
using var doc = PdfDocument.Open(one);
|
||||
using var doc2 = PdfDocument.Open(one);
|
||||
|
||||
using var builder = new PdfDocumentBuilder(new MemoryStream(), true, PdfWriterType.ObjectInMemoryDedup);
|
||||
using (var doc = PdfDocument.Open(one))
|
||||
using (var doc2 = PdfDocument.Open(one))
|
||||
using (var builder = new PdfDocumentBuilder(new MemoryStream(), true, PdfWriterType.ObjectInMemoryDedup))
|
||||
{
|
||||
builder.AddPage(doc, 1);
|
||||
builder.AddPage(doc2, 1);
|
||||
|
||||
@ -824,6 +832,7 @@
|
||||
"Expected object count to be lower than 30"); // 45 objects with duplicates, 29 with correct re-use
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[InlineData("Single Page Simple - from google drive.pdf")]
|
||||
[InlineData("Old Gutnish Internet Explorer.pdf")]
|
||||
@ -834,10 +843,11 @@
|
||||
{
|
||||
var docPath = IntegrationHelpers.GetDocumentPath(name);
|
||||
|
||||
using var doc = PdfDocument.Open(docPath, ParsingOptions.LenientParsingOff);
|
||||
using (var doc = PdfDocument.Open(docPath, ParsingOptions.LenientParsingOff))
|
||||
using (var builder = new PdfDocumentBuilder())
|
||||
{
|
||||
var count1 = GetCounts(doc);
|
||||
|
||||
using var builder = new PdfDocumentBuilder();
|
||||
for (var i = 1; i <= doc.NumberOfPages; i++)
|
||||
{
|
||||
builder.AddPage(doc, i);
|
||||
@ -850,6 +860,8 @@
|
||||
Assert.Equal(count1.Item1, count2.Item1);
|
||||
Assert.Equal(count1.Item2, count2.Item2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
(int, double) GetCounts(PdfDocument toCount)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user