|
|
@ -48,8 +48,6 @@ KI_TEST::SCHEMATIC_TEST_FIXTURE::SCHEMATIC_TEST_FIXTURE() : |
|
|
|
|
|
|
|
KI_TEST::SCHEMATIC_TEST_FIXTURE::~SCHEMATIC_TEST_FIXTURE() |
|
|
|
{ |
|
|
|
m_schematic.Reset(); |
|
|
|
m_pi.reset(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -63,39 +61,40 @@ void KI_TEST::SCHEMATIC_TEST_FIXTURE::LoadSchematic( const wxString& aBaseName ) |
|
|
|
pro.SetExt( FILEEXT::ProjectFileExtension ); |
|
|
|
|
|
|
|
// Schematic must be reset before a project is reloaded
|
|
|
|
m_schematic.Reset(); |
|
|
|
m_schematic.release(); |
|
|
|
|
|
|
|
m_manager.LoadProject( pro.GetFullPath() ); |
|
|
|
|
|
|
|
m_manager.Prj().SetElem( PROJECT::ELEM::SCH_SYMBOL_LIBS, nullptr ); |
|
|
|
|
|
|
|
m_schematic.SetProject( &m_manager.Prj() ); |
|
|
|
m_schematic.SetRoot( m_pi->LoadSchematicFile( fn.GetFullPath(), &m_schematic ) ); |
|
|
|
m_schematic = std::make_unique<SCHEMATIC>( &m_manager.Prj() ); |
|
|
|
m_schematic->SetRoot( m_pi->LoadSchematicFile( fn.GetFullPath(), m_schematic.get() ) ); |
|
|
|
|
|
|
|
BOOST_REQUIRE_EQUAL( m_pi->GetError().IsEmpty(), true ); |
|
|
|
|
|
|
|
m_schematic.CurrentSheet().push_back( &m_schematic.Root() ); |
|
|
|
m_schematic->CurrentSheet().push_back( &m_schematic->Root() ); |
|
|
|
|
|
|
|
SCH_SCREENS screens( m_schematic.Root() ); |
|
|
|
SCH_SCREENS screens( m_schematic->Root() ); |
|
|
|
|
|
|
|
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() ) |
|
|
|
screen->UpdateLocalLibSymbolLinks(); |
|
|
|
|
|
|
|
SCH_SHEET_LIST sheets = m_schematic.BuildSheetListSortedByPageNumbers(); |
|
|
|
SCH_SHEET_LIST sheets = m_schematic->BuildSheetListSortedByPageNumbers(); |
|
|
|
|
|
|
|
// Restore all of the loaded symbol instances from the root sheet screen.
|
|
|
|
if( m_schematic.RootScreen()->GetFileFormatVersionAtLoad() < 20221002 ) |
|
|
|
sheets.UpdateSymbolInstanceData( m_schematic.RootScreen()->GetSymbolInstances()); |
|
|
|
if( m_schematic->RootScreen()->GetFileFormatVersionAtLoad() < 20221002 ) |
|
|
|
sheets.UpdateSymbolInstanceData( m_schematic->RootScreen()->GetSymbolInstances() ); |
|
|
|
|
|
|
|
if( m_schematic.RootScreen()->GetFileFormatVersionAtLoad() < 20221110 ) |
|
|
|
sheets.UpdateSheetInstanceData( m_schematic.RootScreen()->GetSheetInstances()); |
|
|
|
if( m_schematic->RootScreen()->GetFileFormatVersionAtLoad() < 20221110 ) |
|
|
|
sheets.UpdateSheetInstanceData( m_schematic->RootScreen()->GetSheetInstances() ); |
|
|
|
|
|
|
|
if( m_schematic.RootScreen()->GetFileFormatVersionAtLoad() < 20221206 ) |
|
|
|
if( m_schematic->RootScreen()->GetFileFormatVersionAtLoad() < 20221206 ) |
|
|
|
{ |
|
|
|
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() ) |
|
|
|
screen->MigrateSimModels(); |
|
|
|
} |
|
|
|
|
|
|
|
if( m_schematic.RootScreen()->GetFileFormatVersionAtLoad() < 20230221 ) |
|
|
|
if( m_schematic->RootScreen()->GetFileFormatVersionAtLoad() < 20230221 ) |
|
|
|
screens.FixLegacyPowerSymbolMismatches(); |
|
|
|
|
|
|
|
sheets.AnnotatePowerSymbols(); |
|
|
@ -114,7 +113,7 @@ void KI_TEST::SCHEMATIC_TEST_FIXTURE::LoadSchematic( const wxString& aBaseName ) |
|
|
|
|
|
|
|
SCH_RULE_AREA::UpdateRuleAreasInScreens( all_screens, nullptr ); |
|
|
|
|
|
|
|
m_schematic.ConnectionGraph()->Recalculate( sheets, true ); |
|
|
|
m_schematic->ConnectionGraph()->Recalculate( sheets, true ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -133,7 +132,7 @@ wxFileName KI_TEST::SCHEMATIC_TEST_FIXTURE::GetSchematicPath( const wxString& aB |
|
|
|
template <typename Exporter> |
|
|
|
wxString TEST_NETLIST_EXPORTER_FIXTURE<Exporter>::GetNetlistPath( bool aTest ) |
|
|
|
{ |
|
|
|
wxFileName netFile = m_schematic.Prj().GetProjectFullName(); |
|
|
|
wxFileName netFile = m_schematic->Prj().GetProjectFullName(); |
|
|
|
|
|
|
|
if( aTest ) |
|
|
|
netFile.SetName( netFile.GetName() + "_test" ); |
|
|
@ -155,7 +154,7 @@ void TEST_NETLIST_EXPORTER_FIXTURE<Exporter>::WriteNetlist() |
|
|
|
wxRemoveFile( netlistPath ); |
|
|
|
|
|
|
|
WX_STRING_REPORTER reporter; |
|
|
|
std::unique_ptr<Exporter> exporter = std::make_unique<Exporter>( &m_schematic ); |
|
|
|
std::unique_ptr<Exporter> exporter = std::make_unique<Exporter>( m_schematic.get() ); |
|
|
|
|
|
|
|
bool success = exporter->WriteNetlist( netlistPath, GetNetlistOptions(), reporter ); |
|
|
|
|
|
|
@ -167,7 +166,7 @@ template <typename Exporter> |
|
|
|
void TEST_NETLIST_EXPORTER_FIXTURE<Exporter>::Cleanup() |
|
|
|
{ |
|
|
|
wxRemoveFile( GetNetlistPath( true ) ); |
|
|
|
m_schematic.Reset(); |
|
|
|
m_schematic->Reset(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|