mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-18 18:27:55 +08:00
add tests for PdfPath.Contains(Rectangle) - EvenOdd
This commit is contained in:
38
src/UglyToad.PdfPig.Tests/Geometry/PdfPathExtensionsTests.cs
Normal file
38
src/UglyToad.PdfPig.Tests/Geometry/PdfPathExtensionsTests.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
namespace UglyToad.PdfPig.Tests.Geometry
|
||||
{
|
||||
using System.Linq;
|
||||
using UglyToad.PdfPig.Core;
|
||||
using UglyToad.PdfPig.Geometry;
|
||||
using UglyToad.PdfPig.Tests.Integration;
|
||||
using Xunit;
|
||||
|
||||
public class PdfPathExtensionsTests
|
||||
{
|
||||
[Fact]
|
||||
public void ContainsRectangleEvenOdd()
|
||||
{
|
||||
using (var document = PdfDocument.Open(IntegrationHelpers.GetDocumentPath("path_ext_oddeven"),
|
||||
new ParsingOptions() { ClipPaths = true }))
|
||||
{
|
||||
var page = document.GetPage(1);
|
||||
var words = page.GetWords().ToList();
|
||||
|
||||
foreach (var path in page.ExperimentalAccess.Paths)
|
||||
{
|
||||
Assert.NotEqual(FillingRule.NonZeroWinding, path.FillingRule); // allow none and even-odd
|
||||
|
||||
foreach (var c in words.Where(w => path.Contains(w.BoundingBox)).ToList())
|
||||
{
|
||||
Assert.Equal("in", c.Text.Split("_").Last());
|
||||
words.Remove(c);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var w in words)
|
||||
{
|
||||
Assert.NotEqual("in", w.Text.Split("_").Last());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Reference in New Issue
Block a user