20#include <boost/test/unit_test.hpp>
29#include <wx/tokenzr.h>
64 const wxString& aKeywords,
const wxString& aDesc ) :
83 wxStringTokenizer tokenizer(
m_keywords, wxT(
" \t\r\n" ), wxTOKEN_STRTOK );
85 while( tokenizer.HasMoreTokens() )
144 TEST_LIB_TREE_ITEM r( wxT(
"Device" ), wxT(
"R" ), wxT(
"R res resistor" ), wxT(
"Resistor" ) );
145 TEST_LIB_TREE_ITEM l( wxT(
"Device" ), wxT(
"L" ), wxT(
"inductor choke coil reactor magnetic" ),
147 TEST_LIB_TREE_ITEM c( wxT(
"Device" ), wxT(
"C" ), wxT(
"cap capacitor" ), wxT(
"Unpolarized capacitor" ) );
156 TEST_LIB_TREE_ITEM digiPot( wxT(
"Potentiometer_Digital" ), wxT(
"AD5293" ), wxT(
"R POT" ),
157 wxT(
"Digital potentiometer 1024 pos (SPI), TSSOP-14" ) );
167 wxT(
"USB Type C PD Sink Converter Controller CMOS Clock capacitor "
169 wxT(
"USB Type-C PD Sink Controller, QFN-24" ) );
173 TEST_LIB_TREE_ITEM dFlipFlop( wxT(
"74xGxx" ), wxT(
"74AUC1G74" ), wxT(
"Single D Flip-Flop D CMOS" ),
174 wxT(
"Single D Flip-Flop, Low-Voltage CMOS" ) );
175 logicLib.
AddItem( &dFlipFlop );
181 for( std::unique_ptr<LIB_TREE_NODE>& lib : root.
m_Children )
182 lib->AssignIntrinsicRanks( {} );
184 for(
const wxString& letter : { wxString( wxT(
"r" ) ), wxString( wxT(
"l" ) ),
185 wxString( wxT(
"c" ) ), wxString( wxT(
"d" ) ) } )
187 std::vector<std::unique_ptr<EDA_COMBINED_MATCHER>> matchers;
188 matchers.emplace_back( std::make_unique<EDA_COMBINED_MATCHER>( letter,
CTX_LIBITEM ) );
A logical library item identifier and consists of various portions much like a URI.
A mix-in to provide polymorphism between items stored in libraries (symbols, aliases and footprints).
LIB_TREE_MODEL_ADAPTER(EDA_BASE_FRAME *aParent, const wxString &aPinnedKey, APP_SETTINGS_BASE::LIB_TREE &aSettingsStruct)
Create the adapter.
std::map< wxString, int > m_colWidths
LIB_TREE_NODE_ITEM & AddItem(LIB_TREE_ITEM *aItem)
Construct a new alias node, add it to this library, and return it.
LIB_TREE_NODE_LIBRARY & AddLib(wxString const &aName, wxString const &aDesc)
Construct an empty library node, add it to the root, and return it.
void UpdateScore(const std::vector< std::unique_ptr< EDA_COMBINED_MATCHER > > &aMatchers, std::function< bool(LIB_TREE_NODE &aNode)> *aFilter) override
Update the score for this part.
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
void SortNodes(bool aUseScores)
Sort child nodes quickly and recursively (IntrinsicRanks must have been set).
void AssignIntrinsicRanks(const std::vector< wxString > &aShownColumns, bool presorted=false)
Store intrinsic ranks on all children of this node.
Stands in for LIB_SYMBOL, reproducing LIB_SYMBOL::cacheSearchTerms() term-for-term so the test exerci...
wxString GetName() const override
LIB_ID GetLIB_ID() const override
TEST_LIB_TREE_ITEM(const wxString &aLibNickname, const wxString &aName, const wxString &aKeywords, const wxString &aDesc)
wxString GetDesc() override
wxString GetLibNickname() const override
std::vector< SEARCH_TERM > & GetSearchTerms() override
std::vector< SEARCH_TERM > m_searchTerms
Minimal concrete adapter exposing the loaded column widths.
PROJECT::LIB_TYPE_T getLibType() override
TEST_LIB_TREE_MODEL_ADAPTER(APP_SETTINGS_BASE::LIB_TREE &aSettings)
int LoadedWidth(const wxString &aColumn) const
Abstract pattern-matching tool and implementations.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
std::map< wxString, int > column_widths
Column widths, keyed by header name.
A structure for storing weighted search terms.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(CorruptPersistedColumnWidthIgnoredOnLoad)
A persisted column width can become corrupt after a mixed-DPI monitor change (issue 24702 reported wi...
BOOST_TEST_CONTEXT("Test Clearance")
BOOST_CHECK_EQUAL(result, "25.4")