31#include <wx/filename.h>
32#include <wx/xml/xml.h>
50 for( wxXmlNode* child = parent->GetChildren(); child; child = child->GetNext() )
52 if( child->GetName() ==
name )
64 netFile.SetName( netFile.GetName() + aSuffix );
65 netFile.SetExt( wxT(
"xml" ) );
67 if( wxFileExists( netFile.GetFullPath() ) )
68 wxRemoveFile( netFile.GetFullPath() );
71 std::unique_ptr<NETLIST_EXPORTER_XML> exporter =
72 std::make_unique<NETLIST_EXPORTER_XML>( aSch );
74 bool ok = exporter->WriteNetlist( netFile.GetFullPath(), aOptions, reporter )
80 bool loaded = aDoc.Load( netFile.GetFullPath() );
81 wxRemoveFile( netFile.GetFullPath() );
93 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
101 if( sig && sig->GetNets().size() == 4 )
103 candidate = sig.get();
108 BOOST_REQUIRE_MESSAGE( candidate,
"fixture must produce a 4-net potential chain" );
117 "Generic XML export must not contain <net_chains>" );
126 wxXmlNode* netChains =
find_child( xdoc.GetRoot(), wxT(
"net_chains" ) );
127 BOOST_REQUIRE_MESSAGE( netChains,
128 "KiCad-internal export must contain <net_chains>" );
130 bool foundCommitted =
false;
132 for( wxXmlNode* xchain = netChains->GetChildren(); xchain; xchain = xchain->GetNext() )
134 if( xchain->GetName() != wxT(
"net_chain" ) )
137 if( xchain->GetAttribute( wxT(
"name" ), wxEmptyString ) == wxT(
"SIG_GATING" ) )
139 foundCommitted =
true;
145 "KiCad-internal export must list the committed chain" );
158 SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers();
163 "fresh fixture must have no committed chains" );
165 wxXmlDocument xdocGeneric;
168 BOOST_CHECK(
find_child( xdocGeneric.GetRoot(), wxT(
"net_chains" ) ) ==
nullptr );
170 wxXmlDocument xdocKicad;
175 "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.
const wxString & GetMessages() const
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())
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")