88 BOOST_CHECK( ( m_sch_pin->GetType() == m_lib_pin->GetType() ) );
117 alt.
m_Name = wxS(
"alt" );
120 copied.GetAlternates()[ wxS(
"alt" ) ] = alt;
138 m_sch_pin->SetIsDangling(
false );
142 m_sch_pin->SetIsDangling(
true );
153 const wxString
name = m_sch_pin->GetDefaultNetName(
path );
158 const wxString map_name = m_sch_pin->GetDefaultNetName(
path );
169 m_parent_part->SetGlobalPower();
174 delete m_parent_symbol;
175 m_parent_symbol =
new SCH_SYMBOL( *m_parent_part, m_parent_part->GetLibId(), &
path, 0, 0,
177 m_parent_symbol->SetRef( &
path,
"U2" );
178 m_parent_symbol->SetValueFieldText(
"voltage_value" );
179 m_parent_symbol->UpdatePins();
181 m_sch_pin = m_parent_symbol->GetPins( &
path )[0];
184 const wxString pwr_name = m_sch_pin->GetDefaultNetName(
path );
191 alt.
m_Name = wxS(
"ALT1" );
194 m_lib_pin->GetAlternates()[ wxS(
"ALT1" ) ] = alt;
196 m_parent_symbol->SetLibSymbol( m_parent_part->Flatten().release() );
197 m_sch_pin = m_parent_symbol->GetPins()[0];
198 m_sch_pin->SetAlt( wxS(
"ALT1" ) );
201 m_lib_pin->GetAlternates().erase( wxS(
"ALT1" ) );
202 altNew.
m_Name = wxS(
"ALT1_NEW" );
203 m_lib_pin->GetAlternates()[ wxS(
"ALT1_NEW" ) ] = altNew;
205 m_parent_symbol->SetLibSymbol( m_parent_part->Flatten().release() );
207 SCH_PIN* updatedPin = m_parent_symbol->GetPins()[0];
210 BOOST_CHECK( updatedPin->
GetAlternates().count( wxS(
"ALT1" ) ) == 0 );
224 powerAlt.
m_Name = wxS(
"8.pow" );
227 m_lib_pin->GetAlternates()[ wxS(
"8.pow" ) ] = powerAlt;
230 m_parent_symbol->SetLibSymbol( m_parent_part->Flatten().release() );
231 m_sch_pin = m_parent_symbol->GetPins()[0];
237 m_sch_pin->SetAlt( wxS(
"8.pow" ) );
260 powerAlt.
m_Name = wxS(
"8.pow" );
263 m_lib_pin->GetAlternates()[ wxS(
"8.pow" ) ] = powerAlt;
266 m_parent_symbol->SetLibSymbol( m_parent_part->Flatten().release() );
267 m_sch_pin = m_parent_symbol->GetPins()[0];
270 m_sch_pin->SetAlt( wxS(
"8.pow" ) );
276 m_parent_symbol->SetLibSymbol( m_parent_part->Flatten().release() );
277 m_sch_pin = m_parent_symbol->GetPins()[0];
305 powerAlt.
m_Name = wxS(
"8.pow" );
322 std::make_unique<SCH_PIN>( symbol, wxS(
"8" ), wxS(
"8.pow" ),
KIID() ) );
328 BOOST_CHECK( parserPin->
GetLibPin() ==
nullptr );
341 if( !libPins.empty() )
343 SCH_PIN* flattenedLibPin = libPins[0];
345 BOOST_CHECK( flattenedLibPin->
GetAlternates().count( wxS(
"8.pow" ) ) > 0 );
355 BOOST_CHECK( updatedPin->
GetLibPin() !=
nullptr );
383 powerAlt.
m_Name = wxS(
"8.pow" );
392 BOOST_CHECK( origLibPin->
GetAlternates().count( wxS(
"8.pow" ) ) > 0 );
400 std::vector<SCH_PIN*> copiedLibPins = copiedLibSymbol->
GetGraphicalPins( 0, 0 );
403 if( !copiedLibPins.empty() )
405 SCH_PIN* copiedLibPin = copiedLibPins[0];
409 "Copied library pin should have alternates" );
411 "Copied library pin should have '8.pow' alternate" );
414 if( copiedLibPin->
GetAlternates().count( wxS(
"8.pow" ) ) > 0 )
416 BOOST_CHECK( copiedLibPin->
GetAlternates().at( wxS(
"8.pow" ) ).m_Type
430 std::make_unique<SCH_PIN>( symbol, wxS(
"8" ), wxS(
"8.pow" ),
KIID() ) );
435 BOOST_CHECK( rawPin->
GetLibPin() ==
nullptr );
441 std::vector<SCH_PIN*> schPins = symbol->
GetPins( &
path );
444 if( !schPins.empty() )
450 "Schematic pin should have m_libPin set after UpdatePins" );
454 "Alternate should be preserved as '8.pow'" );
458 "GetType() should return alternate's type (PT_POWER_IN)" );
464 "Library pin pointed to by schematic pin should have alternates" );
466 "Library pin should have '8.pow' in its alternates map" );
471 delete origLibSymbol;
493 powerAlt.
m_Name = wxS(
"8.pow" );
505 std::make_unique<SCH_PIN>( symbol, wxS(
"8" ), wxS(
"8.pow" ),
KIID() ) );
511 BOOST_CHECK( rawPin->
GetLibPin() ==
nullptr );
516 "GetType() with m_alt set but m_libPin=nullptr should return PT_UNSPECIFIED" );
525 std::vector<SCH_PIN*> schPins = symbol->
GetPins( &
path );
528 if( !schPins.empty() )
532 BOOST_CHECK( schPin->
GetLibPin() !=
nullptr );
534 "After SetLibSymbol, GetType() should return PT_POWER_IN" );
551 pin1->SetNumber(
"1" );
552 pin1->SetName(
"PIN1" );
565 pin3->SetNumber(
"3" );
566 pin3->SetName(
"PIN3" );
584 newPin1->
SetName(
"NEW_PIN1" );
600 BOOST_CHECK( schPin !=
nullptr );
609 delete singlePinPart;
660 "HasConnectivityChanges should detect visibility change for power input pins" );
663 "HasConnectivityChanges should detect visibility change for power input pins (reverse)" );
685 "HasConnectivityChanges should NOT detect visibility change for regular input pins" );
730 "HasConnectivityChanges should detect change from INPUT to POWER_IN" );
733 "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_CHECK_MESSAGE(totalMismatches==0, std::to_string(totalMismatches)+" board(s) with strategy disagreements")
BOOST_AUTO_TEST_CASE(DefaultProperties)
Declare the test suite.
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I