63 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
71 if( sig && sig->GetNets().size() == 4 )
73 candidate = sig.get();
78 BOOST_REQUIRE_MESSAGE( candidate,
"fixture must produce a 4-net potential chain" );
81 "potential chain must have terminal refs populated" );
91 wxFileName netFile = m_schematic->Project().GetProjectFullName();
92 netFile.SetName( netFile.GetName() + wxT(
"_terminal_pins_test" ) );
93 netFile.SetExt( wxT(
"xml" ) );
95 if( wxFileExists( netFile.GetFullPath() ) )
96 wxRemoveFile( netFile.GetFullPath() );
99 std::unique_ptr<NETLIST_EXPORTER_XML> exporter =
100 std::make_unique<NETLIST_EXPORTER_XML>( m_schematic.get() );
110 wxXmlNode* root = xdoc.GetRoot();
113 wxXmlNode* netChains =
find_child( root, wxT(
"net_chains" ) );
116 wxXmlNode* targetChain =
nullptr;
118 for( wxXmlNode* xchain = netChains->GetChildren(); xchain; xchain = xchain->GetNext() )
120 if( xchain->GetName() != wxT(
"net_chain" ) )
123 if( xchain->GetAttribute( wxT(
"name" ), wxEmptyString ) == wxT(
"SIG_TEST" ) )
125 targetChain = xchain;
130 BOOST_REQUIRE_MESSAGE( targetChain,
"expected committed chain SIG_TEST in netlist" );
132 wxXmlNode* xterminals =
find_child( targetChain, wxT(
"terminal_pins" ) );
133 BOOST_REQUIRE_MESSAGE( xterminals,
"expected terminal_pins block under net_chain" );
135 std::vector<std::pair<wxString, wxString>> emittedTerms;
137 for( wxXmlNode* xt = xterminals->GetChildren(); xt; xt = xt->GetNext() )
139 if( xt->GetName() != wxT(
"terminal_pin" ) )
142 emittedTerms.emplace_back( xt->GetAttribute( wxT(
"ref" ), wxEmptyString ),
143 xt->GetAttribute( wxT(
"pin" ), wxEmptyString ) );
148 auto matches = [](
const std::vector<std::pair<wxString, wxString>>& aTerms,
149 const wxString& aRef,
const wxString& aPin )
151 for(
const auto& t : aTerms )
153 if( t.first == aRef && t.second == aPin )
160 BOOST_CHECK( matches( emittedTerms, expectRefA, expectPinA ) );
161 BOOST_CHECK( matches( emittedTerms, expectRefB, expectPinB ) );
163 wxRemoveFile( netFile.GetFullPath() );
void Recalculate(const SCH_SHEET_LIST &aSheetList, bool aUnconditional=false, std::function< void(SCH_ITEM *)> *aChangedItemHandler=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)
Update the connection graph for the given list of sheets.
BOOST_CHECK_EQUAL(result, "25.4")