37 fn.AppendDir(
"netlists" );
39 wxString
path = fn.GetFullPath();
42 return wxFileName(
path );
53 SCH_SHEET_LIST sheets = m_schematic.BuildSheetListSortedByPageNumbers();
60 BOOST_CHECK_EQUAL( sheets.at( 0 ).GetPageNumber(),
"1" );
61 BOOST_CHECK_EQUAL( sheets.at( 1 ).GetPageNumber(),
"2" );
62 BOOST_CHECK_EQUAL( sheets.at( 2 ).GetPageNumber(),
"3" );
68 BOOST_TEST_CONTEXT(
"Read Sub-Sheet, prior to modification" )
71 LoadSchematic(
"complex_hierarchy_shared/ampli_ht/ampli_ht" );
73 SCH_SHEET_LIST sheets = m_schematic.BuildSheetListSortedByPageNumbers();
75 BOOST_CHECK_EQUAL( sheets.size(), 2 );
76 BOOST_CHECK_EQUAL( sheets.at( 0 ).GetPageNumber(),
"i" );
77 BOOST_CHECK_EQUAL( sheets.at( 1 ).GetPageNumber(),
"ii" );
80 BOOST_TEST_CONTEXT(
"Read Root Sheet, prior to modification" )
83 LoadSchematic(
"complex_hierarchy_shared/complex_hierarchy" );
85 SCH_SHEET_LIST sheets = m_schematic.BuildSheetListSortedByPageNumbers();
87 BOOST_CHECK_EQUAL( sheets.size(), 5 );
88 BOOST_CHECK_EQUAL( sheets.at( 0 ).GetPageNumber(),
"1" );
89 BOOST_CHECK_EQUAL( sheets.at( 1 ).GetPageNumber(),
"2" );
90 BOOST_CHECK_EQUAL( sheets.at( 2 ).GetPageNumber(),
"3" );
91 BOOST_CHECK_EQUAL( sheets.at( 3 ).GetPageNumber(),
"4" );
92 BOOST_CHECK_EQUAL( sheets.at( 4 ).GetPageNumber(),
"5" );
95 BOOST_TEST_CONTEXT(
"Modify page numbers in root sheet" )
97 SCH_SHEET_LIST sheets = m_schematic.BuildSheetListSortedByPageNumbers();
100 sheets.at( 0 ).SetPageNumber(
"A" );
101 sheets.at( 1 ).SetPageNumber(
"B" );
102 sheets.at( 2 ).SetPageNumber(
"C" );
103 sheets.at( 3 ).SetPageNumber(
"D" );
104 sheets.at( 4 ).SetPageNumber(
"E" );
107 wxFileName rootFn = GetSchematicPath(
"complex_hierarchy_shared/complex_hierarchy" );
108 wxFileName prjFn = rootFn;
112 rootFn.AppendDir(
"temp" );
113 BOOST_CHECK( rootFn.Mkdir() );
115 wxFileName newPrjFn = rootFn;
117 BOOST_CHECK( wxCopyFile( prjFn.GetFullPath(), newPrjFn.GetFullPath() ) );
119 m_pi->SaveSchematicFile( rootFn.GetFullPath(), &m_schematic.Root(), &m_schematic );
121 wxFileName subSheetFn = rootFn;
122 BOOST_CHECK( subSheetFn.AppendDir(
"ampli_ht" ) );
123 BOOST_CHECK( subSheetFn.Mkdir() );
125 subSheetFn.SetName(
"ampli_ht" );
126 m_pi->SaveSchematicFile( subSheetFn.GetFullPath(), sheets.at( 1 ).Last(), &m_schematic );
128 subSheetFn.SetName(
"filter" );
129 m_pi->SaveSchematicFile( subSheetFn.GetFullPath(), sheets.at( 2 ).Last(), &m_schematic );
131 LoadSchematic(
"complex_hierarchy_shared/temp/complex_hierarchy" );
133 sheets = m_schematic.BuildSheetListSortedByPageNumbers();
135 BOOST_CHECK_EQUAL( sheets.size(), 5 );
136 BOOST_CHECK_EQUAL( sheets.at( 0 ).GetPageNumber(),
"A" );
137 BOOST_CHECK_EQUAL( sheets.at( 1 ).GetPageNumber(),
"B" );
138 BOOST_CHECK_EQUAL( sheets.at( 2 ).GetPageNumber(),
"C" );
139 BOOST_CHECK_EQUAL( sheets.at( 3 ).GetPageNumber(),
"D" );
140 BOOST_CHECK_EQUAL( sheets.at( 4 ).GetPageNumber(),
"E" );
143 BOOST_CHECK( wxRemoveFile( subSheetFn.GetFullPath() ) );
144 subSheetFn.SetName(
"ampli_ht" );
145 BOOST_CHECK( wxRemoveFile( subSheetFn.GetFullPath() ) );
146 BOOST_CHECK( subSheetFn.Rmdir() );
147 BOOST_CHECK( wxRemoveFile( newPrjFn.GetFullPath() ) );
148 BOOST_CHECK( wxRemoveFile( rootFn.GetFullPath() ) );
149 BOOST_CHECK( rootFn.Rmdir() );
152 BOOST_TEST_CONTEXT(
"Read Sub-Sheet, after modification" )
156 LoadSchematic(
"complex_hierarchy_shared/ampli_ht/ampli_ht" );
158 SCH_SHEET_LIST sheets = m_schematic.BuildSheetListSortedByPageNumbers();
160 BOOST_CHECK_EQUAL( sheets.size(), 2 );
161 BOOST_CHECK_EQUAL( sheets.at( 0 ).GetPageNumber(),
"i" );
162 BOOST_CHECK_EQUAL( sheets.at( 1 ).GetPageNumber(),
"ii" );
A generic fixture for loading schematics and associated settings for qa tests.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void SetInitialPageNumbers()
Set initial sheet page numbers.
bool AllSheetPageNumbersEmpty() const
Check all of the sheet instance for empty page numbers.
wxFileName GetSchematicPath(const wxString &aRelativePath) override
static const std::string ProjectFileExtension
static const std::string KiCadSchematicFileExtension
std::string GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
static void LoadSchematic(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, const wxString &aFileName)
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(TestSheetListPageProperties)
Definition of file extensions used in Kicad.