KiCad PCB EDA Suite
TEST_SCH_SHEET_LIST_FIXTURE Class Reference

Public Member Functions

 TEST_SCH_SHEET_LIST_FIXTURE ()
 
virtual ~TEST_SCH_SHEET_LIST_FIXTURE ()
 
void loadSchematic (const wxString &aRelativePath)
 
wxFileName buildFullPath (const wxString &aRelativePath)
 

Public Attributes

SCHEMATIC m_schematic
 

Schematic to load

More...
 
SCH_PLUGINm_pi
 
SETTINGS_MANAGER m_manager
 

Detailed Description

Definition at line 31 of file test_sch_sheet_list.cpp.

Constructor & Destructor Documentation

◆ TEST_SCH_SHEET_LIST_FIXTURE()

TEST_SCH_SHEET_LIST_FIXTURE::TEST_SCH_SHEET_LIST_FIXTURE ( )
inline

Definition at line 34 of file test_sch_sheet_list.cpp.

34  :
35  m_schematic( nullptr ),
36  m_manager( true )
37  {
38  m_pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD );
39  }
SCHEMATIC m_schematic
Schematic to load

References m_pi.

◆ ~TEST_SCH_SHEET_LIST_FIXTURE()

virtual TEST_SCH_SHEET_LIST_FIXTURE::~TEST_SCH_SHEET_LIST_FIXTURE ( )
inlinevirtual

Definition at line 41 of file test_sch_sheet_list.cpp.

42  {
44  delete m_pi;
45  }
SCHEMATIC m_schematic
Schematic to load
void Reset()
Initialize this schematic to a blank one, unloading anything existing.
Definition: schematic.cpp:51

References m_pi, m_schematic, and SCHEMATIC::Reset().

Member Function Documentation

◆ buildFullPath()

wxFileName TEST_SCH_SHEET_LIST_FIXTURE::buildFullPath ( const wxString &  aRelativePath)

Definition at line 103 of file test_sch_sheet_list.cpp.

104 {
105  wxFileName fn = KI_TEST::GetEeschemaTestDataDir();
106  fn.AppendDir( "netlists" );
107 
108  wxString path = fn.GetFullPath();
109  path += aRelativePath + wxT( "." ) + KiCadSchematicFileExtension;
110 
111  return wxFileName( path );
112 }
wxFileName GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
const std::string KiCadSchematicFileExtension

References KI_TEST::GetEeschemaTestDataDir(), KiCadSchematicFileExtension, and path.

Referenced by loadSchematic().

◆ loadSchematic()

void TEST_SCH_SHEET_LIST_FIXTURE::loadSchematic ( const wxString &  aRelativePath)

Definition at line 60 of file test_sch_sheet_list.cpp.

61 {
62  wxFileName fn = buildFullPath( aRelativePath );
63 
64  BOOST_TEST_MESSAGE( fn.GetFullPath() );
65 
66  wxFileName pro( fn );
67  pro.SetExt( ProjectFileExtension );
68 
71 
72  m_manager.LoadProject( pro.GetFullPath() );
74 
76 
77  m_schematic.SetRoot( m_pi->Load( fn.GetFullPath(), &m_schematic ) );
78 
79  BOOST_REQUIRE_EQUAL( m_pi->GetError().IsEmpty(), true );
80 
82 
83  SCH_SCREENS screens( m_schematic.Root() );
84 
85  for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
86  screen->UpdateLocalLibSymbolLinks();
87 
89 
90  // Restore all of the loaded symbol instances from the root sheet screen.
93 
94  sheets.AnnotatePowerSymbols();
95 
96  // NOTE: This is required for multi-unit symbols to be correct
97  // Normally called from SCH_EDIT_FRAME::FixupJunctions() but could be refactored
98  for( SCH_SHEET_PATH& sheet : sheets )
99  sheet.UpdateAllScreenReferences();
100 }
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
PROJECT & Prj() const
A helper while we are not MDI-capable – return the one and only project.
const std::string ProjectFileExtension
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
virtual SCH_SHEET * Load(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const PROPERTIES *aProperties=nullptr)
Load information from some input file format that this SCH_PLUGIN implementation knows about,...
Definition: sch_plugin.cpp:51
const std::vector< SYMBOL_INSTANCE_REFERENCE > & GetSymbolInstances() const
Definition: sch_screen.h:486
void UpdateSheetInstances(const std::vector< SCH_SHEET_INSTANCE > &aSheetInstances)
Update all of the sheet instance information using aSheetInstances.
virtual void SetElem(ELEM_T aIndex, _ELEM *aElem)
Definition: project.cpp:258
void SetRoot(SCH_SHEET *aRootSheet)
Initialize the schematic with a new root sheet.
Definition: schematic.cpp:104
SCHEMATIC m_schematic
Schematic to load
const std::vector< SCH_SHEET_INSTANCE > & GetSheetInstances() const
Definition: sch_screen.h:491
wxFileName buildFullPath(const wxString &aRelativePath)
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void SetProject(PROJECT *aPrj)
Definition: schematic.cpp:76
void clear()
Forwarded method from std::vector.
void UpdateSymbolInstances(const std::vector< SYMBOL_INSTANCE_REFERENCE > &aSymbolInstances)
Update all of the symbol instance information using aSymbolInstances.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Loads a project or sets up a new project with a specified path.
void Reset()
Initialize this schematic to a blank one, unloading anything existing.
Definition: schematic.cpp:51
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:87
SCH_SHEET & Root() const
Definition: schematic.h:92
virtual const wxString & GetError() const
Return an error string to the caller.
Definition: sch_plugin.cpp:177
void AnnotatePowerSymbols()
Silently annotate the not yet annotated power symbols of the entire hierarchy of the sheet path list.
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
Definition: schematic.cpp:117
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:121
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:593

References SCH_SHEET_LIST::AnnotatePowerSymbols(), buildFullPath(), SCH_SHEET_PATH::clear(), SCHEMATIC::CurrentSheet(), PROJECT::ELEM_SCH_SYMBOL_LIBS, SCH_PLUGIN::GetError(), SCH_SCREEN::GetSheetInstances(), SCHEMATIC::GetSheets(), SCH_SCREEN::GetSymbolInstances(), SCH_PLUGIN::Load(), SETTINGS_MANAGER::LoadProject(), m_manager, m_pi, m_schematic, SETTINGS_MANAGER::Prj(), ProjectFileExtension, SCH_SHEET_PATH::push_back(), SCHEMATIC::Reset(), SCHEMATIC::Root(), SCHEMATIC::RootScreen(), PROJECT::SetElem(), SCHEMATIC::SetProject(), SCHEMATIC::SetRoot(), SCH_SHEET_LIST::UpdateSheetInstances(), and SCH_SHEET_LIST::UpdateSymbolInstances().

Member Data Documentation

◆ m_manager

SETTINGS_MANAGER TEST_SCH_SHEET_LIST_FIXTURE::m_manager

Definition at line 56 of file test_sch_sheet_list.cpp.

Referenced by loadSchematic().

◆ m_pi

SCH_PLUGIN* TEST_SCH_SHEET_LIST_FIXTURE::m_pi

◆ m_schematic

SCHEMATIC TEST_SCH_SHEET_LIST_FIXTURE::m_schematic

Schematic to load

Definition at line 52 of file test_sch_sheet_list.cpp.

Referenced by loadSchematic(), and ~TEST_SCH_SHEET_LIST_FIXTURE().


The documentation for this class was generated from the following file: