From 33a56f806b04eed99f8ee684faf8a4510e9aba3a Mon Sep 17 00:00:00 2001 From: Eliot Jones Date: Sat, 24 Nov 2018 19:18:52 +0000 Subject: [PATCH] #10 test coverage for structure access --- .../Integration/IntegrationDocumentTests.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/UglyToad.PdfPig.Tests/Integration/IntegrationDocumentTests.cs b/src/UglyToad.PdfPig.Tests/Integration/IntegrationDocumentTests.cs index f618b37f..0a2fe766 100644 --- a/src/UglyToad.PdfPig.Tests/Integration/IntegrationDocumentTests.cs +++ b/src/UglyToad.PdfPig.Tests/Integration/IntegrationDocumentTests.cs @@ -26,6 +26,26 @@ } } + [Theory] + [MemberData(nameof(GetAllDocuments))] + public void CanTokenizeAllAccessibleObjects(string documentName) + { + documentName = Path.Combine(DocumentFolder.Value, documentName); + + using (var document = PdfDocument.Open(documentName, new ParsingOptions{ UseLenientParsing = false })) + { + Assert.NotNull(document.Structure.Catalog); + + Assert.True(document.Structure.CrossReferenceTable.ObjectOffsets.Count > 0 , "Cross reference table was empty."); + foreach (var objectOffset in document.Structure.CrossReferenceTable.ObjectOffsets) + { + var token = document.Structure.GetObject(objectOffset.Key); + + Assert.NotNull(token); + } + } + } + public static IEnumerable GetAllDocuments { get