20#include <boost/test/unit_test.hpp>
39static const
std::
string RootUrl =
"http://fake.test/v1/";
67 return std::make_unique<HTTP_LIB_CONNECTION>(
68 aSource,
true,
server.MakeRetriever() );
87 BOOST_CHECK( names.Index( wxS(
"R_10K" ) ) != wxNOT_FOUND );
88 BOOST_CHECK( names.Index( wxS(
"R_100K" ) ) != wxNOT_FOUND );
89 BOOST_CHECK( names.Index( wxS(
"C_100n" ) ) != wxNOT_FOUND );
102 std::vector<LIB_SYMBOL*> symbols;
105 BOOST_REQUIRE_EQUAL( symbols.size(), 3u );
111 if( symbol->GetName() == wxS(
"R_10K" ) )
117 wxString( wxS(
"Resistor_SMD:R_0603_1608Metric" ) ) );
132 std::vector<wxString> names = { wxS(
"stale" ) };
135 BOOST_REQUIRE_EQUAL( names.size(), 2u );
140 wxString( wxS(
"Resistors" ) ) );
155 wxString( wxS(
"Resistor_SMD:R_0603_1608Metric" ) ) );
185 BOOST_REQUIRE( names.Index( wxS(
"R_10K" ) ) != wxNOT_FOUND );
190 std::this_thread::sleep_for( std::chrono::milliseconds( 1100 ) );
194 wxArrayString namesAgain;
196 BOOST_CHECK( namesAgain.Index( wxS(
"R_10K" ) ) != wxNOT_FOUND );
208 BOOST_REQUIRE( names.Index( wxS(
"R_10K" ) ) != wxNOT_FOUND );
214 { "id": "res-20k", "name": "R_20K", "description": "20 kOhms resistor" },
215 { "id": "res-100k", "name": "R_100K", "description": "100 kOhms resistor" }
222 "description": "20 kOhms resistor",
224 "footprint": { "value": "Resistor_SMD:R_0603_1608Metric", "visible": "False" },
225 "value": { "value": "20k" },
226 "reference": { "value": "R" }
230 std::this_thread::sleep_for( std::chrono::milliseconds( 1100 ) );
238 BOOST_CHECK( harness.
plugin.
LoadSymbol( settingsPath, wxS(
"R_10K" ) ) ==
nullptr );
252 { "id": "res-10k", "name": "R_10K", "description": "Listing description" }
260 "value": { "value": "10k" }
264 std::vector<LIB_SYMBOL*> symbols;
271 if( symbol->GetName() == wxS(
"R_10K" ) )
289 { "id": "res-10k", "name": "R_10K" }
297 "value": { "value": "10k" },
298 "description": { "value": "Field description", "visible": "False" }
302 std::vector<LIB_SYMBOL*> symbols;
309 if( symbol->GetName() == wxS(
"R_10K" ) )
In-process HTTP library server used by QA tests.
int RequestCount(const std::string &aUrl) const
Number of times aUrl has been requested.
void SetResponse(const std::string &aUrl, RESPONSE aResponse)
Replace the response served for an exact URL.
Define a library symbol object.
wxString GetDescription() const override
SCH_FIELD & GetFootprintField()
Return reference to the footprint field.
SCH_FIELD & GetValueField()
Return reference to the value field.
virtual const wxString & GetText() const override
Return the string associated with the text object.
A KiCad HTTP library provides both symbol and footprint metadata, so there are "shim" plugins on both...
LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aAliasName, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this...
void SetSourcePatcher(SOURCE_PATCHER aOverride)
Allows updating a source after initial load; used for QA testing.
wxString GetSubLibraryDescription(const wxString &aName) override
Gets a description of a sublibrary.
int GetModifyHash() const override
Return the modification hash from the library cache.
void CheckLibrary(const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Validate that the library at aLibraryPath is reachable and well-formed, without necessarily loading s...
void EnumerateSymbolLib(wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
void GetSubLibraryNames(std::vector< wxString > &aNames) override
Retrieves a list of sub-libraries in this library.
An interface to the global shared library manager that is schematic-specific and linked to one projec...
std::string GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
Connection parameters for one HTTP library.
SYMBOL_LIBRARY_ADAPTER adapter
HTTP_LIB_FAKE_SERVER server
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
static const std::string RootUrl
BOOST_AUTO_TEST_CASE(EnumerateSymbolLibListsAllParts)
static const std::string SettingsFile
static void useFastCacheLifetimes(SCH_IO_HTTP_LIB &aPlugin)
static wxString httpLibSettingsPath()
static const std::string RootUrl
BOOST_CHECK_EQUAL(result, "25.4")