36 #include "../board_test_utils.h" 68 os <<
"COURTYARD_INVALID_INFO[ " << aInvalid.
m_refdes;
77 std::vector<COURTYARD_INVALID_TEST_FP>
m_mods;
92 "single footprint, no courtyard",
108 "single footprint, unclosed courtyard",
127 "single footprint, disjoint courtyard",
146 "two footprints, one OK, one malformed",
195 std::unique_ptr<FOOTPRINT> footprint = std::make_unique<FOOTPRINT>( &aBoard );
205 footprint->SetReference( aFPDef.
m_refdes );
209 footprint->SetPosition( (wxPoint) aFPDef.
m_pos );
215 std::unique_ptr<BOARD>
MakeBoard(
const std::vector<COURTYARD_INVALID_TEST_FP>& aTestFPDefs )
217 auto board = std::make_unique<BOARD>();
223 board->Add( footprint.release() );
236 auto reporter = std::static_pointer_cast<DRC_ITEM>( aMarker.
GetRCItem() );
237 const FOOTPRINT* item_a = dynamic_cast<FOOTPRINT*>( aBoard.
GetItem( reporter->GetMainItemID() ) );
240 if( reporter->GetAuxItemID() !=
niluuid )
242 BOOST_WARN_MESSAGE(
false,
"Expected no auxiliary item for invalid courtyard DRC." );
246 if( item_a ==
nullptr )
248 BOOST_ERROR(
"Could not get board DRC item." );
252 if( item_a->GetReference() != aInvalid.
m_refdes )
270 const std::vector<std::unique_ptr<PCB_MARKER>>& aMarkers,
271 const std::vector<COURTYARD_INVALID_INFO>& aExpInvalids )
275 const std::unique_ptr<PCB_MARKER>& aMarker )
300 std::vector<std::unique_ptr<PCB_MARKER>> markers;
302 DRC_ENGINE drcEngine( board.get(), &board->GetDesignSettings() );
306 drcEngine.SetViolationHandler(
307 [&](
const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
313 markers.push_back( std::make_unique<PCB_MARKER>( aItem, aPos ) );
334 BOOST_AUTO_TEST_SUITE_END()
BOARD_ITEM * GetItem(const KIID &aID) const
Design Rule Checker object that performs all the DRC tests.
std::vector< SEG > m_segs
Footprint Ref-Des (for identifying DRC errors)
std::vector< COURTYARD_INVALID_TEST_FP > m_mods
void DrawSegment(FOOTPRINT &aFootprint, const SEG &aSeg, int aWidth, PCB_LAYER_ID aLayer)
Draw a segment in the given footprint.
static const std::vector< COURTYARD_INVALID_CASE > courtyard_invalid_cases
void DumpBoardToFile(BOARD &aBoard, const std::string &aName) const
Construction utilities for PCB tests.
const KI_TEST::BOARD_DUMPER m_dumper
std::vector< COURTYARD_INVALID_INFO > m_exp_errors
std::unique_ptr< BOARD > MakeBoard(const std::vector< COURTYARD_INVALID_TEST_FP > &aTestFPDefs)
Functions to provide common constants and other functions to assist in making a consistent UI.
VECTOR2I m_pos
List of segments that will be placed on the courtyard.
static void CheckInvalidsMatchExpected(BOARD &aBoard, const std::vector< std::unique_ptr< PCB_MARKER >> &aMarkers, const std::vector< COURTYARD_INVALID_INFO > &aExpInvalids)
Check that the produced markers match the expected.
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.
#define BOOST_TEST_CONTEXT(A)
void DoCourtyardInvalidTest(const COURTYARD_INVALID_CASE &aCase, const KI_TEST::BOARD_DUMPER &aDumper)
std::unique_ptr< FOOTPRINT > MakeInvalidCourtyardTestFP(BOARD &aBoard, const COURTYARD_INVALID_TEST_FP &aFPDef)
Construct a FOOTPRINT to use in a courtyard test from a COURTYARD_TEST_FP definition.
BOOST_AUTO_TEST_CASE(InvalidCases)
Information pertinent to a Pcbnew printed circuit board.
PCB_LAYER_ID
A quick note on layer IDs:
std::map< int, SEVERITY > m_DRCSeverities
General utilities for PCB file IO for QA programs.
static constexpr int Millimeter2iu(double mm)
A helper that contains logic to assist in dumping boards to disk depending on some environment variab...
std::shared_ptr< RC_ITEM > GetRCItem() const
void InitEngine(const wxFileName &aRulePath)
Initialize the DRC engine.
Container for design settings for a BOARD object.
static bool InvalidMatchesExpected(BOARD &aBoard, const PCB_MARKER &aMarker, const COURTYARD_INVALID_INFO &aInvalid)
Check if a PCB_MARKER is described by a particular COURTYARD_INVALID_INFO object.
std::ostream & operator<<(std::ostream &os, const COURTYARD_INVALID_INFO &aInvalid)