|
KiCad PCB EDA Suite
|
#include <boost/test/unit_test.hpp>#include <board.h>#include <geometry/shape_arc.h>#include <layer_ids.h>#include <pcb_shape.h>#include <pcb_track.h>#include <tools/graphic_trim.h>#include <limits>Go to the source code of this file.
Functions | |
| static PCB_SHAPE | makeLine (const VECTOR2I &aStart, const VECTOR2I &aEnd, PCB_LAYER_ID aLayer=Dwgs_User) |
| static PCB_SHAPE | makeArc (const VECTOR2I &aCenter, const VECTOR2I &aStart, double aAngle, PCB_LAYER_ID aLayer=Dwgs_User) |
| BOOST_AUTO_TEST_CASE (OneBoundaryRemovesThePointerSide) | |
| BOOST_AUTO_TEST_CASE (TwoBoundariesRemoveMiddleAndRetainExteriorPieces) | |
| BOOST_AUTO_TEST_CASE (ChoosesNearestIntersectionsAroundClickedInterval) | |
| BOOST_AUTO_TEST_CASE (TrimsLineAtFiniteArcBoundary) | |
| BOOST_AUTO_TEST_CASE (TrimsArcAtFiniteLineBoundaries) | |
| BOOST_AUTO_TEST_CASE (TrimsArcAtFiniteArcBoundaryAndPreservesWinding) | |
| BOOST_AUTO_TEST_CASE (RejectsTrackSourceAndIgnoresTracksAndWrongLayerBoundaries) | |
| BOOST_AUTO_TEST_CASE (LockedSourceIsRejectedButLockedBoundaryIsEligible) | |
| BOOST_AUTO_TEST_CASE (RefusesCollinearOverlapAndPointerOnCut) | |
| BOOST_AUTO_TEST_CASE (TangentBoundaryStillCuts) | |
| BOOST_AUTO_TEST_CASE (ShapeBoundedOnlyAtAnEndIsRemovedWhole) | |
| BOOST_AUTO_TEST_CASE (EitherArmOfATeeTrimsAtTheStem) | |
| BOOST_AUTO_TEST_CASE (PreviewCarriesTheRemovedSpan) | |
| BOOST_AUTO_TEST_CASE (IgnoresUnrelatedCollinearAndTangentGeometry) | |
| BOOST_AUTO_TEST_CASE (OverlapDoesNotSpoilAUsableCut) | |
| BOOST_AUTO_TEST_CASE (HandlesBoardScaleParameter) | |
| BOOST_AUTO_TEST_CASE (DegenerateSourcesReportWhyTheyWereRefused) | |
| BOOST_AUTO_TEST_CASE (BoundariesCrossingAtOnePointYieldOneCut) | |
| static PCB_SHAPE | makeCircle (const VECTOR2I &aCenter, int aRadius, PCB_LAYER_ID aLayer=Dwgs_User) |
| static PCB_SHAPE | makeRectangle (const VECTOR2I &aCorner, const VECTOR2I &aOpposite, PCB_LAYER_ID aLayer=Dwgs_User) |
| BOOST_AUTO_TEST_CASE (CircleTrimsIntoAnArc) | |
| BOOST_AUTO_TEST_CASE (CircleNeedsTwoCutsToOpen) | |
| BOOST_AUTO_TEST_CASE (RectangleTrimsIntoLines) | |
| BOOST_AUTO_TEST_CASE (FlatRectangleIsRefused) | |
| BOOST_AUTO_TEST_CASE (RectangleSideWithNoCrossingIsRefused) | |
| BOOST_AUTO_TEST_CASE (CirclesAndRectanglesAreBoundariesToo) | |
| BOOST_AUTO_TEST_CASE | ( | BoundariesCrossingAtOnePointYieldOneCut | ) |
Definition at line 348 of file test_graphic_trim.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), makeLine(), GRAPHIC_TRIM_PLANNER::Plan(), and result.
| BOOST_AUTO_TEST_CASE | ( | ChoosesNearestIntersectionsAroundClickedInterval | ) |
Definition at line 95 of file test_graphic_trim.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), makeLine(), GRAPHIC_TRIM_PLANNER::Plan(), and result.
| BOOST_AUTO_TEST_CASE | ( | CircleNeedsTwoCutsToOpen | ) |
Definition at line 405 of file test_graphic_trim.cpp.
References makeCircle(), makeLine(), NO_INTERSECTION, GRAPHIC_TRIM_PLANNER::Plan(), and result.
| BOOST_AUTO_TEST_CASE | ( | CirclesAndRectanglesAreBoundariesToo | ) |
Definition at line 470 of file test_graphic_trim.cpp.
References BOOST_REQUIRE(), circle(), makeCircle(), makeLine(), makeRectangle(), and GRAPHIC_TRIM_PLANNER::Plan().
| BOOST_AUTO_TEST_CASE | ( | CircleTrimsIntoAnArc | ) |
Definition at line 385 of file test_graphic_trim.cpp.
References ARC, BOOST_REQUIRE(), VECTOR2< T >::Distance(), SHAPE_ARC::GetArcMid(), SHAPE_ARC::GetRadius(), makeCircle(), makeLine(), GRAPHIC_TRIM_PLANNER::Plan(), and result.
| BOOST_AUTO_TEST_CASE | ( | DegenerateSourcesReportWhyTheyWereRefused | ) |
Definition at line 337 of file test_graphic_trim.cpp.
References DEGENERATE, makeLine(), and GRAPHIC_TRIM_PLANNER::Plan().
| BOOST_AUTO_TEST_CASE | ( | EitherArmOfATeeTrimsAtTheStem | ) |
Definition at line 254 of file test_graphic_trim.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), left, makeLine(), GRAPHIC_TRIM_PLANNER::Plan(), and right.
| BOOST_AUTO_TEST_CASE | ( | FlatRectangleIsRefused | ) |
Definition at line 446 of file test_graphic_trim.cpp.
References DEGENERATE, makeLine(), makeRectangle(), GRAPHIC_TRIM_PLANNER::Plan(), and result.
| BOOST_AUTO_TEST_CASE | ( | HandlesBoardScaleParameter | ) |
Definition at line 323 of file test_graphic_trim.cpp.
References BOOST_REQUIRE(), makeLine(), GRAPHIC_TRIM_PLANNER::Plan(), and result.
| BOOST_AUTO_TEST_CASE | ( | IgnoresUnrelatedCollinearAndTangentGeometry | ) |
Definition at line 291 of file test_graphic_trim.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), makeArc(), makeLine(), GRAPHIC_TRIM_PLANNER::Plan(), and result.
| BOOST_AUTO_TEST_CASE | ( | LockedSourceIsRejectedButLockedBoundaryIsEligible | ) |
Definition at line 184 of file test_graphic_trim.cpp.
References Dwgs_User, LOCKED_SOURCE, GRAPHIC_TRIM_PLANNER::Plan(), result, SEGMENT, PCB_SHAPE::SetEnd(), PCB_SHAPE::SetLayer(), BOARD_ITEM::SetLocked(), and PCB_SHAPE::SetStart().
| BOOST_AUTO_TEST_CASE | ( | OneBoundaryRemovesThePointerSide | ) |
Definition at line 57 of file test_graphic_trim.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), GRAPHIC_EDIT_RESULT::m_Geometry, makeLine(), and GRAPHIC_TRIM_PLANNER::Plan().
| BOOST_AUTO_TEST_CASE | ( | OverlapDoesNotSpoilAUsableCut | ) |
Definition at line 307 of file test_graphic_trim.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), makeLine(), GRAPHIC_TRIM_PLANNER::Plan(), and result.
| BOOST_AUTO_TEST_CASE | ( | PreviewCarriesTheRemovedSpan | ) |
Definition at line 276 of file test_graphic_trim.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), left, makeLine(), GRAPHIC_TRIM_PLANNER::Plan(), result, and right.
| BOOST_AUTO_TEST_CASE | ( | RectangleSideWithNoCrossingIsRefused | ) |
Definition at line 458 of file test_graphic_trim.cpp.
References makeLine(), makeRectangle(), NO_INTERSECTION, GRAPHIC_TRIM_PLANNER::Plan(), and result.
| BOOST_AUTO_TEST_CASE | ( | RectangleTrimsIntoLines | ) |
Definition at line 420 of file test_graphic_trim.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), GRAPHIC_EDIT_GEOMETRY::m_Shape, makeLine(), makeRectangle(), GRAPHIC_TRIM_PLANNER::Plan(), result, and SEGMENT.
| BOOST_AUTO_TEST_CASE | ( | RefusesCollinearOverlapAndPointerOnCut | ) |
Definition at line 205 of file test_graphic_trim.cpp.
References AMBIGUOUS, GRAPHIC_EDIT_RESULT::m_Refusal, makeLine(), and GRAPHIC_TRIM_PLANNER::Plan().
| BOOST_AUTO_TEST_CASE | ( | RejectsTrackSourceAndIgnoresTracksAndWrongLayerBoundaries | ) |
Definition at line 168 of file test_graphic_trim.cpp.
References Cmts_User, makeLine(), GRAPHIC_TRIM_PLANNER::Plan(), PCB_TRACK::SetEnd(), and PCB_TRACK::SetStart().
| BOOST_AUTO_TEST_CASE | ( | ShapeBoundedOnlyAtAnEndIsRemovedWhole | ) |
Definition at line 238 of file test_graphic_trim.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), makeLine(), GRAPHIC_TRIM_PLANNER::Plan(), and result.
| BOOST_AUTO_TEST_CASE | ( | TangentBoundaryStillCuts | ) |
Definition at line 224 of file test_graphic_trim.cpp.
References BOOST_REQUIRE(), makeArc(), makeLine(), GRAPHIC_TRIM_PLANNER::Plan(), and result.
| BOOST_AUTO_TEST_CASE | ( | TrimsArcAtFiniteArcBoundaryAndPreservesWinding | ) |
Definition at line 146 of file test_graphic_trim.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), cut, EDA_SHAPE::GetArcMid(), EDA_SHAPE::GetEnd(), SHAPE_ARC::GetRadius(), EDA_SHAPE::GetStart(), SHAPE_ARC::IsClockwise(), makeArc(), GRAPHIC_TRIM_PLANNER::Plan(), result, VECTOR2< T >::x, and VECTOR2< T >::y.
| BOOST_AUTO_TEST_CASE | ( | TrimsArcAtFiniteLineBoundaries | ) |
Definition at line 126 of file test_graphic_trim.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), EDA_SHAPE::GetArcMid(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetStart(), makeArc(), makeLine(), GRAPHIC_TRIM_PLANNER::Plan(), and result.
| BOOST_AUTO_TEST_CASE | ( | TrimsLineAtFiniteArcBoundary | ) |
Definition at line 112 of file test_graphic_trim.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), makeArc(), makeLine(), GRAPHIC_TRIM_PLANNER::Plan(), and result.
| BOOST_AUTO_TEST_CASE | ( | TwoBoundariesRemoveMiddleAndRetainExteriorPieces | ) |
Definition at line 78 of file test_graphic_trim.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), left, makeLine(), GRAPHIC_TRIM_PLANNER::Plan(), result, and right.
|
static |
Definition at line 45 of file test_graphic_trim.cpp.
References ARC, DEGREES_T, Dwgs_User, SHAPE_ARC::GetArcMid(), SHAPE_ARC::GetP0(), SHAPE_ARC::GetP1(), PCB_SHAPE::SetArcGeometry(), and PCB_SHAPE::SetLayer().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 363 of file test_graphic_trim.cpp.
References CIRCLE, circle(), and Dwgs_User.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 35 of file test_graphic_trim.cpp.
References Dwgs_User, makeLine(), SEGMENT, PCB_SHAPE::SetEnd(), PCB_SHAPE::SetLayer(), and PCB_SHAPE::SetStart().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 373 of file test_graphic_trim.cpp.
References Dwgs_User, RECTANGLE, PCB_SHAPE::SetEnd(), PCB_SHAPE::SetLayer(), and PCB_SHAPE::SetStart().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().