81 BOOST_CHECK_EQUAL( m_csheet.GetPosition(),
VECTOR2I( 0, 0 ) );
83 BOOST_CHECK_EQUAL( m_sheet.GetParent(),
nullptr );
84 BOOST_CHECK_EQUAL( m_sheet.CountSheets(), 1 );
86 BOOST_CHECK_EQUAL( m_csheet.GetScreenCount(), 0 );
88 BOOST_CHECK_EQUAL( m_sheet.SymbolCount(), 0 );
96 m_sheet.SetParent( &m_schematic );
98 BOOST_CHECK_EQUAL( m_sheet.IsRootSheet(),
false );
100 m_schematic.SetRoot( &m_sheet );
102 BOOST_CHECK_EQUAL( m_sheet.IsRootSheet(),
true );
115 auto newPin = std::make_unique<SCH_SHEET_PIN>( &m_sheet, pinPos,
"pinname" );
120 m_sheet.AddPin( newPin.release() );
123 BOOST_CHECK_EQUAL( m_sheet.HasPins(),
true );
124 BOOST_CHECK_EQUAL( m_sheet.HasPin(
"pinname" ),
true );
125 BOOST_CHECK_EQUAL( m_sheet.HasPin(
"PINname" ),
false );
127 BOOST_CHECK_EQUAL( m_sheet.GetPin( pinPos ), &pinRef );
130 std::vector<SCH_SHEET_PIN*>& pins = m_sheet.GetPins();
131 BOOST_CHECK_EQUAL( pins[0], &pinRef );
136 m_sheet.RemovePin( &pinRef );
139 BOOST_CHECK_EQUAL( m_sheet.HasPins(),
false );
140 BOOST_CHECK_EQUAL( m_sheet.HasPin(
"pinname" ),
false );
141 BOOST_CHECK_EQUAL( m_sheet.GetPin( pinPos ),
nullptr );
151 for(
int i = 0; i < 5; ++i )
158 m_sheet.AddPin(
pin );
161 std::vector<SCH_SHEET_PIN*>& pins = m_sheet.GetPins();
163 std::vector<int> numbers;
166 numbers.push_back(
pin->GetNumber() );
187 const std::vector<TEST_END_CONN_PIN> pin_defs = {
199 for(
const auto&
pin : pin_defs )
202 std::vector<SCH_SHEET_PIN*>& pins = m_sheet.GetPins();
205 BOOST_CHECK_EQUAL( pins.size(), pin_defs.size() );
209 std::vector<DANGLING_END_ITEM> expectedDangling;
215 pin->GetPosition(),
pin );
218 std::vector<DANGLING_END_ITEM> dangling;
219 m_sheet.GetEndPoints( dangling );
221 BOOST_CHECK_EQUAL_COLLECTIONS( dangling.begin(), dangling.end(),
222 expectedDangling.begin(), expectedDangling.end() );
227 std::vector<VECTOR2I> expectedConnections;
230 for(
const auto&
pin : pin_defs )
232 expectedConnections.push_back(
pin.m_pos );
235 std::vector<VECTOR2I> connections = m_sheet.GetConnectionPoints();
237 BOOST_CHECK_EQUAL_COLLECTIONS( connections.begin(), connections.end(),
238 expectedConnections.begin(), expectedConnections.end() );
Helper class used to store the state of schematic items that can be connected to other schematic item...
DANGLING_END_T GetType() const
const EDA_ITEM * GetParent() const
EDA_ITEM * GetItem() const
VECTOR2I GetPosition() const
Holds all the data relating to one schematic.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
const SCH_SHEET & m_csheet
TEST_SCH_SHEET_FIXTURE()
Dummy schematic to attach the test sheet to.
SCH_SHEET m_sheet
Can use when you need a const ref (lots of places need fixing here)
std::ostream & operator<<(std::ostream &aStream, const EDA_TEXT &aText)
bool CollectionHasNoDuplicates(const T &aCollection)
Predicate to check a collection has no duplicate elements.
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(Default)
Declare the test suite.
#define CHECK_WX_ASSERT(STATEMENT)
A test macro to check a wxASSERT is thrown.
Test utilities for timestamps.