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;
76 std::map<KIID, EDA_ITEM*> itemMap;
77 m_board->FillItemMap( itemMap );
79 for(
const DRC_ITEM& item : violations )
81 const KIID id = item.GetMainItemID();
86 auto it = itemMap.find(
id );
88 if( it == itemMap.end() )
91 switch( it->second->Type() )
100 BOOST_CHECK_MESSAGE( viaViolations == 2,
101 "Expected exactly 2 via keepout violations, got "
102 << viaViolations <<
" (total: " << violations.size() <<
")" );
103 BOOST_CHECK_MESSAGE( trackViolations == 1,
104 "Expected exactly 1 track keepout violation, got "
105 << trackViolations );
106 BOOST_CHECK_MESSAGE( violations.size() == 3,
107 "Expected exactly 3 DRCE_ALLOWED_ITEMS violations, got "
108 << violations.size() );
110 if( viaViolations != 2 || trackViolations != 1 || violations.size() != 3 )
114 for(
const DRC_ITEM& item : violations )
130 std::map<KIID, EDA_ITEM*> itemMap;
131 m_board->FillItemMap( itemMap );
133 int footprintViolations = 0;
147 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
148 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
153 auto it = itemMap.find( aItem->GetMainItemID() );
156 footprintViolations++;
161 BOOST_CHECK_MESSAGE( footprintViolations == 0,
162 "Footprint flagged by its own keepout, got "
163 << footprintViolations <<
" footprint keepout violations" );
182 KI_TEST::LoadBoard( m_settingsManager,
"keepout_no_clearance/keepout_no_clearance", m_board );
184 std::vector<DRC_ITEM> violations;
196 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
197 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
200 violations.push_back( *aItem );
205 if( !violations.empty() )
208 std::map<KIID, EDA_ITEM*> itemMap;
209 m_board->FillItemMap( itemMap );
211 for(
const DRC_ITEM& item : violations )
215 BOOST_CHECK_MESSAGE( violations.empty(),
216 "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
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).
@ 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