30#include <wx/filename.h>
31#include <wx/xml/xml.h>
49 for( wxXmlNode* child = parent->GetChildren(); child; child = child->GetNext() )
51 if( child->GetName() ==
name )
63 netFile.SetName( netFile.GetName() + aSuffix );
64 netFile.SetExt( wxT(
"xml" ) );
66 if( wxFileExists( netFile.GetFullPath() ) )
67 wxRemoveFile( netFile.GetFullPath() );
70 std::unique_ptr<NETLIST_EXPORTER_XML> exporter =
71 std::make_unique<NETLIST_EXPORTER_XML>( aSch );
73 bool ok = exporter->WriteNetlist( netFile.GetFullPath(), aOptions,
reporter )
79 bool loaded = aDoc.Load( netFile.GetFullPath() );
80 wxRemoveFile( netFile.GetFullPath() );
92 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
100 if( sig && sig->GetNets().size() == 4 )
102 candidate = sig.get();
107 BOOST_REQUIRE_MESSAGE( candidate,
"fixture must produce a 4-net potential chain" );
116 "Generic XML export must not contain <net_chains>" );
125 wxXmlNode* netChains =
find_child( xdoc.GetRoot(), wxT(
"net_chains" ) );
126 BOOST_REQUIRE_MESSAGE( netChains,
127 "KiCad-internal export must contain <net_chains>" );
129 bool foundCommitted =
false;
131 for( wxXmlNode* xchain = netChains->GetChildren(); xchain; xchain = xchain->GetNext() )
133 if( xchain->GetName() != wxT(
"net_chain" ) )
136 if( xchain->GetAttribute( wxT(
"name" ), wxEmptyString ) == wxT(
"SIG_GATING" ) )
138 foundCommitted =
true;
144 "KiCad-internal export must list the committed chain" );
157 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
162 "fresh fixture must have no committed chains" );
164 wxXmlDocument xdocGeneric;
167 BOOST_CHECK(
find_child( xdocGeneric.GetRoot(), wxT(
"net_chains" ) ) ==
nullptr );
169 wxXmlDocument xdocKicad;
174 "Empty chain set must not produce a stray <net_chains/> element" );
Calculate the connectivity of a schematic and generates netlists.
SCH_NETCHAIN * CreateNetChainFromPotential(SCH_NETCHAIN *aPotential, const wxString &aName)
Promote a potential net chain to an actual user net chain with the provided name.
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.
const std::vector< std::unique_ptr< SCH_NETCHAIN > > & GetPotentialNetChains() const
Potential net chains are inferred groupings produced by RebuildNetChains() but not yet user-committed...
const std::vector< std::unique_ptr< SCH_NETCHAIN > > & GetCommittedNetChains() const
Return user-created (committed) net chains (legacy accessor retained under net-chain API).
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Holds all the data relating to one schematic.
PROJECT & Project() const
Return a reference to the project this schematic is part of.
A net chain is a collection of nets that are connected together through passive components.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
A wrapper for reporting to a wxString object.
void LoadSchematic(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< SCHEMATIC > &aSchematic)
std::vector< FAB_LAYER_COLOR > dummy
SETTINGS_MANAGER m_settingsManager
XML_NETCHAIN_GATING_FIXTURE()=default
std::unique_ptr< SCHEMATIC > m_schematic
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
IbisParser parser & reporter
static wxXmlNode * find_child(wxXmlNode *parent, const wxString &name)
static bool writeAndLoad(SCHEMATIC *aSch, const wxString &aSuffix, unsigned aOptions, wxXmlDocument &aDoc)
BOOST_FIXTURE_TEST_CASE(NetlistExporterXML_NetChainsAbsentForGenericFormat, XML_NETCHAIN_GATING_FIXTURE)
BOOST_CHECK_MESSAGE(totalMismatches==0, std::to_string(totalMismatches)+" board(s) with strategy disagreements")