diff --git a/src/UglyToad.PdfPig.Tests/Integration/Documents/FICTIF_TABLE_INDEX.pdf b/src/UglyToad.PdfPig.Tests/Integration/Documents/FICTIF_TABLE_INDEX.pdf new file mode 100644 index 00000000..db5f2305 Binary files /dev/null and b/src/UglyToad.PdfPig.Tests/Integration/Documents/FICTIF_TABLE_INDEX.pdf differ diff --git a/src/UglyToad.PdfPig.Tests/Integration/IndexedPageSummaryFileTests.cs b/src/UglyToad.PdfPig.Tests/Integration/IndexedPageSummaryFileTests.cs new file mode 100644 index 00000000..beeea4b8 --- /dev/null +++ b/src/UglyToad.PdfPig.Tests/Integration/IndexedPageSummaryFileTests.cs @@ -0,0 +1,54 @@ +namespace UglyToad.PdfPig.Tests.Integration; + +using System.Linq; +using Xunit; + +public class IndexedPageSummaryFileTests +{ + private static string GetFilename() + { + return IntegrationHelpers.GetDocumentPath("FICTIF_TABLE_INDEX.pdf"); + } + + [Fact] + public void HasCorrectNumberOfPages() + { + using (var document = PdfDocument.Open(GetFilename())) + { + Assert.Equal(14, document.NumberOfPages); + } + } + + [Fact] + public void GetPagesWorks() + { + using (var document = PdfDocument.Open(GetFilename())) + { + var pageCount = document.GetPages().Count(); + + Assert.Equal(14, pageCount); + } + } + + [Theory] + [InlineData("M. HERNANDEZ DANIEL", 1)] + [InlineData("M. HERNANDEZ DANIEL", 2)] + [InlineData("Mme ALIBERT CHLOE AA", 3)] + [InlineData("Mme ALIBERT CHLOE AA", 4)] + [InlineData("M. SIMPSON BART AAA", 5)] + [InlineData("M. SIMPSON BART AAA", 6)] + [InlineData("M. BOND JAMES A", 7)] + [InlineData("M. BOND JAMES A", 8)] + [InlineData("M. DE BALZAC HONORE", 9)] + [InlineData("M. DE BALZAC HONORE", 10)] + [InlineData("M. STALLONE SILVESTER", 11)] + [InlineData("M. STALLONE SILVESTER", 12)] + [InlineData("M. SCOTT MICHAEL", 13)] + [InlineData("M. SCOTT MICHAEL", 14)] + public void CheckSpecificNamesPresence_InIndexedPageNumbersFile(string searchedName, int pageNumber) + { + using var document = PdfDocument.Open(GetFilename()); + var page = document.GetPage(pageNumber); + Assert.Contains(searchedName, page.Text); + } +} \ No newline at end of file