49 std::vector<DRC_ITEM> violations;
64 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
65 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
68 violations.push_back( *aItem );
73 int trackViolations = 0;
74 int viaViolations = 0;
78 for(
const DRC_ITEM& item : violations )
80 const KIID id = item.GetMainItemID();
90 switch( resolved->
Type() )
99 BOOST_CHECK_MESSAGE( viaViolations == 2,
100 "Expected exactly 2 via keepout violations, got "
101 << viaViolations <<
" (total: " << violations.size() <<
")" );
102 BOOST_CHECK_MESSAGE( trackViolations == 1,
103 "Expected exactly 1 track keepout violation, got "
104 << trackViolations );
105 BOOST_CHECK_MESSAGE( violations.size() == 3,
106 "Expected exactly 3 DRCE_ALLOWED_ITEMS violations, got "
107 << violations.size() );
109 if( viaViolations != 2 || trackViolations != 1 || violations.size() != 3 )
113 for(
const DRC_ITEM& item : violations )
131 int footprintViolations = 0;
145 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
146 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
154 footprintViolations++;
159 BOOST_CHECK_MESSAGE( footprintViolations == 0,
160 "Footprint flagged by its own keepout, got "
161 << footprintViolations <<
" footprint keepout violations" );
180 KI_TEST::LoadBoard( m_settingsManager,
"keepout_no_clearance/keepout_no_clearance", m_board );
182 std::vector<DRC_ITEM> violations;
194 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
195 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
198 violations.push_back( *aItem );
203 if( !violations.empty() )
208 for(
const DRC_ITEM& item : violations )
212 BOOST_CHECK_MESSAGE( violations.empty(),
213 "Expected no keepout violations for track outside keepout, got " << violations.size() );
constexpr EDA_IU_SCALE pcbIUScale
Container for design settings for a BOARD object.
std::map< int, SEVERITY > m_DRCSeverities
std::shared_ptr< DRC_ENGINE > m_DRCEngine
Implements the RC_ITEM_RESOLVER interface to resolve PCB items by their KIID.
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).
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
EDA_ITEM * ResolveItemById(const KIID &aKiid) const
Resolve an item by its KIID.
@ DRCE_LIB_FOOTPRINT_ISSUES
@ DRCE_DRILL_OUT_OF_RANGE
@ DRCE_LIB_FOOTPRINT_MISMATCH
void LoadBoard(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard)
SETTINGS_MANAGER m_settingsManager
std::unique_ptr< BOARD > m_board
DRC_KEEPOUT_TEST_FIXTURE()
BOOST_FIXTURE_TEST_CASE(DRCKeepoutDisallowViasAndTracks, DRC_KEEPOUT_TEST_FIXTURE)
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
VECTOR2< int32_t > VECTOR2I