mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-20 03:17:57 +08:00
add test coverage for invalid document from #33
This commit is contained in:
@@ -16,5 +16,17 @@
|
||||
|
||||
return Path.Combine(documentFolder, name);
|
||||
}
|
||||
|
||||
public static string GetSpecificTestDocumentPath(string name, bool isPdf = true)
|
||||
{
|
||||
var documentFolder = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", "..", "Integration", "SpecificTestDocuments"));
|
||||
|
||||
if (!name.EndsWith(".pdf") && isPdf)
|
||||
{
|
||||
name += ".pdf";
|
||||
}
|
||||
|
||||
return Path.Combine(documentFolder, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,23 @@
|
||||
namespace UglyToad.PdfPig.Tests.Integration
|
||||
{
|
||||
using Xunit;
|
||||
|
||||
public class InvalidObjectLoopTests
|
||||
{
|
||||
[Fact]
|
||||
public void CanOpenDocumentAndGetPage()
|
||||
{
|
||||
var path = IntegrationHelpers.GetSpecificTestDocumentPath("invalid-xref-loop.pdf");
|
||||
|
||||
using (var document = PdfDocument.Open(path))
|
||||
{
|
||||
for (var i = 1; i <= document.NumberOfPages; i++)
|
||||
{
|
||||
var page = document.GetPage(i);
|
||||
|
||||
Assert.NotNull(page.Content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
@@ -13,6 +13,7 @@
|
||||
<None Remove="Fonts\Type1\*.pfa" />
|
||||
<None Remove="Fonts\Type1\*.pfb" />
|
||||
<None Remove="Integration\Documents\*" />
|
||||
<None Remove="Integration\SpecificTestDocuments\*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -72,6 +73,7 @@
|
||||
<Content Include="Fonts\Type1\CMBX12.pfa" />
|
||||
<Content Include="Fonts\Type1\CMCSC10.pfa" />
|
||||
<Content Include="Fonts\Type1\Raleway-Black.pfb" />
|
||||
<Content Include="Integration\SpecificTestDocuments\invalid-xref-loop.pdf" />
|
||||
<Content Include="Parser\SimpleGoogleDocPageContent.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
Reference in New Issue
Block a user