26#include <boost/test/data/test_case.hpp>
53 m_board->GetDesignSettings().m_DRCEngine->ClearViolationHandler();
74 {
"issue14549_2", 0 },
88 BOOST_REQUIRE_MESSAGE( m_board,
"Failed to load board for test: " +
test.first.ToStdString() );
92 std::vector<DRC_ITEM> violations;
96 BOOST_REQUIRE_MESSAGE( bds.
m_DRCEngine,
"DRC engine not initialized for test: " +
test.first.ToStdString() );
106 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
107 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
110 violations.push_back( *aItem );
113 BOOST_TEST_CHECKPOINT(
"Running copper sliver drc" );
121 std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
123 BOOST_TEST_CHECKPOINT(
"DRC engine run completed successfully" );
125 catch(
const std::exception& e )
127 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, exception during RunTests: %s",
128 test.first, e.what() ) );
133 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, unknown exception during RunTests",
139 BOOST_TEST_CHECKPOINT(
"Clearing violation handler" );
142 if( violations.size() ==
test.second )
151 std::map<KIID, EDA_ITEM*> itemMap;
156 m_board->FillItemMap( itemMap );
158 catch(
const std::exception& e )
160 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, exception in FillItemMap: %s",
161 test.first, e.what() ) );
166 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, unknown exception in FillItemMap",
172 for(
size_t i = 0; i < violations.size() && i < 100; ++i )
176 const DRC_ITEM& item = violations[i];
179 catch(
const std::exception& e )
181 BOOST_TEST_MESSAGE( wxString::Format(
"Error reporting violation %zu: %s", i, e.what() ) );
189 BOOST_ERROR( wxString::Format(
"DRC copper sliver: %s, failed (violations found %d "
192 (
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