82 BOOST_CHECK_EQUAL( m_csheet.GetPosition(), wxPoint( 0, 0 ) );
84 BOOST_CHECK_EQUAL( m_sheet.GetParent(), nullptr );
85 BOOST_CHECK_EQUAL( m_sheet.CountSheets(), 1 );
87 BOOST_CHECK_EQUAL( m_csheet.GetScreenCount(), 0 );
89 BOOST_CHECK_EQUAL( m_sheet.SymbolCount(), 0 );
97 m_sheet.SetParent( &m_schematic );
99 BOOST_CHECK_EQUAL( m_sheet.IsRootSheet(), false );
101 m_schematic.SetRoot( &m_sheet );
103 BOOST_CHECK_EQUAL( m_sheet.IsRootSheet(), true );
111 const wxPoint pinPos{ 42, 13 };
116 auto newPin = std::make_unique<SCH_SHEET_PIN>( &m_sheet, pinPos,
"pinname" );
121 m_sheet.AddPin( newPin.release() );
124 BOOST_CHECK_EQUAL( m_sheet.HasPins(), true );
125 BOOST_CHECK_EQUAL( m_sheet.HasPin(
"pinname" ), true );
126 BOOST_CHECK_EQUAL( m_sheet.HasPin(
"PINname" ), true );
128 BOOST_CHECK_EQUAL( m_sheet.GetPin( pinPos ), &pinRef );
131 std::vector<SCH_SHEET_PIN*>& pins = m_sheet.GetPins();
132 BOOST_CHECK_EQUAL( pins[0], &pinRef );
137 m_sheet.RemovePin( &pinRef );
140 BOOST_CHECK_EQUAL( m_sheet.HasPins(), false );
141 BOOST_CHECK_EQUAL( m_sheet.HasPin(
"pinname" ), false );
142 BOOST_CHECK_EQUAL( m_sheet.GetPin( pinPos ), nullptr );
152 for(
int i = 0; i < 5; ++i )
159 m_sheet.AddPin(
pin );
162 std::vector<SCH_SHEET_PIN*>& pins = m_sheet.GetPins();
164 std::vector<int> numbers;
167 numbers.push_back(
pin->GetNumber() );
188 const std::vector<TEST_END_CONN_PIN> pin_defs = {
200 for(
const auto&
pin : pin_defs )
203 std::vector<SCH_SHEET_PIN*>& pins = m_sheet.GetPins();
206 BOOST_CHECK_EQUAL( pins.size(), pin_defs.size() );
210 std::vector<DANGLING_END_ITEM> expectedDangling;
216 pin->GetPosition(),
pin );
219 std::vector<DANGLING_END_ITEM> dangling;
220 m_sheet.GetEndPoints( dangling );
222 BOOST_CHECK_EQUAL_COLLECTIONS( dangling.begin(), dangling.end(),
223 expectedDangling.begin(), expectedDangling.end() );
228 std::vector<wxPoint> expectedConnections;
231 for(
const auto&
pin : pin_defs )
233 expectedConnections.push_back(
pin.m_pos );
236 std::vector<wxPoint> connections = m_sheet.GetConnectionPoints();
238 BOOST_CHECK_EQUAL_COLLECTIONS( connections.begin(), connections.end(),
239 expectedConnections.begin(), expectedConnections.end() );
244 BOOST_AUTO_TEST_SUITE_END()
wxPoint GetPosition() const
Holds all the data relating to one schematic.
const EDA_ITEM * GetParent() const
BOOST_AUTO_TEST_CASE(Default)
Declare the test suite.
#define CHECK_WX_ASSERT(STATEMENT)
A test macro to check a wxASSERT is thrown.
const SCH_SHEET & m_csheet
Can use when you need a const ref (lots of places need fixing here)
EDA_ITEM * GetItem() const
Define a sheet pin (label) used in sheets to create hierarchical schematics.
SCHEMATIC m_schematic
Dummy schematic to attach the test sheet to
bool CollectionHasNoDuplicates(const T &aCollection)
Predicate to check a collection has no duplicate elements.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
DANGLING_END_T GetType() const
Helper class used to store the state of schematic items that can be connected to other schematic item...
std::ostream & operator<<(std::ostream &os, DANGLING_END_ITEM const &d)
Print helper.
Test utilities for timestamps.