mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-21 04:17:57 +08:00
make missing acroform types public and start improving data
also changes pages to use a proper tree structure since this will be required for resource inheritance and for acroform widget dictionaries.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
namespace UglyToad.PdfPig.Tests.Integration
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
|
||||
public class AcroFormsBasicFieldsTests
|
||||
@@ -13,7 +14,7 @@
|
||||
[Fact]
|
||||
public void GetFormNotNull()
|
||||
{
|
||||
using (var document = PdfDocument.Open(GetFilename(), new ParsingOptions { UseLenientParsing = false }))
|
||||
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
||||
{
|
||||
var form = document.GetForm();
|
||||
Assert.NotNull(form);
|
||||
@@ -35,11 +36,22 @@
|
||||
[Fact]
|
||||
public void GetsAllFormFields()
|
||||
{
|
||||
using (var document = PdfDocument.Open(GetFilename(), new ParsingOptions { UseLenientParsing = false }))
|
||||
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
||||
{
|
||||
var form = document.GetForm();
|
||||
Assert.Equal(16, form.Fields.Count);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetsEmptyFormFields()
|
||||
{
|
||||
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
||||
{
|
||||
var form = document.GetForm();
|
||||
var annots = document.GetPage(1).ExperimentalAccess.GetAnnotations().ToList();
|
||||
Assert.Equal(16, form.Fields.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -16,10 +16,7 @@
|
||||
[Fact]
|
||||
public void CanReadContent()
|
||||
{
|
||||
using (var document = PdfDocument.Open(GetFilename(), new ParsingOptions
|
||||
{
|
||||
UseLenientParsing = false
|
||||
}))
|
||||
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
||||
{
|
||||
var page = document.GetPage(1);
|
||||
|
||||
@@ -30,10 +27,7 @@
|
||||
[Fact]
|
||||
public void LettersHaveCorrectColors()
|
||||
{
|
||||
using (var document = PdfDocument.Open(GetFilename(), new ParsingOptions
|
||||
{
|
||||
UseLenientParsing = false
|
||||
}))
|
||||
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
||||
{
|
||||
var page = document.GetPage(1);
|
||||
|
||||
@@ -91,7 +85,7 @@
|
||||
"Nations"
|
||||
};
|
||||
|
||||
using (var document = PdfDocument.Open(GetFilename()))
|
||||
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
||||
{
|
||||
var page = document.GetPage(1);
|
||||
|
||||
@@ -105,7 +99,7 @@
|
||||
public void Page4HasCorrectWords()
|
||||
{
|
||||
var expected = WordsPage4.Split(new[] {"\r", "\r\n", "\n", " "}, StringSplitOptions.RemoveEmptyEntries);
|
||||
using (var document = PdfDocument.Open(GetFilename()))
|
||||
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
||||
{
|
||||
var page = document.GetPage(4);
|
||||
|
||||
@@ -118,10 +112,7 @@
|
||||
[Fact]
|
||||
public void CanReadPage9()
|
||||
{
|
||||
using (var document = PdfDocument.Open(GetFilename(), new ParsingOptions
|
||||
{
|
||||
UseLenientParsing = false
|
||||
}))
|
||||
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
||||
{
|
||||
var page = document.GetPage(9);
|
||||
|
||||
@@ -132,7 +123,7 @@
|
||||
[Fact]
|
||||
public void HasCorrectNumberOfPages()
|
||||
{
|
||||
using (var document = PdfDocument.Open(GetFilename()))
|
||||
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
||||
{
|
||||
Assert.Equal(86, document.NumberOfPages);
|
||||
}
|
||||
@@ -141,7 +132,7 @@
|
||||
[Fact]
|
||||
public void LettersHaveCorrectPosition()
|
||||
{
|
||||
using (var document = PdfDocument.Open(GetFilename()))
|
||||
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
||||
{
|
||||
var page = document.GetPage(1);
|
||||
var letters = page.Letters;
|
||||
|
Reference in New Issue
Block a user