40#include <wx/filename.h>
65 +
"plugins/eagle/Adafruit-AHT20-PCB/"
66 "Adafruit AHT20 Temperature & Humidity.brd";
68 BOOST_REQUIRE_MESSAGE( wxFileName::FileExists( dataPath ),
69 "Test board file not found: " + dataPath );
72 std::unique_ptr<BOARD> board;
76 board = eaglePlugin.
LoadBoard( dataPath );
80 BOOST_FAIL(
"IO_ERROR loading Eagle board: " + e.
What().ToStdString() );
82 catch(
const std::exception& e )
84 BOOST_FAIL( std::string(
"Exception loading Eagle board: " ) + e.
what() );
90 std::map<wxString, int> viasPerNet;
100 viasPerNet[netName]++;
105 BOOST_CHECK_GT( viasPerNet[wxT(
"SDA" )], 0 );
106 BOOST_CHECK_GT( viasPerNet[wxT(
"SCL" )], 0 );
107 BOOST_CHECK_GT( viasPerNet[wxT(
"GND" )], 0 );
108 BOOST_CHECK_GT( viasPerNet[wxT(
"VCC" )], 0 );
109 BOOST_CHECK_GT( viasPerNet[wxT(
"VDD" )], 0 );
139 +
"plugins/eagle/test_eagle_23016/test_eagle.brd";
141 BOOST_REQUIRE_MESSAGE( wxFileName::FileExists( dataPath ),
142 "Test board file not found: " + dataPath );
145 std::unique_ptr<BOARD> board;
149 board = eaglePlugin.
LoadBoard( dataPath );
153 BOOST_FAIL(
"IO_ERROR loading Eagle board: " + e.
What().ToStdString() );
155 catch(
const std::exception& e )
157 BOOST_FAIL( std::string(
"Exception loading Eagle board: " ) + e.
what() );
170 for(
FOOTPRINT* fp : board->Footprints() )
172 wxString ref = fp->GetReference();
174 if( ref == wxT(
"I2C0" ) || ref == wxT(
"I2C1" ) )
176 PCB_TEXT& refText = fp->Reference();
180 ref +
" reference horizontal justification should be LEFT, got "
185 ref +
" reference vertical justification should be BOTTOM, got "
193 int topPinLabelCount = 0;
202 if(
text->GetText() != wxT(
"G SDA SCL V+" ) )
212 "Pin label text horizontal justification should be LEFT" );
216 "Pin label text vertical justification should be BOTTOM" );
220 "Pin label text angle should be 90 degrees" );
242 +
"plugins/eagle/lbr/user-layers-test.lbr";
244 BOOST_REQUIRE_MESSAGE( wxFileName::FileExists( dataPath ),
245 "Test library file not found: " + dataPath );
249 std::unique_ptr<FOOTPRINT> fp;
253 fp = eaglePlugin.
FootprintLoad( dataPath, wxT(
"USER_LAYERS_TEST" ),
false,
nullptr );
257 BOOST_FAIL(
"IO_ERROR loading Eagle footprint: " + e.
What().ToStdString() );
259 catch(
const std::exception& e )
261 BOOST_FAIL( std::string(
"Exception loading Eagle footprint: " ) + e.
what() );
272 const char* description;
277 std::vector<LAYER_CHECK> checks = {
278 { -5000000,
Eco1_User,
"Eagle 160 -> Eco1.User" },
279 { -7000000,
Eco2_User,
"Eagle 161 -> Eco2.User" },
280 { -9000000,
Dwgs_User,
"Eagle 162 -> Dwgs.User" },
281 { -11000000,
Margin,
"Eagle 163 -> Margin" },
282 { -13000000,
User_1,
"Eagle 170 -> User.1" },
283 { -15000000,
User_2,
"Eagle 171 -> User.2" },
284 { -17000000,
User_3,
"Eagle 172 -> User.3" },
285 { -19000000,
User_4,
"Eagle 173 -> User.4" },
286 { -21000000,
User_5,
"Eagle 174 -> User.5" },
287 { -23000000,
User_6,
"Eagle 175 -> User.6" },
288 { -25000000,
User_7,
"Eagle 176 -> User.7" },
289 { -27000000,
User_8,
"Eagle 177 -> User.8" },
290 { -29000000,
User_9,
"Eagle 178 -> User.9" },
296 std::map<int, PCB_LAYER_ID> linesByY;
298 for(
BOARD_ITEM* item : fp->GraphicalItems() )
311 BOOST_CHECK_MESSAGE( linesByY.emplace( yMid, shape->
GetLayer() ).second,
312 "Duplicate segment at y=" + std::to_string( yMid ) +
"nm" );
317 for(
const LAYER_CHECK& check : checks )
319 auto it = linesByY.find( check.yOffsetNm );
321 BOOST_CHECK_MESSAGE( it != linesByY.end(),
322 std::string( check.description )
323 +
" - no line found at y=" + std::to_string( check.yOffsetNm )
326 if( it != linesByY.end() )
328 BOOST_CHECK_MESSAGE( it->second == check.expectedLayer,
329 std::string( check.description )
330 +
" - expected layer " + std::to_string( check.expectedLayer )
331 +
" but got " + std::to_string( it->second ) );
General utilities for PCB file IO for QA programs.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
GR_TEXT_H_ALIGN_T GetHorizJustify() const
GR_TEXT_V_ALIGN_T GetVertJustify() const
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
virtual const char * what() const override
std::exception interface, returned as UTF-8
Handle the data for a net.
const wxString & GetNetname() const
Works with Eagle 6.x XML board files and footprints to implement the Pcbnew #PLUGIN API or a portion ...
std::unique_ptr< FOOTPRINT > FootprintLoad(const wxString &aLibraryPath, const wxString &aFootprintName, bool aKeepUUID=false, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load a footprint having aFootprintName from the aLibraryPath containing a library format that this PC...
std::unique_ptr< BOARD > LoadBoard(const wxString &aFileName, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr)
Load information from some input file format that this PCB_IO implementation knows about into new BOA...
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
PCB_LAYER_ID
A quick note on layer IDs:
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
EAGLE_BOARD_IMPORT_FIXTURE()
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(ViaNetAssignment)
Verify that vias imported from an Eagle board are assigned to the correct nets.
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_TEXT_T
class PCB_TEXT, text on a layer