40LIB_ID makeFp(
const wxString& aLibNick,
const wxString& aName )
44 id.SetLibItemName( aName );
52 pin->SetNumber( aNumber );
64 m_dfn = makeFp( wxS(
"Package_DFN_QFN" ), wxS(
"DFN-8-1EP" ) );
66 m_lib = std::make_unique<LIB_SYMBOL>( wxS(
"LM358" ),
nullptr );
67 addPin( *
m_lib, wxS(
"1" ) );
68 addPin( *
m_lib, wxS(
"4" ) );
69 addPin( *
m_lib, wxS(
"8" ) );
70 addPin( *
m_lib, wxS(
"[2,3]" ) );
71 addPin( *
m_lib, wxS(
"[20,21]" ) );
73 PIN_MAP map( wxS(
"DFN-8-EP" ) );
74 map.
SetEntry( wxS(
"4" ), wxS(
"[4,9]" ) );
75 m_lib->PinMaps().AddOrReplace( map );
76 m_lib->SetAssociatedFootprints( { {
m_dfn, wxS(
"DFN-8-EP" ) } } );
86 std::unique_ptr<LIB_SYMBOL>
m_lib;
97 std::set<wxString> dfnPads = { wxS(
"1" ), wxS(
"2" ), wxS(
"3" ), wxS(
"4" ),
98 wxS(
"5" ), wxS(
"6" ), wxS(
"7" ), wxS(
"9" ) };
106 BOOST_CHECK( state == PAD_RESOLUTION::MAPPED );
112 BOOST_CHECK( state == PAD_RESOLUTION::IDENTITY );
115 BOOST_CHECK(
pin( wxS(
"8" ) )->GetEffectivePadNumber( m_sheet, wxEmptyString, m_dfn, &dfnPads,
116 &state ).IsEmpty() );
117 BOOST_CHECK( state == PAD_RESOLUTION::UNMAPPED );
123 std::set<wxString> dfnPads = { wxS(
"1" ), wxS(
"2" ), wxS(
"3" ), wxS(
"4" ),
124 wxS(
"5" ), wxS(
"6" ), wxS(
"7" ), wxS(
"9" ) };
129 BOOST_CHECK_EQUAL(
pin( wxS(
"[2,3]" ) )->GetEffectivePadNumber( m_sheet, wxEmptyString, m_dfn, &dfnPads, &state ),
131 BOOST_CHECK( state == PAD_RESOLUTION::IDENTITY );
134 BOOST_CHECK(
pin( wxS(
"[20,21]" ) )
135 ->GetEffectivePadNumber( m_sheet, wxEmptyString, m_dfn, &dfnPads, &state )
137 BOOST_CHECK( state == PAD_RESOLUTION::UNMAPPED );
149 BOOST_CHECK( state == PAD_RESOLUTION::MAPPED );
155 BOOST_CHECK( state == PAD_RESOLUTION::IDENTITY );
166 m_symbol->SetPinMapOverride( forceIdentity );
168 std::set<wxString> pads = { wxS(
"4" ) };
172 BOOST_CHECK( state == PAD_RESOLUTION::IDENTITY );
175 forceIdentity.
m_Edits.push_back( { wxS(
"4" ), wxS(
"99" ) } );
176 m_symbol->SetPinMapOverride( forceIdentity );
180 BOOST_CHECK( state == PAD_RESOLUTION::IDENTITY );
185 edited.
m_Edits.push_back( { wxS(
"4" ), wxS(
"99" ) } );
186 m_symbol->SetPinMapOverride( edited );
191 BOOST_CHECK( state == PAD_RESOLUTION::MAPPED );
200 m_lib->PinMaps().AddOrReplace(
PIN_MAP( wxS(
"SWAP" ) ) );
201 m_lib->PinMaps().FindByName( wxS(
"SWAP" ) )->SetEntry( wxS(
"1" ), wxS(
"8" ) );
204 m_symbol = std::make_unique<SCH_SYMBOL>( *m_lib, m_lib->GetLibId(),
nullptr, 0, 0,
206 m_symbol->UpdatePins();
211 m_symbol->SetPinMapOverride( named );
216 BOOST_CHECK( state == PAD_RESOLUTION::MAPPED );
237 PIN_MAP edited( wxS(
"EDITED" ) );
238 edited.
SetEntry( wxS(
"1" ), wxS(
"X1" ) );
263 m_symbol->SetPinMapOverride( named );
266 BOOST_CHECK(
copy.GetPinMapOverride() == named );
269 assigned = *m_symbol;
A logical library item identifier and consists of various portions much like a URI.
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
Define a library symbol object.
void SetAssociatedFootprints(std::vector< ASSOCIATED_FOOTPRINT > aList)
const PIN_MAP_SET & GetPinMaps() const
Pin-to-pad mapping (issue #2282).
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
const std::vector< ASSOCIATED_FOOTPRINT > & GetAssociatedFootprints() const
void AddOrReplace(PIN_MAP aMap)
Insert aMap, replacing any existing entry with the same name.
void SetEntry(const wxString &aPinNumber, const wxString &aPadNumber)
Set the pad number for a symbol pin.
Holds all the data relating to one schematic.
void SyncLibSymbolPinMaps(const wxString &aSchLibSymbolName, const LIB_SYMBOL &aSource, SCH_COMMIT *aCommit)
void SetTopLevelSheets(const std::vector< SCH_SHEET * > &aSheets)
Replace the top level sheets, rebuilding the hierarchy and connectivity around them.
PAD_RESOLUTION
Outcome of pin-to-pad resolution (issue #2282).
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
const std::map< wxString, LIB_SYMBOL * > & GetLibSymbols() const
Fetch a list of unique LIB_SYMBOL object pointers required to properly render each SCH_SYMBOL in this...
const KIID & GetUuid() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
wxString GetSchSymbolLibraryName() const
PIN_MAP_INSTANCE_OVERRIDE GetPinMapOverride(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
@ PT_PASSIVE
pin for passive symbols: must be connected, and can be connected to any pin.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
Per-instance override of the active pin map and a sparse delta on top.
std::vector< PIN_MAP_ENTRY > m_Edits
PIN_MAP_OVERRIDE_MODE m_Mode
std::unique_ptr< SCH_SYMBOL > m_symbol
std::unique_ptr< LIB_SYMBOL > m_lib
PIN_MAP_RESOLVER_FIXTURE()
SCH_PIN * pin(const wxString &aNumber) const
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(ThreeResolutionStates)
SCH_PIN::PAD_RESOLUTION PAD_RESOLUTION
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I