| 2 | #include "clipper2/clipper.h" |
| 3 | using namespace Clipper2Lib; |
| 4 | TEST(Clipper2Tests, TestPolyTreeIntersection) |
| 5 | { |
| 6 | Clipper64 clipper; |
| 7 | Paths64 subject; |
| 8 | subject.push_back(MakePath({ 0,0, 0,5, 5,5, 5,0 })); |
| 9 | clipper.AddSubject(subject); |
| 10 | Paths64 clip; |
| 11 | clip.push_back(MakePath({ 1,1, 1,6, 6,6, 6,1 })); |
| 12 | clipper.AddClip (clip); |
| 13 | PolyTree64 solution; |
| 14 | Paths64 open_paths; |
| 15 | if (IsPositive(subject[0])) |
| 16 | clipper.Execute(ClipType::Intersection, |
| 17 | FillRule::Positive, solution, open_paths); |
| 18 | else |
| 19 | clipper.Execute(ClipType::Intersection, |
| 20 | FillRule::Negative, solution, open_paths); |
| 21 | EXPECT_EQ(open_paths.size(), 0); |
| 22 | ASSERT_EQ(solution.Count(), 1); |
| 23 | EXPECT_EQ(solution[0]->Polygon().size(), 4); |
| 24 | } |
nothing calls this directly
no test coverage detected