26#include <wx/filename.h>
27#include <wx/stdpaths.h>
47std::vector<std::pair<wxString, wxString>> collectFootprintFpids(
SCHEMATIC& aSchematic )
49 std::vector<std::pair<wxString, wxString>> out;
52 for(
SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
83 wxString sep = wxFileName::GetPathSeparator();
84 wxString dir = wxStandardPaths::Get().GetTempDir() + sep + wxT(
"sch_fpfield_reconcile-qa" );
86 if( wxDirExists( dir ) )
87 wxFileName::Rmdir( dir, wxPATH_RMDIR_RECURSIVE );
89 wxFileName::Mkdir( dir, wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );
91 wxString projectPath = dir + sep + wxT(
"sch_fpfield.kicad_pro" );
97 eagleFn.AppendDir( wxS(
"io" ) );
98 eagleFn.AppendDir( wxS(
"eagle" ) );
99 eagleFn.SetFullName( wxS(
"eagle-import-testfile.sch" ) );
102 std::unique_ptr<SCHEMATIC> schematic = std::make_unique<SCHEMATIC>( &
project );
108 SCH_SHEET* loadedSheet = pi->LoadSchematicFile( eagleFn.GetFullPath(), schematic.get() );
111 std::vector<std::pair<wxString, wxString>> before = collectFootprintFpids( *schematic );
112 BOOST_REQUIRE_GT( before.size(), 0 );
114 const wxString cacheNick = wxS(
"eagle_test-import-fps" );
119 BOOST_CHECK_GT(
result.m_relinkedToCache, 0 );
121 std::vector<std::pair<wxString, wxString>> after = collectFootprintFpids( *schematic );
124 for(
const auto& [nick, item] : after )
126 BOOST_CHECK_MESSAGE( nick == cacheNick,
127 wxString::Format(
"Footprint field '%s:%s' not re-linked to cache",
void LoadProjectTables(std::initializer_list< LIBRARY_TABLE_TYPE > aTablesToLoad={})
(Re)loads the project library tables in the given list, or all tables if no list is given
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
const wxString GetUniStringLibNickname() const
virtual SETTINGS_MANAGER & GetSettingsManager() const
virtual LIBRARY_MANAGER & GetLibraryManager() const
Container for project specific data.
Holds all the data relating to one schematic.
virtual const wxString & GetText() const override
Return the string associated with the text object.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Load a project or sets up a new project with a specified path.
PROJECT & Prj() const
A helper while we are not MDI-capable – return the one and only project.
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
std::string GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
PGM_BASE & Pgm()
The global program "get" accessor.
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
wxString result
Test unit parsing edge cases and error handling.
BOOST_CHECK_EQUAL(result, "25.4")