20#include <boost/test/unit_test.hpp>
41static const char*
BOARD_FILE =
"net_chains/return_path_zone_bbox.kicad_pcb";
46static const char*
DRU_TEXT = R
"KICAD((version 1)
49 (condition "A.NetClass == 'Default'")
50 (constraint length (min 0mm) (max 200mm))
51 (constraint return_path (layer "B.Cu"))
61 namespace fs = std::filesystem;
65 fs::path druPath = tmpDir.
Path() /
"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 );
General utilities for PCB file IO for QA programs.
Container for design settings for a BOARD object.
std::map< int, SEVERITY > m_DRCSeverities
std::shared_ptr< DRC_ENGINE > m_DRCEngine
const std::filesystem::path & Path() const
Get the path to the temporary directory as a std::filesystem::path.
Handle the data for a net.
void SetNetChain(const wxString &aNetChain)
A PCB_IO derivation for saving and loading Pcbnew s-expression formatted files.
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...
@ DRCE_LIB_FOOTPRINT_ISSUES
@ DRCE_DRILL_OUT_OF_RANGE
@ DRCE_NET_CHAIN_RETURN_PATH_BREAK
@ DRCE_LIB_FOOTPRINT_MISMATCH
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
static const char * BOARD_FILE
static const char * DRU_TEXT
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I