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 );
73 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
75 board->BuildConnectivity();
77 NETINFO_ITEM* coveredNet = board->FindNet( wxS(
"/CHAIN_COVERED" ) );
81 NETINFO_ITEM* uncoveredNet = board->FindNet( wxS(
"/CHAIN_UNCOVERED" ) );
87 auto drcEngine = std::make_shared<DRC_ENGINE>( board.get(), &bds );
88 wxFileName ruleFile( druPath.string() );
89 drcEngine->InitEngine( ruleFile );
100 std::vector<DRC_ITEM> returnPathViolations;
102 drcEngine->SetViolationHandler(
103 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I&,
int,
107 returnPathViolations.push_back( *aItem );
117 bool coveredFlagged =
false;
118 bool uncoveredFlagged =
false;
120 for(
const DRC_ITEM& item : returnPathViolations )
122 const wxString msg = item.GetErrorMessage(
false );
124 if( msg.Find( wxS(
"COVERED" ) ) != wxNOT_FOUND
125 && msg.Find( wxS(
"UNCOVERED" ) ) == wxNOT_FOUND )
127 coveredFlagged =
true;
130 if( msg.Find( wxS(
"UNCOVERED" ) ) != wxNOT_FOUND )
131 uncoveredFlagged =
true;
134 BOOST_CHECK_MESSAGE( !coveredFlagged,
135 "Return-path break wrongly reported for chain shadowed by a zone" );
136 BOOST_CHECK_MESSAGE( uncoveredFlagged,
137 "Return-path break missing for chain with no overlying zone" );
140 fs::remove( druPath, ec );
BOARD * LoadBoard(const wxString &aFileName, BOARD *aAppendToMe, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr) override
Load information from some input file format that this PCB_IO implementation knows about into either ...
BOOST_CHECK_EQUAL(result, "25.4")