20#include <boost/test/unit_test.hpp>
46struct PADS_SCH_IMPORT_FIXTURE
48 PADS_SCH_IMPORT_FIXTURE() : m_schematic( nullptr )
50 m_settingsManager.LoadProject(
"" );
51 m_schematic.SetProject( &m_settingsManager.Prj() );
55 ~PADS_SCH_IMPORT_FIXTURE()
60 SETTINGS_MANAGER m_settingsManager;
67BOOST_FIXTURE_TEST_SUITE( PadsSchImport, PADS_SCH_IMPORT_FIXTURE )
74 wxString padsFile = wxString::FromUTF8(
85 wxString kicadFile = wxString::FromUTF8(
95 BOOST_CHECK_NE( pi.get(),
nullptr );
103 wxString padsFile = wxString::FromUTF8(
113 std::vector<SCH_SYMBOL*> u1Symbols;
121 if( sym->
GetRef( &rootPath ) == wxT(
"U1" ) )
122 u1Symbols.push_back( sym );
125 BOOST_REQUIRE_EQUAL( u1Symbols.size(), 2u );
128 std::sort( u1Symbols.begin(), u1Symbols.end(),
131 return a->GetUnit() < b->GetUnit();
143 BOOST_CHECK( u1Symbols[0]->IsMultiUnit() );
159 wxString padsFile = wxString::FromUTF8(
161 +
"/plugins/pads/issue23420_codepage_schematic.txt" );
176 wxString padsFile = wxString::FromUTF8(
187 wxString padsFile = wxString::FromUTF8(
192 BOOST_CHECK_GT( names.GetCount(), 0u );
200 wxString padsFile = wxString::FromUTF8(
203 std::vector<LIB_SYMBOL*> symbols;
205 BOOST_CHECK_GT( symbols.size(), 0u );
216 wxString padsFile = wxString::FromUTF8(
222 BOOST_REQUIRE_GT( names.GetCount(), 0u );
234 wxString padsFile = wxString::FromUTF8(
238 BOOST_CHECK( sym ==
nullptr );
246 wxString padsFile = wxString::FromUTF8(
249 std::vector<LIB_SYMBOL*> symbols;
252 bool foundMultiUnit =
false;
256 if( sym && sym->GetUnitCount() > 1 )
258 foundMultiUnit =
true;
263 BOOST_CHECK( foundMultiUnit );
271 wxString padsFile = wxString::FromUTF8(
287 wxString padsFile = wxString::FromUTF8(
289 +
"/plugins/pads/issue24284_multisheet_text.txt" );
298 std::map<wxString, std::vector<wxString>> textBySheet;
299 std::map<wxString, int> lineCountBySheet;
309 textBySheet[sheetName].push_back( txt->
GetText() );
315 lineCountBySheet[sheetName]++;
319 for(
int sheetNum = 1; sheetNum <= 3; ++sheetNum )
321 wxString sheetName = wxString::Format( wxT(
"Page%d" ), sheetNum );
322 wxString pageText = wxString::Format( wxT(
"PAGE %d OF 3" ), sheetNum );
323 wxString bodyText = wxString::Format( wxT(
"TEXT ON SHEET %d" ), sheetNum );
325 BOOST_REQUIRE_EQUAL( textBySheet.count( sheetName ), 1u );
327 BOOST_CHECK( std::find( textBySheet[sheetName].begin(), textBySheet[sheetName].
end(),
328 pageText ) != textBySheet[sheetName].
end() );
329 BOOST_CHECK( std::find( textBySheet[sheetName].begin(), textBySheet[sheetName].
end(),
330 bodyText ) != textBySheet[sheetName].
end() );
344 wxString padsFile = wxString::FromUTF8(
355 const int cnSideX = 1400 * milToIU;
356 const int r1SideX = 2800 * milToIU;
360 bool foundCn =
false;
361 bool foundR1 =
false;
367 if( lbl->
GetText() != wxT(
"SP1" ) )
399 wxString padsFile = wxString::FromUTF8(
416 if( sym->
GetRef( &rootPath ) == wxT(
"D5" ) )
constexpr EDA_IU_SCALE schIUScale
virtual const wxString & GetText() const
Return the string associated with the text object.
GR_TEXT_H_ALIGN_T GetHorizJustify() const
virtual EDA_ANGLE GetTextAngle() const
GR_TEXT_V_ALIGN_T GetVertJustify() const
EE_TYPE OfType(KICAD_T aType) const
Define a library symbol object.
wxString GetName() const override
VECTOR2I GetPosition() 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,...
SPIN_STYLE GetSpinStyle() const
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
VECTOR2I GetPosition() const override
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
VECTOR2I GetPosition() 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.
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
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")
VECTOR2< int32_t > VECTOR2I