26#include <boost/test/data/test_case.hpp>
54 m_board->GetDesignSettings().m_DRCEngine->ClearViolationHandler();
75 {
"issue14549_2", 0 },
89 BOOST_REQUIRE_MESSAGE( m_board,
"Failed to load board for test: " +
test.first.ToStdString() );
93 std::vector<DRC_ITEM> violations;
97 BOOST_REQUIRE_MESSAGE( bds.
m_DRCEngine,
"DRC engine not initialized for test: " +
test.first.ToStdString() );
107 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
108 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
111 violations.push_back( *aItem );
114 BOOST_TEST_CHECKPOINT(
"Running copper sliver drc" );
122 std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
124 BOOST_TEST_CHECKPOINT(
"DRC engine run completed successfully" );
126 catch(
const std::exception& e )
128 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, exception during RunTests: %s",
129 test.first, e.what() ) );
134 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, unknown exception during RunTests",
140 BOOST_TEST_CHECKPOINT(
"Clearing violation handler" );
143 if( violations.size() ==
test.second )
152 std::map<KIID, EDA_ITEM*> itemMap;
157 m_board->FillItemMap( itemMap );
159 catch(
const std::exception& e )
161 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, exception in FillItemMap: %s",
162 test.first, e.what() ) );
167 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, unknown exception in FillItemMap",
173 for(
size_t i = 0; i < violations.size() && i < 100; ++i )
177 const DRC_ITEM& item = violations[i];
180 catch(
const std::exception& e )
182 BOOST_TEST_MESSAGE( wxString::Format(
"Error reporting violation %zu: %s", i, e.what() ) );
190 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, failed (violations found %d "
193 (
int) 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
SEVERITY GetSeverity(int aDRCErrorCode)
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 ClearViolationHandler()
virtual wxString ShowReport(UNITS_PROVIDER *aUnitsProvider, SEVERITY aSeverity, const std::map< KIID, EDA_ITEM * > &aItemMap) const
Translate this object into a text string suitable for saving to disk in a report.
void LoadBoard(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard)
void FillZones(BOARD *m_board)
SETTINGS_MANAGER m_settingsManager
DRC_REGRESSION_TEST_FIXTURE()
~DRC_REGRESSION_TEST_FIXTURE()
std::unique_ptr< BOARD > m_board
static const std::vector< std::pair< wxString, int > > DRCCopperSliver_cases
BOOST_DATA_TEST_CASE_F(DRC_REGRESSION_TEST_FIXTURE, DRCCopperSliver, boost::unit_test::data::make(DRCCopperSliver_cases), test)
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I