112 std::unique_ptr<FOOTPRINT> footprint = std::make_unique<FOOTPRINT>( &aBoard );
117 footprint->SetReference( aFPDef.
m_refdes );
120 footprint->SetPosition( aFPDef.
m_pos );
130std::unique_ptr<BOARD>
MakeBoard(
const std::vector<COURTYARD_TEST_FP>& aFPDefs )
132 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
138 board->Add( footprint.release() );
161 "single empty footprint",
173 "single footprint, single courtyard",
191 "two footprint, no overlap",
221 "two footprints, touching, no overlap",
251 "two footprints, overlap",
283 "two footprints, overlap, different sides",
313 "two footprints, multiple courtyards, overlap",
352 "two footprints, no overlap, bbox overlap",
391 auto reporter = std::static_pointer_cast<DRC_ITEM>( aMarker.
GetRCItem() );
397 if( !item_a || !item_b )
407 return ref_match_aa_bb || ref_match_ab_ba;
419 const std::vector<std::unique_ptr<PCB_MARKER>>& aMarkers,
420 const std::vector<COURTYARD_COLLISION>& aExpCollisions )
422 for(
const auto& marker : aMarkers )
424 BOOST_CHECK_PREDICATE(
456 std::vector<std::unique_ptr<PCB_MARKER>> markers;
458 DRC_ENGINE drcEngine( board.get(), &board->GetDesignSettings() );
463 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
VECTOR2I aPos,
int aLayer )
469 markers.push_back( std::make_unique<PCB_MARKER>( aItem, aPos ) );
483 BOOST_TEST_CONTEXT( c.m_case_name )
constexpr EDA_IU_SCALE pcbIUScale
Construction utilities for PCB tests.
General utilities for PCB file IO for QA programs.
Container for design settings for a BOARD object.
std::map< int, SEVERITY > m_DRCSeverities
Information pertinent to a Pcbnew printed circuit board.
BOARD_ITEM * GetItem(const KIID &aID) const
Design Rule Checker object that performs all the DRC tests.
void RunTests(EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aTestFootprints, BOARD_COMMIT *aCommit=nullptr)
Run the DRC tests.
void SetViolationHandler(DRC_VIOLATION_HANDLER aHandler)
Set an optional DRC violation handler (receives DRC_ITEMs and positions).
void InitEngine(const wxFileName &aRulePath)
Initialize the DRC engine.
A helper that contains logic to assist in dumping boards to disk depending on some environment variab...
void DumpBoardToFile(BOARD &aBoard, const std::string &aName) const
std::shared_ptr< RC_ITEM > GetRCItem() const
@ DRCE_OVERLAPPING_FOOTPRINTS
@ DRCE_MALFORMED_COURTYARD
General utilities for DRC-related PCB tests.
std::ostream & operator<<(std::ostream &aStream, const EDA_TEXT &aText)
PCB_LAYER_ID
A quick note on layer IDs:
void CheckUnorderedMatches(const EXP_CONT &aExpected, const FOUND_CONT &aFound, MATCH_PRED aMatchPredicate)
Check that a container of "found" objects matches a container of "expected" objects.
void DrawRect(FOOTPRINT &aFootprint, const VECTOR2I &aPos, const VECTOR2I &aSize, int aRadius, int aWidth, PCB_LAYER_ID aLayer)
Draw a rectangle on a footprint.
bool IsDrcMarkerOfType(const PCB_MARKER &aMarker, int aErrorCode)
Predicate for testing the type of a DRC marker.
A complete courtyard overlap test case: a name, the board footprint list and the expected collisions.
std::vector< COURTYARD_COLLISION > m_collisions
std::vector< COURTYARD_TEST_FP > m_fpDefs
const KI_TEST::BOARD_DUMPER m_dumper
std::vector< RECT_DEFINITION > m_rects
constexpr int mmToIU(double mm) const
Simple definition of a rectangle, can be rounded.
std::unique_ptr< FOOTPRINT > MakeCourtyardTestFP(BOARD &aBoard, const COURTYARD_TEST_FP &aFPDef)
Construct a FOOTPRINT to use in a courtyard test from a COURTYARD_TEST_FP definition.
static bool CollisionMatchesExpected(BOARD &aBoard, const PCB_MARKER &aMarker, const COURTYARD_COLLISION &aCollision)
Check if a PCB_MARKER is described by a particular COURTYARD_COLLISION object.
static void CheckCollisionsMatchExpected(BOARD &aBoard, const std::vector< std::unique_ptr< PCB_MARKER > > &aMarkers, const std::vector< COURTYARD_COLLISION > &aExpCollisions)
Check that the produced markers match the expected.
BOOST_AUTO_TEST_CASE(OverlapCases)
void AddRectCourtyard(FOOTPRINT &aFootprint, const RECT_DEFINITION &aRect)
Add a rectangular courtyard outline to a footprint.
static std::vector< COURTYARD_OVERLAP_TEST_CASE > courtyard_cases
static void DoCourtyardOverlapTest(const COURTYARD_OVERLAP_TEST_CASE &aCase, const KI_TEST::BOARD_DUMPER &aDumper)
Run a single courtyard overlap testcase.
std::unique_ptr< BOARD > MakeBoard(const std::vector< COURTYARD_TEST_FP > &aFPDefs)
Make a board for courtyard testing.
BOOST_AUTO_TEST_SUITE_END()
Functions to provide common constants and other functions to assist in making a consistent UI.