|
KiCad PCB EDA Suite
|
#include <boost/test/unit_test.hpp>#include <tools/pcb_grid_helper.h>#include <geometry/seg.h>#include <geometry/shape_arc.h>#include <footprint.h>#include <pad.h>#include <pcb_shape.h>#include <pcb_track.h>#include <zone.h>#include <pcb_text.h>Go to the source code of this file.
Classes | |
| class | MOCK_BOARD_ITEM |
| class | PCBGridHelperTestFixture |
Macros | |
| #define | BOOST_TEST_NO_MAIN |
Functions | |
| BOOST_AUTO_TEST_CASE (DefaultConstructor) | |
| BOOST_AUTO_TEST_CASE (FootprintLayoutBoundsExcludeText) | |
| BOOST_AUTO_TEST_CASE (DragReferenceClassificationFollowsChosenPoint) | |
| BOOST_AUTO_TEST_CASE (AlignToSegmentBasic) | |
| BOOST_AUTO_TEST_CASE (AlignToSegmentVertical) | |
| BOOST_AUTO_TEST_CASE (AlignToSegmentDiagonal) | |
| BOOST_AUTO_TEST_CASE (AlignToSegmentEndpoints) | |
| BOOST_AUTO_TEST_CASE (AlignToSegmentSnapDisabled) | |
| BOOST_AUTO_TEST_CASE (AlignToArcBasic) | |
| BOOST_AUTO_TEST_CASE (AlignToArcSnapDisabled) | |
| BOOST_AUTO_TEST_CASE (GetItemGridFootprint) | |
| BOOST_AUTO_TEST_CASE (GetItemGridPad) | |
| BOOST_AUTO_TEST_CASE (GetItemGridText) | |
| BOOST_AUTO_TEST_CASE (GetItemGridGraphics) | |
| BOOST_AUTO_TEST_CASE (GetItemGridTracks) | |
| BOOST_AUTO_TEST_CASE (GetItemGridVias) | |
| BOOST_AUTO_TEST_CASE (GetItemGridDefault) | |
| BOOST_AUTO_TEST_CASE (GetSnappedInitiallyNull) | |
| BOOST_AUTO_TEST_CASE (OnBoardItemRemovedClearsSnap) | |
| BOOST_AUTO_TEST_CASE (GeometricSnapTolerance) | |
| BOOST_AUTO_TEST_CASE (SegmentIntersectionPriority) | |
| BOOST_AUTO_TEST_CASE (ArcIntersectionWithGrid) | |
| BOOST_FIXTURE_TEST_CASE (LargeGridSegmentSnap, PCBGridHelperTestFixture) | |
| BOOST_FIXTURE_TEST_CASE (ZeroLengthSegment, PCBGridHelperTestFixture) | |
| BOOST_AUTO_TEST_CASE (ArcDragOriginStaysOnGrid) | |
| Regression test for issue 22945: pasting a grid-aligned arc landed it off grid because the grid helper offered the arc's derived (off-grid) geometric center as the drag/paste origin. | |
| #define BOOST_TEST_NO_MAIN |
Definition at line 18 of file test_pcb_grid_helper.cpp.
| BOOST_AUTO_TEST_CASE | ( | AlignToArcBasic | ) |
Definition at line 219 of file test_pcb_grid_helper.cpp.
References PCB_GRID_HELPER::AlignToArc(), ANGLE_90, result, GRID_HELPER::SetGridSize(), GRID_HELPER::SetGridSnapping(), and GRID_HELPER::SetOrigin().
| BOOST_AUTO_TEST_CASE | ( | AlignToArcSnapDisabled | ) |
Definition at line 257 of file test_pcb_grid_helper.cpp.
References PCB_GRID_HELPER::Align(), PCB_GRID_HELPER::AlignToArc(), ANGLE_90, BOOST_CHECK_EQUAL(), expected, result, GRID_HELPER::SetGridSize(), GRID_HELPER::SetGridSnapping(), GRID_HELPER::SetOrigin(), and GRID_HELPER::SetSnap().
| BOOST_AUTO_TEST_CASE | ( | AlignToSegmentBasic | ) |
Definition at line 131 of file test_pcb_grid_helper.cpp.
References PCB_GRID_HELPER::AlignToSegment(), BOOST_CHECK_EQUAL(), result, GRID_HELPER::SetGridSize(), GRID_HELPER::SetGridSnapping(), and GRID_HELPER::SetOrigin().
| BOOST_AUTO_TEST_CASE | ( | AlignToSegmentDiagonal | ) |
Definition at line 163 of file test_pcb_grid_helper.cpp.
References PCB_GRID_HELPER::AlignToSegment(), BOOST_CHECK_EQUAL(), result, GRID_HELPER::SetGridSize(), GRID_HELPER::SetGridSnapping(), and GRID_HELPER::SetOrigin().
| BOOST_AUTO_TEST_CASE | ( | AlignToSegmentEndpoints | ) |
Definition at line 181 of file test_pcb_grid_helper.cpp.
References PCB_GRID_HELPER::AlignToSegment(), BOOST_CHECK_EQUAL(), result, GRID_HELPER::SetGridSize(), GRID_HELPER::SetGridSnapping(), and GRID_HELPER::SetOrigin().
| BOOST_AUTO_TEST_CASE | ( | AlignToSegmentSnapDisabled | ) |
Definition at line 201 of file test_pcb_grid_helper.cpp.
References PCB_GRID_HELPER::Align(), PCB_GRID_HELPER::AlignToSegment(), BOOST_CHECK_EQUAL(), expected, result, GRID_HELPER::SetGridSize(), GRID_HELPER::SetGridSnapping(), GRID_HELPER::SetOrigin(), and GRID_HELPER::SetSnap().
| BOOST_AUTO_TEST_CASE | ( | AlignToSegmentVertical | ) |
Definition at line 147 of file test_pcb_grid_helper.cpp.
References PCB_GRID_HELPER::AlignToSegment(), BOOST_CHECK_EQUAL(), result, GRID_HELPER::SetGridSize(), GRID_HELPER::SetGridSnapping(), and GRID_HELPER::SetOrigin().
| BOOST_AUTO_TEST_CASE | ( | ArcDragOriginStaysOnGrid | ) |
Regression test for issue 22945: pasting a grid-aligned arc landed it off grid because the grid helper offered the arc's derived (off-grid) geometric center as the drag/paste origin.
Drive PCB_GRID_HELPER::GetArcAnchors directly (the anchor-selection logic BestDragOrigin relies on) so the test needs no GAL/view. The arc is built with grid-aligned start/mid/end whose circumcenter is deliberately off grid, matching the arc from the report.
Definition at line 471 of file test_pcb_grid_helper.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), center, GRID_HELPER::CORNER, PCB_GRID_HELPER::GetArcAnchors(), PCB_ARC::GetCenter(), grid, GRID_HELPER::ORIGIN, pcbIUScale, PCB_TRACK::SetEnd(), PCB_ARC::SetMid(), PCB_TRACK::SetStart(), GRID_HELPER::SNAPPABLE, VECTOR2< T >::x, and VECTOR2< T >::y.
| BOOST_AUTO_TEST_CASE | ( | ArcIntersectionWithGrid | ) |
Definition at line 421 of file test_pcb_grid_helper.cpp.
References PCB_GRID_HELPER::AlignToArc(), BOOST_CHECK_EQUAL(), result, GRID_HELPER::SetGridSize(), GRID_HELPER::SetGridSnapping(), and GRID_HELPER::SetOrigin().
| BOOST_AUTO_TEST_CASE | ( | DefaultConstructor | ) |
Definition at line 76 of file test_pcb_grid_helper.cpp.
References BOOST_AUTO_TEST_CASE(), GRID_HELPER::GetSnap(), PCB_GRID_HELPER::GetSnapped(), and GRID_HELPER::GetUseGrid().
| BOOST_AUTO_TEST_CASE | ( | DragReferenceClassificationFollowsChosenPoint | ) |
Definition at line 113 of file test_pcb_grid_helper.cpp.
References ANCHOR_POINT, BOOST_CHECK_EQUAL(), BOUNDS_FEATURE, center, PCBGridHelperTestFixture::ClassifyReference(), SNAP_REFERENCE_PREFERENCE::horizontalFeature, pad, and SNAP_REFERENCE_PREFERENCE::verticalFeature.
| BOOST_AUTO_TEST_CASE | ( | FootprintLayoutBoundsExcludeText | ) |
Definition at line 89 of file test_pcb_grid_helper.cpp.
References FOOTPRINT::Add(), APPEND, F_Fab, F_SilkS, FOOTPRINT::GetBoundingBox(), PCBGridHelperTestFixture::LayoutBounds(), RECTANGLE, FOOTPRINT::Reference(), PCB_SHAPE::SetEnd(), PCB_SHAPE::SetLayer(), FOOTPRINT::SetPosition(), PCB_SHAPE::SetStart(), EDA_TEXT::SetVisible(), text, and FOOTPRINT::Value().
| BOOST_AUTO_TEST_CASE | ( | GeometricSnapTolerance | ) |
Definition at line 387 of file test_pcb_grid_helper.cpp.
References PCB_GRID_HELPER::AlignToSegment(), result, GRID_HELPER::SetGridSize(), GRID_HELPER::SetGridSnapping(), and GRID_HELPER::SetOrigin().
| BOOST_AUTO_TEST_CASE | ( | GetItemGridDefault | ) |
Definition at line 349 of file test_pcb_grid_helper.cpp.
References BOOST_CHECK_EQUAL(), PCB_GRID_HELPER::GetItemGrid(), grid, GRID_CURRENT, PCB_ZONE_T, and unknown.
| BOOST_AUTO_TEST_CASE | ( | GetItemGridFootprint | ) |
Definition at line 275 of file test_pcb_grid_helper.cpp.
References BOOST_CHECK_EQUAL(), PCB_GRID_HELPER::GetItemGrid(), grid, GRID_CONNECTABLE, and PCB_FOOTPRINT_T.
| BOOST_AUTO_TEST_CASE | ( | GetItemGridGraphics | ) |
Definition at line 306 of file test_pcb_grid_helper.cpp.
References BOOST_CHECK_EQUAL(), PCB_GRID_HELPER::GetItemGrid(), grid, GRID_GRAPHICS, PCB_DIMENSION_T, PCB_REFERENCE_IMAGE_T, PCB_SHAPE_T, and PCB_TEXTBOX_T.
| BOOST_AUTO_TEST_CASE | ( | GetItemGridPad | ) |
Definition at line 284 of file test_pcb_grid_helper.cpp.
References BOOST_CHECK_EQUAL(), PCB_GRID_HELPER::GetItemGrid(), grid, GRID_CONNECTABLE, pad, and PCB_PAD_T.
| BOOST_AUTO_TEST_CASE | ( | GetItemGridText | ) |
Definition at line 293 of file test_pcb_grid_helper.cpp.
References BOOST_CHECK_EQUAL(), PCB_GRID_HELPER::GetItemGrid(), grid, GRID_TEXT, PCB_FIELD_T, PCB_TEXT_T, and text.
| BOOST_AUTO_TEST_CASE | ( | GetItemGridTracks | ) |
Definition at line 327 of file test_pcb_grid_helper.cpp.
References BOOST_CHECK_EQUAL(), PCB_GRID_HELPER::GetItemGrid(), grid, GRID_WIRES, PCB_ARC_T, and PCB_TRACE_T.
| BOOST_AUTO_TEST_CASE | ( | GetItemGridVias | ) |
Definition at line 340 of file test_pcb_grid_helper.cpp.
References BOOST_CHECK_EQUAL(), PCB_GRID_HELPER::GetItemGrid(), grid, GRID_VIAS, PCB_VIA_T, and via.
| BOOST_AUTO_TEST_CASE | ( | GetSnappedInitiallyNull | ) |
Definition at line 363 of file test_pcb_grid_helper.cpp.
References PCB_GRID_HELPER::GetSnapped().
| BOOST_AUTO_TEST_CASE | ( | OnBoardItemRemovedClearsSnap | ) |
Definition at line 371 of file test_pcb_grid_helper.cpp.
References PCB_GRID_HELPER::GetSnapped(), PCB_GRID_HELPER::OnBoardItemRemoved(), and PCB_TRACE_T.
| BOOST_AUTO_TEST_CASE | ( | SegmentIntersectionPriority | ) |
Definition at line 403 of file test_pcb_grid_helper.cpp.
References PCB_GRID_HELPER::AlignToSegment(), BOOST_CHECK_EQUAL(), result, GRID_HELPER::SetGridSize(), GRID_HELPER::SetGridSnapping(), and GRID_HELPER::SetOrigin().
| BOOST_FIXTURE_TEST_CASE | ( | LargeGridSegmentSnap | , |
| PCBGridHelperTestFixture | ) |
Definition at line 439 of file test_pcb_grid_helper.cpp.
References BOOST_CHECK_EQUAL(), and result.
| BOOST_FIXTURE_TEST_CASE | ( | ZeroLengthSegment | , |
| PCBGridHelperTestFixture | ) |
Definition at line 452 of file test_pcb_grid_helper.cpp.
References BOOST_CHECK_EQUAL(), and result.