2018-04-12 22:34:38 +01:00
|
|
|
|
namespace UglyToad.PdfPig.Tests.Integration
|
|
|
|
|
{
|
2019-12-05 13:21:19 +00:00
|
|
|
|
using System.Linq;
|
2018-04-12 22:34:38 +01:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
public class PigReproductionPowerpointTests
|
|
|
|
|
{
|
|
|
|
|
private static string GetFilename()
|
|
|
|
|
{
|
2018-11-25 12:36:38 +00:00
|
|
|
|
return IntegrationHelpers.GetDocumentPath("Pig Reproduction Powerpoint.pdf");
|
2018-04-12 22:34:38 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void CanReadContent()
|
|
|
|
|
{
|
2019-12-05 13:56:12 +00:00
|
|
|
|
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
2018-04-12 22:34:38 +01:00
|
|
|
|
{
|
|
|
|
|
var page = document.GetPage(1);
|
|
|
|
|
|
|
|
|
|
Assert.Contains("Pigs per sow per year: 18 to 27", page.Text);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void HasCorrectNumberOfPages()
|
|
|
|
|
{
|
2019-12-05 13:56:12 +00:00
|
|
|
|
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
2018-04-12 22:34:38 +01:00
|
|
|
|
{
|
|
|
|
|
Assert.Equal(35, document.NumberOfPages);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-15 19:52:42 +00:00
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void CanReadAllPages()
|
|
|
|
|
{
|
2019-12-05 13:56:12 +00:00
|
|
|
|
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
2018-11-15 19:52:42 +00:00
|
|
|
|
{
|
|
|
|
|
for (var i = 0; i < document.NumberOfPages; i++)
|
|
|
|
|
{
|
|
|
|
|
document.GetPage(i + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-05 12:03:30 +00:00
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void CanGetBookmarks()
|
|
|
|
|
{
|
2019-12-05 13:56:12 +00:00
|
|
|
|
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
2019-12-05 12:03:30 +00:00
|
|
|
|
{
|
|
|
|
|
var foundBookmarks = document.TryGetBookmarks(out var bookmarks);
|
|
|
|
|
Assert.True(foundBookmarks);
|
2019-12-05 13:21:19 +00:00
|
|
|
|
Assert.Equal(35, bookmarks.Roots.Count);
|
|
|
|
|
Assert.Equal(35, bookmarks.GetNodes().Count());
|
2019-12-05 12:03:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-12 22:34:38 +01:00
|
|
|
|
}
|
|
|
|
|
}
|