KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_pcb_grid_helper.cpp File Reference
#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.
 

Macro Definition Documentation

◆ BOOST_TEST_NO_MAIN

#define BOOST_TEST_NO_MAIN

Definition at line 18 of file test_pcb_grid_helper.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/23]

◆ BOOST_AUTO_TEST_CASE() [2/23]

◆ BOOST_AUTO_TEST_CASE() [3/23]

◆ BOOST_AUTO_TEST_CASE() [4/23]

◆ BOOST_AUTO_TEST_CASE() [5/23]

◆ BOOST_AUTO_TEST_CASE() [6/23]

◆ BOOST_AUTO_TEST_CASE() [7/23]

◆ BOOST_AUTO_TEST_CASE() [8/23]

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() [9/23]

◆ BOOST_AUTO_TEST_CASE() [10/23]

BOOST_AUTO_TEST_CASE ( DefaultConstructor )

◆ BOOST_AUTO_TEST_CASE() [11/23]

◆ BOOST_AUTO_TEST_CASE() [12/23]

◆ BOOST_AUTO_TEST_CASE() [13/23]

BOOST_AUTO_TEST_CASE ( GeometricSnapTolerance )

◆ BOOST_AUTO_TEST_CASE() [14/23]

BOOST_AUTO_TEST_CASE ( GetItemGridDefault )

◆ BOOST_AUTO_TEST_CASE() [15/23]

BOOST_AUTO_TEST_CASE ( GetItemGridFootprint )

◆ BOOST_AUTO_TEST_CASE() [16/23]

BOOST_AUTO_TEST_CASE ( GetItemGridGraphics )

◆ BOOST_AUTO_TEST_CASE() [17/23]

BOOST_AUTO_TEST_CASE ( GetItemGridPad )

◆ BOOST_AUTO_TEST_CASE() [18/23]

BOOST_AUTO_TEST_CASE ( GetItemGridText )

◆ BOOST_AUTO_TEST_CASE() [19/23]

BOOST_AUTO_TEST_CASE ( GetItemGridTracks )

◆ BOOST_AUTO_TEST_CASE() [20/23]

BOOST_AUTO_TEST_CASE ( GetItemGridVias )

◆ BOOST_AUTO_TEST_CASE() [21/23]

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() [22/23]

BOOST_AUTO_TEST_CASE ( OnBoardItemRemovedClearsSnap )

◆ BOOST_AUTO_TEST_CASE() [23/23]

BOOST_AUTO_TEST_CASE ( SegmentIntersectionPriority )

◆ BOOST_FIXTURE_TEST_CASE() [1/2]

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() [2/2]

BOOST_FIXTURE_TEST_CASE ( ZeroLengthSegment ,
PCBGridHelperTestFixture  )

Definition at line 452 of file test_pcb_grid_helper.cpp.

References BOOST_CHECK_EQUAL(), and result.