92 BOOST_CHECK( ( m_sch_pin->GetType() == m_lib_pin->GetType() ) );
121 alt.
m_Name = wxS(
"alt" );
124 copied.GetAlternates()[ wxS(
"alt" ) ] = alt;
142 m_sch_pin->SetIsDangling(
false );
146 m_sch_pin->SetIsDangling(
true );
157 const wxString
name = m_sch_pin->GetDefaultNetName(
path );
162 const wxString map_name = m_sch_pin->GetDefaultNetName(
path );
173 m_parent_part->SetGlobalPower();
178 delete m_parent_symbol;
179 m_parent_symbol =
new SCH_SYMBOL( *m_parent_part, m_parent_part->GetLibId(), &
path, 0, 0,
181 m_parent_symbol->SetRef( &
path,
"U2" );
182 m_parent_symbol->SetValueFieldText(
"voltage_value" );
183 m_parent_symbol->UpdatePins();
185 m_sch_pin = m_parent_symbol->GetPins( &
path )[0];
188 const wxString pwr_name = m_sch_pin->GetDefaultNetName(
path );
195 alt.
m_Name = wxS(
"ALT1" );
198 m_lib_pin->GetAlternates()[ wxS(
"ALT1" ) ] = alt;
200 m_parent_symbol->SetLibSymbol( m_parent_part->Flatten().release() );
201 m_sch_pin = m_parent_symbol->GetPins()[0];
202 m_sch_pin->SetAlt( wxS(
"ALT1" ) );
205 m_lib_pin->GetAlternates().erase( wxS(
"ALT1" ) );
206 altNew.
m_Name = wxS(
"ALT1_NEW" );
207 m_lib_pin->GetAlternates()[ wxS(
"ALT1_NEW" ) ] = altNew;
209 m_parent_symbol->SetLibSymbol( m_parent_part->Flatten().release() );
211 SCH_PIN* updatedPin = m_parent_symbol->GetPins()[0];
214 BOOST_CHECK( updatedPin->
GetAlternates().count( wxS(
"ALT1" ) ) == 0 );
228 powerAlt.
m_Name = wxS(
"8.pow" );
231 m_lib_pin->GetAlternates()[ wxS(
"8.pow" ) ] = powerAlt;
234 m_parent_symbol->SetLibSymbol( m_parent_part->Flatten().release() );
235 m_sch_pin = m_parent_symbol->GetPins()[0];
241 m_sch_pin->SetAlt( wxS(
"8.pow" ) );
264 powerAlt.
m_Name = wxS(
"8.pow" );
267 m_lib_pin->GetAlternates()[ wxS(
"8.pow" ) ] = powerAlt;
270 m_parent_symbol->SetLibSymbol( m_parent_part->Flatten().release() );
271 m_sch_pin = m_parent_symbol->GetPins()[0];
274 m_sch_pin->SetAlt( wxS(
"8.pow" ) );
280 m_parent_symbol->SetLibSymbol( m_parent_part->Flatten().release() );
281 m_sch_pin = m_parent_symbol->GetPins()[0];
309 powerAlt.
m_Name = wxS(
"8.pow" );
326 std::make_unique<SCH_PIN>( symbol, wxS(
"8" ), wxS(
"8.pow" ),
KIID() ) );
332 BOOST_CHECK( parserPin->
GetLibPin() ==
nullptr );
345 if( !libPins.empty() )
347 SCH_PIN* flattenedLibPin = libPins[0];
349 BOOST_CHECK( flattenedLibPin->
GetAlternates().count( wxS(
"8.pow" ) ) > 0 );
359 BOOST_CHECK( updatedPin->
GetLibPin() !=
nullptr );
387 powerAlt.
m_Name = wxS(
"8.pow" );
396 BOOST_CHECK( origLibPin->
GetAlternates().count( wxS(
"8.pow" ) ) > 0 );
404 std::vector<SCH_PIN*> copiedLibPins = copiedLibSymbol->
GetGraphicalPins( 0, 0 );
407 if( !copiedLibPins.empty() )
409 SCH_PIN* copiedLibPin = copiedLibPins[0];
413 "Copied library pin should have alternates" );
414 BOOST_CHECK_MESSAGE( copiedLibPin->
GetAlternates().count( wxS(
"8.pow" ) ) > 0,
415 "Copied library pin should have '8.pow' alternate" );
418 if( copiedLibPin->
GetAlternates().count( wxS(
"8.pow" ) ) > 0 )
420 BOOST_CHECK( copiedLibPin->
GetAlternates().at( wxS(
"8.pow" ) ).m_Type
434 std::make_unique<SCH_PIN>( symbol, wxS(
"8" ), wxS(
"8.pow" ),
KIID() ) );
439 BOOST_CHECK( rawPin->
GetLibPin() ==
nullptr );
445 std::vector<SCH_PIN*> schPins = symbol->
GetPins( &
path );
448 if( !schPins.empty() )
453 BOOST_CHECK_MESSAGE( schPin->
GetLibPin() !=
nullptr,
454 "Schematic pin should have m_libPin set after UpdatePins" );
457 BOOST_CHECK_MESSAGE( schPin->
GetAlt() ==
"8.pow",
458 "Alternate should be preserved as '8.pow'" );
462 "GetType() should return alternate's type (PT_POWER_IN)" );
468 "Library pin pointed to by schematic pin should have alternates" );
470 "Library pin should have '8.pow' in its alternates map" );
475 delete origLibSymbol;
497 powerAlt.
m_Name = wxS(
"8.pow" );
509 std::make_unique<SCH_PIN>( symbol, wxS(
"8" ), wxS(
"8.pow" ),
KIID() ) );
515 BOOST_CHECK( rawPin->
GetLibPin() ==
nullptr );
520 "GetType() with m_alt set but m_libPin=nullptr should return PT_UNSPECIFIED" );
529 std::vector<SCH_PIN*> schPins = symbol->
GetPins( &
path );
532 if( !schPins.empty() )
536 BOOST_CHECK( schPin->
GetLibPin() !=
nullptr );
538 "After SetLibSymbol, GetType() should return PT_POWER_IN" );
588 newPin1->
SetName(
"NEW_PIN1" );
604 BOOST_CHECK( schPin !=
nullptr );
613 delete singlePinPart;
664 "HasConnectivityChanges should detect visibility change for power input pins" );
667 "HasConnectivityChanges should detect visibility change for power input pins (reverse)" );
689 "HasConnectivityChanges should NOT detect visibility change for regular input pins" );
734 "HasConnectivityChanges should detect change from INPUT to POWER_IN" );
737 "HasConnectivityChanges should detect change from POWER_IN to INPUT" );
Define a library symbol object.
const LIB_ID & GetLibId() const override
std::vector< const SCH_PIN * > GetGraphicalPins(int aUnit=0, int aBodyStyle=0) const
Graphical pins: Return schematic pin objects as drawn (unexpanded), filtered by unit/body.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
const SYMBOL * GetParentSymbol() const
const std::map< wxString, ALT > & GetAlternates() const
void SetNumber(const wxString &aNumber)
void SetVisible(bool aVisible)
ALT GetAlt(const wxString &aAlt)
bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const override
Check if aItem has connectivity changes against this object.
void SetName(const wxString &aName)
bool IsGlobalPower() const
Return whether this pin forms a global power connection: i.e., is part of a power symbol and of type ...
SCH_PIN * GetLibPin() const
void SetPosition(const VECTOR2I &aPos) override
const wxString & GetShownName() const
void SetType(ELECTRICAL_PINTYPE aType)
const wxString & GetNumber() const
ELECTRICAL_PINTYPE GetType() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void SetLibId(const LIB_ID &aName)
std::vector< std::unique_ptr< SCH_PIN > > & GetRawPins()
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
SCH_SYMBOL * m_parent_symbol
LIB_SYMBOL * m_parent_part
@ PT_INPUT
usual pin input: must be connected
@ PT_NC
not connected (must be left open)
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
@ PT_UNSPECIFIED
unknown electrical properties: creates always a warning when connected
ELECTRICAL_PINTYPE m_Type
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(DefaultProperties)
Declare the test suite.
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I