60 namespace fs = std::filesystem;
62 fs::path tmpDir = fs::temp_directory_path() /
"kicad_drc_return_path_bbox";
63 fs::create_directories( tmpDir );
65 fs::path druPath = tmpDir /
"ret_path.kicad_dru";
68 std::ofstream druOut( druPath );
74 board->BuildConnectivity();
76 NETINFO_ITEM* coveredNet = board->FindNet( wxS(
"/CHAIN_COVERED" ) );
80 NETINFO_ITEM* uncoveredNet = board->FindNet( wxS(
"/CHAIN_UNCOVERED" ) );
86 auto drcEngine = std::make_shared<DRC_ENGINE>( board.get(), &bds );
87 wxFileName ruleFile( druPath.string() );
88 drcEngine->InitEngine( ruleFile );
99 std::vector<DRC_ITEM> returnPathViolations;
101 drcEngine->SetViolationHandler(
102 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I&,
int,
106 returnPathViolations.push_back( *aItem );
116 bool coveredFlagged =
false;
117 bool uncoveredFlagged =
false;
119 for(
const DRC_ITEM& item : returnPathViolations )
121 const wxString msg = item.GetErrorMessage(
false );
123 if( msg.Find( wxS(
"COVERED" ) ) != wxNOT_FOUND
124 && msg.Find( wxS(
"UNCOVERED" ) ) == wxNOT_FOUND )
126 coveredFlagged =
true;
129 if( msg.Find( wxS(
"UNCOVERED" ) ) != wxNOT_FOUND )
130 uncoveredFlagged =
true;
133 BOOST_CHECK_MESSAGE( !coveredFlagged,
134 "Return-path break wrongly reported for chain shadowed by a zone" );
135 BOOST_CHECK_MESSAGE( uncoveredFlagged,
136 "Return-path break missing for chain with no overlying zone" );
139 fs::remove( druPath, ec );
std::unique_ptr< BOARD > LoadBoard(const wxString &aFileName, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr)
Load information from some input file format that this PCB_IO implementation knows about into new BOA...
BOOST_CHECK_EQUAL(result, "25.4")