add test coverage for invalid document from #33

This commit is contained in:
Eliot Jones
2019-06-08 16:58:20 +01:00
parent 2b486dccab
commit f3c8220ec4
4 changed files with 37 additions and 0 deletions

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}
}
}