81 BOOST_CHECK_EQUAL( m_csheet.GetPosition(), wxPoint( 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 );
110 const wxPoint pinPos{ 42, 13 };
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" ), true );
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 );
149 for(
int i = 0; i < 5; ++i )
156 m_sheet.AddPin( pin );
159 std::vector<SCH_SHEET_PIN*>& pins = m_sheet.GetPins();
161 std::vector<int> numbers;
164 numbers.push_back( pin->GetNumber() );
185 const std::vector<TEST_END_CONN_PIN> pin_defs = {
197 for(
const auto& pin : pin_defs )
198 m_sheet.AddPin(
new SCH_SHEET_PIN( &m_sheet, pin.m_pos, pin.m_pin_name ) );
200 std::vector<SCH_SHEET_PIN*>& pins = m_sheet.GetPins();
203 BOOST_CHECK_EQUAL( pins.size(), pin_defs.size() );
207 std::vector<DANGLING_END_ITEM> expectedDangling;
213 pin->GetPosition(), pin );
216 std::vector<DANGLING_END_ITEM> dangling;
217 m_sheet.GetEndPoints( dangling );
219 BOOST_CHECK_EQUAL_COLLECTIONS( dangling.begin(), dangling.end(),
220 expectedDangling.begin(), expectedDangling.end() );
225 std::vector<wxPoint> expectedConnections;
228 for(
const auto& pin : pin_defs )
230 expectedConnections.push_back( pin.m_pos );
233 std::vector<wxPoint> connections = m_sheet.GetConnectionPoints();
235 BOOST_CHECK_EQUAL_COLLECTIONS( connections.begin(), connections.end(),
236 expectedConnections.begin(), expectedConnections.end() );
241 BOOST_AUTO_TEST_SUITE_END()
wxPoint GetPosition() const
Holds all the data relating to one schematic A schematic may consist of one or more sheets (and one r...
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.
void SetNumber(int aNumber)
Set the sheet label number.
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.