41#include <wx/filename.h>
52 if( !wxFileName::FileExists( dataPath ) )
54 BOOST_TEST_MESSAGE(
"no real binary Eagle sample available at " + dataPath +
"; load test skipped" );
63 BOARD* board =
nullptr;
67 board = eaglePlugin.
LoadBoard( dataPath,
nullptr,
nullptr );
71 BOOST_FAIL(
"IO_ERROR loading binary Eagle board: " + e.
What().ToStdString() );
73 catch(
const std::exception& e )
75 BOOST_FAIL( std::string(
"Exception loading binary Eagle board: " ) + e.
what() );
93 std::unique_ptr<BOARD> board( loadBoard(
"plugins/eagle_binary/blink1_b1a.brd" ) );
98 BOOST_CHECK_GT( board->Footprints().size(), 0u );
99 BOOST_CHECK_GT( board->Tracks().size(), 0u );
100 BOOST_CHECK_GT( board->GetNetInfo().GetNetCount(), 1u );
111 std::unique_ptr<BOARD> board( loadBoard(
"plugins/eagle_binary/blink1_v1a.brd" ) );
116 BOOST_CHECK_GT( board->Footprints().size(), 0u );
117 BOOST_CHECK_GT( board->Tracks().size(), 0u );
129 std::unique_ptr<BOARD> board( loadBoard(
"plugins/eagle_binary/rocketgps.brd" ) );
134 BOOST_CHECK_GT( board->Footprints().size(), 0u );
135 BOOST_CHECK_GT( board->Tracks().size(), 0u );
136 BOOST_CHECK_GT( board->GetNetInfo().GetNetCount(), 1u );
149 std::unique_ptr<BOARD> board( loadBoard(
"plugins/eagle_binary/boomchak.brd" ) );
154 BOOST_CHECK_GT( board->Footprints().size(), 0u );
155 BOOST_CHECK_GT( board->Tracks().size(), 0u );
156 BOOST_CHECK_GT( board->GetNetInfo().GetNetCount(), 1u );
160 for(
PCB_TRACK* track : board->Tracks() )
161 BOOST_CHECK( track->GetNet() !=
nullptr );
172 std::unique_ptr<BOARD> board( loadBoard(
"plugins/eagle_binary/turnemoff.brd" ) );
177 BOOST_CHECK_GT( board->Footprints().size(), 0u );
178 BOOST_CHECK_GT( board->Tracks().size(), 0u );
192 std::unique_ptr<BOARD> board( loadBoard(
"plugins/eagle_binary/issue24612_nova_usbbox.brd" ) );
197 BOOST_CHECK_GT( board->Footprints().size(), 0u );
198 BOOST_CHECK_GT( board->Tracks().size(), 0u );
200 std::set<wxString> texts;
205 texts.insert(
text->GetText() );
208 BOOST_CHECK( texts.count( wxS(
"ASTROELEKTRONIK" ) ) );
209 BOOST_CHECK( texts.count( wxS(
"Nova+ USB-Box" ) ) );
223 std::unique_ptr<BOARD> board( loadBoard(
"plugins/eagle_binary/Sigma2_e.brd" ) );
228 BOOST_CHECK_GT( board->Footprints().size(), 0u );
229 BOOST_CHECK_GT( board->Tracks().size(), 0u );
230 BOOST_CHECK_GT( board->GetNetInfo().GetNetCount(), 1u );
243 std::unique_ptr<BOARD> board( loadBoard(
"plugins/eagle_binary/boomchak.brd" ) );
248 std::map<int, double> ledRot;
250 for(
FOOTPRINT* fp : board->Footprints() )
254 if( fp->GetReference().StartsWith( wxS(
"LED" ) ) && fp->GetReference().Mid( 3 ).ToLong( &n ) )
255 ledRot[(int) n] = fp->GetOrientation().AsDegrees();
258 for(
int n = 1; n < 16; n++ )
260 BOOST_REQUIRE_MESSAGE( ledRot.count( n ) && ledRot.count( n + 1 ),
261 "expected ring footprints LED" << n <<
" and LED" << ( n + 1 ) );
263 double step = ledRot[n + 1] - ledRot[n];
265 while( step > 180.0 )
268 while( step <= -180.0 )
271 BOOST_CHECK_CLOSE( step, 22.5, 0.5 );
287 auto invalidLayerItems = [](
BOARD* board )
294 count += bad( item->GetLayer() );
296 for(
PCB_TRACK* track : board->Tracks() )
297 count += bad( track->GetLayer() );
299 for(
FOOTPRINT* fp : board->Footprints() )
301 for(
BOARD_ITEM* item : fp->GraphicalItems() )
302 count += bad( item->GetLayer() );
308 auto ruleAreas = [](
BOARD* board )
312 for(
ZONE* zone : board->Zones() )
313 count += zone->GetIsRuleArea();
318 for(
const char* relPath : {
"plugins/eagle_binary/boomchak.brd",
319 "plugins/eagle_binary/turnemoff.brd" } )
321 std::unique_ptr<BOARD> board( loadBoard( relPath ) );
332 std::unique_ptr<BOARD> turnemoff( loadBoard(
"plugins/eagle_binary/turnemoff.brd" ) );
335 BOOST_CHECK_GT( ruleAreas( turnemoff.get() ), 500 );
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.
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
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 ...
bool CanReadBoard(const wxString &aFileName) const override
Checks if this PCB_IO can read the specified board file.
Handle a list of polygons defining a copper zone.
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.
BOARD * loadBoard(const std::string &aRelPath)
EAGLE_BINARY_IMPORT_FIXTURE()
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(LoadBinaryV4V5)
Load a v4/v5 binary board (magic 0x10 0x00) which also carries the trailing free-text and DRC section...
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST_MESSAGE("\n=== Real-World Polygon PIP Benchmark ===\n"<< formatTable(table))
BOOST_CHECK_EQUAL(result, "25.4")