| 4 | using namespace Clipper2Lib; |
| 5 | |
| 6 | TEST(Clipper2Tests, TestPolytreeUnion) { |
| 7 | Paths64 subject; |
| 8 | subject.push_back(MakePath({ 0,0, 0,5, 5,5, 5,0 })); |
| 9 | subject.push_back(MakePath({ 1,1, 1,6, 6,6, 6,1 })); |
| 10 | Clipper64 clipper; |
| 11 | clipper.AddSubject(subject); |
| 12 | PolyTree64 solution; |
| 13 | Paths64 open_paths; |
| 14 | if (IsPositive(subject[0])) |
| 15 | clipper.Execute(ClipType::Union, |
| 16 | FillRule::Positive, solution, open_paths); |
| 17 | else |
| 18 | { |
| 19 | //because clipping ops normally return Positive solutions |
| 20 | clipper.ReverseSolution(true); |
| 21 | clipper.Execute(ClipType::Union, |
| 22 | FillRule::Negative, solution, open_paths); |
| 23 | } |
| 24 | EXPECT_EQ(open_paths.size(), 0); |
| 25 | ASSERT_EQ(solution.Count(), 1); |
| 26 | EXPECT_EQ(solution[0]->Polygon().size(), 8); |
| 27 | EXPECT_EQ(IsPositive(subject[0]), IsPositive(solution[0]->Polygon())); |
| 28 | } |
| 29 | |
| 30 | TEST(Clipper2Tests, TestPolytreeUnion2) { // #987 |
| 31 | Paths64 subject; |
nothing calls this directly
no test coverage detected