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 BOARD* rawBoard =
nullptr;
76 rawBoard = eaglePlugin.
LoadBoard( dataPath,
nullptr,
nullptr );
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() );
87 std::unique_ptr<BOARD> board( rawBoard );
92 std::map<wxString, int> viasPerNet;
102 viasPerNet[netName]++;
107 BOOST_CHECK_GT( viasPerNet[wxT(
"SDA" )], 0 );
108 BOOST_CHECK_GT( viasPerNet[wxT(
"SCL" )], 0 );
109 BOOST_CHECK_GT( viasPerNet[wxT(
"GND" )], 0 );
110 BOOST_CHECK_GT( viasPerNet[wxT(
"VCC" )], 0 );
111 BOOST_CHECK_GT( viasPerNet[wxT(
"VDD" )], 0 );
141 +
"plugins/eagle/test_eagle_23016/test_eagle.brd";
143 BOOST_REQUIRE_MESSAGE( wxFileName::FileExists( dataPath ),
144 "Test board file not found: " + dataPath );
147 BOARD* rawBoard =
nullptr;
151 rawBoard = eaglePlugin.
LoadBoard( dataPath,
nullptr,
nullptr );
155 BOOST_FAIL(
"IO_ERROR loading Eagle board: " + e.
What().ToStdString() );
157 catch(
const std::exception& e )
159 BOOST_FAIL( std::string(
"Exception loading Eagle board: " ) + e.
what() );
162 std::unique_ptr<BOARD> board( rawBoard );
175 for(
FOOTPRINT* fp : board->Footprints() )
177 wxString ref = fp->GetReference();
179 if( ref == wxT(
"I2C0" ) || ref == wxT(
"I2C1" ) )
181 PCB_TEXT& refText = fp->Reference();
185 ref +
" reference horizontal justification should be RIGHT, got "
190 ref +
" reference vertical justification should be TOP, got "
198 int topPinLabelCount = 0;
207 if(
text->GetText() != wxT(
"G SDA SCL V+" ) )
217 "Pin label text horizontal justification should be LEFT" );
221 "Pin label text vertical justification should be BOTTOM" );
225 "Pin label text angle should be 90 degrees" );
247 +
"plugins/eagle/lbr/user-layers-test.lbr";
249 BOOST_REQUIRE_MESSAGE( wxFileName::FileExists( dataPath ),
250 "Test library file not found: " + dataPath );
258 fp = eaglePlugin.
FootprintLoad( dataPath, wxT(
"USER_LAYERS_TEST" ),
false,
nullptr );
262 BOOST_FAIL(
"IO_ERROR loading Eagle footprint: " + e.
What().ToStdString() );
264 catch(
const std::exception& e )
266 BOOST_FAIL( std::string(
"Exception loading Eagle footprint: " ) + e.
what() );
269 std::unique_ptr<FOOTPRINT> guard( fp );
279 const char* description;
284 std::vector<LAYER_CHECK> checks = {
285 { -5000000,
Eco1_User,
"Eagle 160 -> Eco1.User" },
286 { -7000000,
Eco2_User,
"Eagle 161 -> Eco2.User" },
287 { -9000000,
Dwgs_User,
"Eagle 162 -> Dwgs.User" },
288 { -11000000,
Margin,
"Eagle 163 -> Margin" },
289 { -13000000,
User_1,
"Eagle 170 -> User.1" },
290 { -15000000,
User_2,
"Eagle 171 -> User.2" },
291 { -17000000,
User_3,
"Eagle 172 -> User.3" },
292 { -19000000,
User_4,
"Eagle 173 -> User.4" },
293 { -21000000,
User_5,
"Eagle 174 -> User.5" },
294 { -23000000,
User_6,
"Eagle 175 -> User.6" },
295 { -25000000,
User_7,
"Eagle 176 -> User.7" },
296 { -27000000,
User_8,
"Eagle 177 -> User.8" },
297 { -29000000,
User_9,
"Eagle 178 -> User.9" },
303 std::map<int, PCB_LAYER_ID> linesByY;
319 "Duplicate segment at y=" + std::to_string( yMid ) +
"nm" );
324 for(
const LAYER_CHECK& check : checks )
326 auto it = linesByY.find( check.yOffsetNm );
329 std::string( check.description )
330 +
" - no line found at y=" + std::to_string( check.yOffsetNm )
333 if( it != linesByY.end() )
336 std::string( check.description )
337 +
" - expected layer " + std::to_string( check.expectedLayer )
338 +
" 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...
Information pertinent to a Pcbnew printed circuit board.
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 ...
BOARD * LoadBoard(const wxString &aFileName, BOARD *aAppendToMe, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr) override
Load information from some input file format that this PCB_IO implementation knows about into either ...
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...
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_MESSAGE(totalMismatches==0, std::to_string(totalMismatches)+" board(s) with strategy disagreements")
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