40int mm(
double aMillimetres )
50 std::unique_ptr<FOOTPRINT> footprint = std::make_unique<FOOTPRINT>( &aBoard );
54 footprint->SetReference( aRef );
58 footprint->SetPosition( aPos );
61 aBoard.
Add( footprint.release() );
68std::set<FOOTPRINT*> bruteForceOverlap(
BOARD& aBoard,
const BOX2I& aBox )
70 std::set<FOOTPRINT*>
result;
75 bool hasCourtyard =
false;
87 bbox = courtyard.
BBox();
93 result.insert( footprint );
102 std::set<FOOTPRINT*>
result;
107 result.insert( aFootprint );
124 addFootprint( board,
"U1", { 0, 0 }, { mm( 2 ), mm( 2 ) } );
125 addFootprint( board,
"U2", { mm( 50 ), 0 }, { mm( 2 ), mm( 2 ) } );
126 addFootprint( board,
"U3", { mm( 100 ), mm( 100 ) }, { mm( 2 ), mm( 2 ) } );
130 addFootprint( board,
"U4", { 0, mm( 50 ) }, { mm( 60 ), mm( 60 ) } );
133 std::unique_ptr<FOOTPRINT> noCourtyard = std::make_unique<FOOTPRINT>( &board );
134 noCourtyard->SetReference(
"U5" );
135 noCourtyard->SetPosition( { mm( 50 ), mm( 50 ) } );
136 board.
Add( noCourtyard.release() );
140 const std::vector<BOX2I> queries = {
147 for(
const BOX2I& query : queries )
148 BOOST_CHECK( indexOverlap(
index, query ) == bruteForceOverlap( board, query ) );
constexpr EDA_IU_SCALE pcbIUScale
Construction utilities for PCB tests.
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
const FOOTPRINTS & Footprints() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr bool Intersects(const BOX2< Vec > &aRect) const
Represent a set of closed polygons.
int OutlineCount() const
Return the number of outlines in the set.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
PCB_LAYER_ID
A quick note on layer IDs:
void DrawRect(FOOTPRINT &aFootprint, const VECTOR2I &aPos, const VECTOR2I &aSize, int aRadius, int aWidth, PCB_LAYER_ID aLayer)
Draw a rectangle on a footprint.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()
wxString result
Test unit parsing edge cases and error handling.
VECTOR2< int32_t > VECTOR2I