34LIB_ID makeFp(
const wxString& aLibNick,
const wxString& aName )
38 id.SetLibItemName( aName );
55 std::string
text = format( aSymbol );
58 BOOST_REQUIRE_EQUAL( loaded.size(), 1u );
59 return std::unique_ptr<LIB_SYMBOL>( loaded.front() );
73 for(
int i = 1; i <= 8; ++i )
74 std8.
SetEntry( wxString::Format( wxS(
"%d" ), i ), wxString::Format( wxS(
"%d" ), i ) );
76 PIN_MAP dfn( wxS(
"DFN-8-EP" ) );
77 dfn.
SetEntry( wxS(
"4" ), wxS(
"[4,9]" ) );
84 { makeFp( wxS(
"Package_SO" ), wxS(
"SOIC-8" ) ), wxS(
"STD-8" ) },
85 { makeFp( wxS(
"Package_DFN_QFN" ), wxS(
"DFN-8-1EP" ) ), wxS(
"DFN-8-EP" ) },
86 { makeFp( wxS(
"Package_SO" ), wxS(
"VSSOP-8" ) ), wxS(
"STD-8" ) },
89 std::unique_ptr<LIB_SYMBOL> reloaded =
roundTrip( sym );
91 BOOST_CHECK( reloaded->GetPinMaps() == sym.
GetPinMaps() );
95 const PIN_MAP* reDfn = reloaded->GetPinMaps().FindByName( wxS(
"DFN-8-EP" ) );
100 BOOST_CHECK_EQUAL( reloaded->GetAssociatedFootprints()[0].m_MapName, wxS(
"STD-8" ) );
101 BOOST_CHECK_EQUAL( reloaded->GetAssociatedFootprints()[2].m_MapName, wxS(
"STD-8" ) );
109 std::string
text = format( sym );
111 BOOST_CHECK(
text.find(
"pin_maps" ) == std::string::npos );
112 BOOST_CHECK(
text.find(
"associated_footprints" ) == std::string::npos );
126 std::string inheritedText = format( inheritor );
127 BOOST_CHECK( inheritedText.find(
"pin_maps" ) == std::string::npos );
128 BOOST_CHECK( inheritedText.find(
"associated_footprints" ) == std::string::npos );
135 std::string ownText = format( overrider );
136 BOOST_CHECK( ownText.find(
"CHILD-MAP" ) != std::string::npos );
137 BOOST_CHECK( ownText.find(
"ROOT-MAP" ) == std::string::npos );
144 std::string bad =
"(symbol \"Bad\" (pin_maps (pin_map \"M\" (entry \"1\"))))";
155 "(kicad_symbol_lib (version 99999999) (generator \"test\") (generator_version \"1\"))";
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
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)
void SetParent(LIB_SYMBOL *aParent=nullptr)
const PIN_MAP_SET & GetPinMaps() const
Pin-to-pad mapping (issue #2282).
const std::vector< ASSOCIATED_FOOTPRINT > & GetAssociatedFootprints() const
void AddOrReplace(PIN_MAP aMap)
Insert aMap, replacing any existing entry with the same name.
const wxString & GetPadNumber(const wxString &aPinNumber) const
void SetEntry(const wxString &aPinNumber, const wxString &aPadNumber)
Set the pad number for a symbol pin.
Object to parser s-expression symbol library and schematic file formats.
void ParseLib(LIB_SYMBOL_MAP &aSymbolLibMap)
static void FormatLibSymbol(LIB_SYMBOL *aPart, OUTPUTFORMATTER &aFormatter)
static std::vector< LIB_SYMBOL * > ParseLibSymbols(std::string &aSymbolText, std::string aSource, int aFileVersion=SEXPR_SCHEMATIC_FILE_VERSION)
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
std::map< wxString, LIB_SYMBOL *, LibSymbolMapSort > LIB_SYMBOL_MAP
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
static void roundTrip(const DIFF_VALUE &aValue)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(RootSymbolWithStackedAndSharedMaps)
BOOST_CHECK_EQUAL(result, "25.4")