MCPcopy Create free account
hub / github.com/AngusJohnson/Clipper2 / TEST

Function TEST

CPP/Tests/TestPolytreeUnion.cpp:6–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4using namespace Clipper2Lib;
5
6TEST(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
30TEST(Clipper2Tests, TestPolytreeUnion2) { // #987
31 Paths64 subject;

Callers

nothing calls this directly

Calls 6

MakePathFunction · 0.85
IsPositiveFunction · 0.85
AddSubjectMethod · 0.45
ExecuteMethod · 0.45
ReverseSolutionMethod · 0.45
CountMethod · 0.45

Tested by

no test coverage detected