70 drcEngine->SetViolationHandler(
71 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
72 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
77 aPathGenerator( marker );
79 m_board->Add( marker );
83 drcEngine->ClearViolationHandler();
86 int courtyardCount = 0;
87 int courtyardExcluded = 0;
101 <<
", excluded: " << courtyardExcluded );
103 BOOST_REQUIRE_GE( courtyardCount, 1 );
107 auto markersProvider = std::make_shared<DRC_ITEMS_PROVIDER>(
109 auto ratsnestProvider = std::make_shared<DRC_ITEMS_PROVIDER>(
111 auto fpWarningsProvider = std::make_shared<DRC_ITEMS_PROVIDER>(
115 markersProvider->SetSeverities( allSev );
116 ratsnestProvider->SetSeverities( allSev );
117 fpWarningsProvider->SetSeverities( allSev );
120 fpWarningsProvider );
124 wxString
jsonPath = wxFileName::CreateTempFileName( wxT(
"kicad-drc-24264-json-" ) );
125 wxString textPath = wxFileName::CreateTempFileName( wxT(
"kicad-drc-24264-text-" ) );
130 std::ifstream reportStream(
jsonPath.fn_str() );
133 nlohmann::json reportJson;
134 reportStream >> reportJson;
135 reportStream.close();
140 int sawCourtyardExcluded = 0;
142 for(
const auto& violation : reportJson[
"violations"] )
144 if( violation.value(
"type", std::string() ) ==
"courtyards_overlap" )
146 BOOST_CHECK( violation.value(
"excluded",
false ) );
148 if( violation.value(
"excluded",
false ) )
149 ++sawCourtyardExcluded;
156 std::ifstream textStream( textPath.fn_str() );
159 std::stringstream textBuf;
160 textBuf << textStream.rdbuf();
162 wxRemoveFile( textPath );
164 const std::string textReport = textBuf.str();
167 BOOST_CHECK( textReport.find(
"courtyards_overlap" ) != std::string::npos );
168 BOOST_CHECK( textReport.find(
"(excluded)" ) != std::string::npos );
BOOST_CHECK_EQUAL(result, "25.4")