66 drcEngine->SetViolationHandler(
67 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
68 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
73 aPathGenerator( marker );
75 m_board->Add( marker );
79 drcEngine->ClearViolationHandler();
82 int courtyardCount = 0;
83 int courtyardExcluded = 0;
97 <<
", excluded: " << courtyardExcluded );
99 BOOST_REQUIRE_GE( courtyardCount, 1 );
103 auto markersProvider = std::make_shared<DRC_ITEMS_PROVIDER>(
105 auto ratsnestProvider = std::make_shared<DRC_ITEMS_PROVIDER>(
107 auto fpWarningsProvider = std::make_shared<DRC_ITEMS_PROVIDER>(
111 markersProvider->SetSeverities( allSev );
112 ratsnestProvider->SetSeverities( allSev );
113 fpWarningsProvider->SetSeverities( allSev );
116 fpWarningsProvider );
120 wxString
jsonPath = wxFileName::CreateTempFileName( wxT(
"kicad-drc-24264-json-" ) );
121 wxString textPath = wxFileName::CreateTempFileName( wxT(
"kicad-drc-24264-text-" ) );
126 std::ifstream reportStream(
jsonPath.fn_str() );
129 nlohmann::json reportJson;
130 reportStream >> reportJson;
131 reportStream.close();
136 int sawCourtyardExcluded = 0;
138 for(
const auto& violation : reportJson[
"violations"] )
140 if( violation.value(
"type", std::string() ) ==
"courtyards_overlap" )
142 BOOST_CHECK( violation.value(
"excluded",
false ) );
144 if( violation.value(
"excluded",
false ) )
145 ++sawCourtyardExcluded;
152 std::ifstream textStream( textPath.fn_str() );
155 std::stringstream textBuf;
156 textBuf << textStream.rdbuf();
158 wxRemoveFile( textPath );
160 const std::string textReport = textBuf.str();
163 BOOST_CHECK( textReport.find(
"courtyards_overlap" ) != std::string::npos );
164 BOOST_CHECK( textReport.find(
"(excluded)" ) != std::string::npos );
BOOST_CHECK_EQUAL(result, "25.4")