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

Function TEST

CPP/Tests/TestPolytreeIntersection.cpp:4–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include "clipper2/clipper.h"
3using namespace Clipper2Lib;
4TEST(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}

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected