38#include <boost/test/unit_test.hpp>
50#include <wx/filename.h>
51#include <wx/stdpaths.h>
59 wxString tempDir = wxStandardPaths::Get().GetTempDir();
60 wxString projectPath = tempDir + wxFileName::GetPathSeparator()
61 + wxT(
"test_sheet_annotation.kicad_pro" );
65 m_schematic = std::make_unique<SCHEMATIC>(
nullptr );
74 if( wxFileExists( file ) )
97 m_schematic->CreateDefaultScreens();
99 std::vector<SCH_SHEET*> topSheets = m_schematic->GetTopLevelSheets();
112 newScreen->
SetFileName( wxT(
"/tmp/test_subsheet.kicad_sch" ) );
117 newScreen->
Append( symbol );
121 size_t countBefore = hierarchyBefore.size();
124 rootScreen->
Append( newSheet );
131 m_schematic->RefreshHierarchy();
147 m_schematic->CreateDefaultScreens();
149 std::vector<SCH_SHEET*> topSheets = m_schematic->GetTopLevelSheets();
162 newScreen->
SetFileName( wxT(
"/tmp/design_block.kicad_sch" ) );
167 newScreen->
Append( symbol1 );
171 newScreen->
Append( symbol2 );
174 rootScreen->
Append( newSheet );
177 m_schematic->RefreshHierarchy();
188 std::vector<SCH_SHEET_PATH> foundSheets;
200 BOOST_TEST_MESSAGE(
"Test passed: Symbols found in new sheet after hierarchy refresh" );
210 m_schematic->CreateDefaultScreens();
212 std::vector<SCH_SHEET*> topSheets = m_schematic->GetTopLevelSheets();
227 newScreen->
SetFileName( wxT(
"/tmp/stale_test.kicad_sch" ) );
232 newScreen->
Append( symbol );
235 rootScreen->
Append( newSheet );
246 std::vector<SCH_SHEET_PATH> foundSheets;
258 BOOST_TEST_MESSAGE(
"Test passed: Stale hierarchy does not find symbols (confirms root cause)" );
Container for project specific data.
void SetText(const wxString &aText) override
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void GetSheetsWithinPath(std::vector< SCH_SHEET_PATH > &aSheets, const SCH_SHEET_PATH &aSheetPath) const
Add a SCH_SHEET_PATH object to aSheets for each sheet in the list that are contained within aSheetPat...
void GetSymbolsWithinPath(SCH_REFERENCE_LIST &aReferences, const SCH_SHEET_PATH &aSheetPath, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets that are contained wi...
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this sheet.
SCH_SCREEN * GetScreen() const
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
void SetPosition(const VECTOR2I &aPosition) override
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
SHEET_ANNOTATION_FIXTURE()
SETTINGS_MANAGER m_settingsManager
std::unique_ptr< SCHEMATIC > m_schematic
~SHEET_ANNOTATION_FIXTURE()
std::vector< wxString > m_tempFiles
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(TestSheetFoundInHierarchyAfterRefresh)
Test that after adding a sheet and refreshing the hierarchy, the sheet path can be found via GetSheet...
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I