20#include <boost/test/unit_test.hpp>
43struct PADS_SCH_IMPORT_FIXTURE
45 PADS_SCH_IMPORT_FIXTURE() : m_schematic( nullptr )
47 m_settingsManager.LoadProject(
"" );
48 m_schematic.SetProject( &m_settingsManager.Prj() );
52 ~PADS_SCH_IMPORT_FIXTURE()
57 SETTINGS_MANAGER m_settingsManager;
64BOOST_FIXTURE_TEST_SUITE( PadsSchImport, PADS_SCH_IMPORT_FIXTURE )
71 wxString padsFile = wxString::FromUTF8(
82 wxString kicadFile = wxString::FromUTF8(
92 BOOST_CHECK_NE( pi.get(),
nullptr );
100 wxString padsFile = wxString::FromUTF8(
110 std::vector<SCH_SYMBOL*> u1Symbols;
118 if( sym->
GetRef( &rootPath ) == wxT(
"U1" ) )
119 u1Symbols.push_back( sym );
122 BOOST_REQUIRE_EQUAL( u1Symbols.size(), 2u );
125 std::sort( u1Symbols.begin(), u1Symbols.end(),
128 return a->GetUnit() < b->GetUnit();
140 BOOST_CHECK( u1Symbols[0]->IsMultiUnit() );
156 wxString padsFile = wxString::FromUTF8(
158 +
"/plugins/pads/issue23420_codepage_schematic.txt" );
173 wxString padsFile = wxString::FromUTF8(
184 wxString padsFile = wxString::FromUTF8(
189 BOOST_CHECK_GT( names.GetCount(), 0u );
197 wxString padsFile = wxString::FromUTF8(
200 std::vector<LIB_SYMBOL*> symbols;
202 BOOST_CHECK_GT( symbols.size(), 0u );
213 wxString padsFile = wxString::FromUTF8(
219 BOOST_REQUIRE_GT( names.GetCount(), 0u );
231 wxString padsFile = wxString::FromUTF8(
235 BOOST_CHECK( sym ==
nullptr );
243 wxString padsFile = wxString::FromUTF8(
246 std::vector<LIB_SYMBOL*> symbols;
249 bool foundMultiUnit =
false;
253 if( sym && sym->GetUnitCount() > 1 )
255 foundMultiUnit =
true;
260 BOOST_CHECK( foundMultiUnit );
268 wxString padsFile = wxString::FromUTF8(
284 wxString padsFile = wxString::FromUTF8(
286 +
"/plugins/pads/issue24284_multisheet_text.txt" );
295 std::map<wxString, std::vector<wxString>> textBySheet;
296 std::map<wxString, int> lineCountBySheet;
306 textBySheet[sheetName].push_back( txt->
GetText() );
312 lineCountBySheet[sheetName]++;
316 for(
int sheetNum = 1; sheetNum <= 3; ++sheetNum )
318 wxString sheetName = wxString::Format( wxT(
"Page%d" ), sheetNum );
319 wxString pageText = wxString::Format( wxT(
"PAGE %d OF 3" ), sheetNum );
320 wxString bodyText = wxString::Format( wxT(
"TEXT ON SHEET %d" ), sheetNum );
322 BOOST_REQUIRE_EQUAL( textBySheet.count( sheetName ), 1u );
324 BOOST_CHECK( std::find( textBySheet[sheetName].begin(), textBySheet[sheetName].
end(),
325 pageText ) != textBySheet[sheetName].
end() );
326 BOOST_CHECK( std::find( textBySheet[sheetName].begin(), textBySheet[sheetName].
end(),
327 bodyText ) != textBySheet[sheetName].
end() );
virtual const wxString & GetText() const
Return the string associated with the text object.
EE_TYPE OfType(KICAD_T aType) const
Define a library symbol object.
wxString GetName() const override
virtual const wxString & GetText() const override
Return the string associated with the text object.
A SCH_IO derivation for loading PADS Logic schematic files.
LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aPartName, 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 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.
bool CanReadLibrary(const wxString &aFileName) const override
Checks if this IO object can read the specified library file/directory.
bool IsLibraryWritable(const wxString &aLibraryPath) override
Return true if the library at aLibraryPath is writable.
bool CanReadSchematicFile(const wxString &aFileName) const override
Checks if this SCH_IO can read the specified schematic file.
SCH_SHEET * LoadSchematicFile(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load information from some input file format that this SCH_IO implementation knows about,...
Base class for any item which can be embedded within the SCHEMATIC container class,...
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
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 sheet.
SCH_SCREEN * GetScreen() const
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
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.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(CanReadSchematicFile)
BOOST_CHECK_EQUAL(result, "25.4")