54 BOOST_CHECK( m_plugin.CanReadBoard(
path ) );
61 BOOST_CHECK( !m_plugin.CanReadBoard( kicadPath ) );
67 BOOST_CHECK( !m_plugin.CanReadBoard( wxT(
"/nonexistent/path/file.lay6" ) ) );
79 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
82 BOOST_CHECK( board->Footprints().size() > 0 );
89 +
"/io/sprint_layout/cacazi-a8-zigbee_cr2032_1.2mm.lay6";
91 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
94 BOOST_CHECK( board->Footprints().size() > 0 );
101 +
"/io/sprint_layout/mdb-rs232.lay6";
103 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
106 BOOST_CHECK( board->Footprints().size() > 0 );
115 std::unique_ptr<BOARD> baseBoard( m_plugin.LoadBoard( dataPath,
nullptr ) );
119 size_t originalFootprints = baseBoard->Footprints().size();
120 size_t originalDrawings = baseBoard->Drawings().size();
129 BOOST_CHECK( baseBoard->Footprints().size() >= originalFootprints * 2 );
130 BOOST_CHECK( baseBoard->Drawings().size() >= originalDrawings * 2 );
142 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
146 int edgeCutsCount = 0;
168 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
192 boardBox.
Merge( shapeBox );
205 int outsideCount = 0;
207 for(
FOOTPRINT* fp : board->Footprints() )
209 for(
PAD*
pad : fp->Pads() )
217 wxString::Format(
"%d pads found outside board outline", outsideCount ) );
229 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
232 BOOST_CHECK( board->GetCopperLayerCount() >= 2 );
240 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
244 std::vector<FOOTPRINT*> cached = m_plugin.GetImportedCachedLibraryFootprints();
247 BOOST_CHECK( cached.size() > 0 );
258 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
265 for(
FOOTPRINT* fp : board->Footprints() )
267 for(
PAD*
pad : fp->Pads() )
278 "Board should have at least some pads" );
290 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
295 int negativeCount = 0;
297 for(
FOOTPRINT* fp : board->Footprints() )
299 for(
PAD*
pad : fp->Pads() )
301 if(
pad->GetPosition().y < 0 )
307 wxString::Format(
"%d pads have negative Y (Y-flip error)", negativeCount ) );
315 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
319 int copperDrawings = 0;
320 int silkDrawings = 0;
333 "Board should have drawings on copper or silkscreen layers" );
343 std::vector<std::string> files = {
344 "/io/sprint_layout/gpio2nesc.lay6",
345 "/io/sprint_layout/cacazi-a8-zigbee_cr2032_1.2mm.lay6",
346 "/io/sprint_layout/mdb-rs232.lay6",
347 "/io/sprint_layout/mdb-master-rev2a.lay6",
348 "/io/sprint_layout/smalldualrgb-withmask.lay6",
349 "/io/sprint_layout/amiga2000-remake.lay6",
350 "/io/sprint_layout/karpaty-rx-pcb1-bpf-orig.lay6",
351 "/io/sprint_layout/karpaty-rx-pcb2-rfamp-1st-mixer-orig.lay6",
352 "/io/sprint_layout/karpaty-rx-pcb3-vfo-orig.lay6",
353 "/io/sprint_layout/karpaty-rx-pcb5-buffer-freq-doubler-orig.lay6",
354 "/io/sprint_layout/karpaty-rx-pcb6-mainboard-orig.lay6",
355 "/io/sprint_layout/karpaty-rx-pcb7-power-supply-orig.lay6",
356 "/io/sprint_layout/ku14194revb.lay6",
357 "/io/sprint_layout/pcb100x40_v5.lay6",
358 "/io/sprint_layout/tfcc.lay6",
359 "/io/sprint_layout/12F629_SM.lay6",
362 for(
const auto& file : files )
368 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
369 BOOST_CHECK( board !=
nullptr );
382 +
"/io/sprint_layout/mmjoy2-74hc165.lay6";
384 std::map<std::string, UTF8> props;
385 props[
"pcb_id"] =
"0";
387 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr, &props ) );
390 BOOST_CHECK( board->Footprints().size() > 0 );
394 for(
FOOTPRINT* fp : board->Footprints() )
395 padCount +=
static_cast<int>( fp->Pads().size() );
404 +
"/io/sprint_layout/smalldualrgb-withmask.lay6";
406 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
409 BOOST_CHECK( board->Footprints().size() > 0 );
416 +
"/io/sprint_layout/mdb-master-rev2a.lay6";
418 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
421 BOOST_CHECK( board->Footprints().size() > 0 );
422 BOOST_CHECK( board->GetCopperLayerCount() >= 2 );
433 +
"/io/sprint_layout/karpaty-rx-pcb1-bpf-orig.lay6";
435 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
438 BOOST_CHECK( board->Footprints().size() > 0 );
445 +
"/io/sprint_layout/karpaty-rx-pcb2-rfamp-1st-mixer-orig.lay6";
447 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
450 BOOST_CHECK( board->Footprints().size() > 0 );
457 +
"/io/sprint_layout/karpaty-rx-pcb3-vfo-orig.lay6";
459 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
462 BOOST_CHECK( board->Footprints().size() > 0 );
469 +
"/io/sprint_layout/karpaty-rx-pcb5-buffer-freq-doubler-orig.lay6";
471 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
474 BOOST_CHECK( board->Footprints().size() > 0 );
481 +
"/io/sprint_layout/karpaty-rx-pcb6-mainboard-orig.lay6";
483 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
486 BOOST_CHECK( board->Footprints().size() > 0 );
493 +
"/io/sprint_layout/karpaty-rx-pcb7-power-supply-orig.lay6";
495 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
498 BOOST_CHECK( board->Footprints().size() > 0 );
509 +
"/io/sprint_layout/ku14194revb.lay6";
511 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
514 BOOST_CHECK( board->Footprints().size() > 0 );
521 +
"/io/sprint_layout/pcb100x40_v5.lay6";
523 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
526 BOOST_CHECK( board->Footprints().size() > 0 );
533 +
"/io/sprint_layout/tfcc.lay6";
535 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
538 BOOST_CHECK( board->Footprints().size() > 0 );
549 +
"/io/sprint_layout/amiga2000-remake.lay6";
551 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
556 wxString::Format(
"Amiga 2000 should have many footprints, got %zu",
557 board->Footprints().size() ) );
559 BOOST_CHECK( board->GetCopperLayerCount() >= 2 );
569 std::vector<std::string> files = {
570 "/io/sprint_layout/gpio2nesc.lay6",
571 "/io/sprint_layout/mdb-rs232.lay6",
572 "/io/sprint_layout/mdb-master-rev2a.lay6",
573 "/io/sprint_layout/smalldualrgb-withmask.lay6",
574 "/io/sprint_layout/amiga2000-remake.lay6",
575 "/io/sprint_layout/karpaty-rx-pcb1-bpf-orig.lay6",
576 "/io/sprint_layout/karpaty-rx-pcb2-rfamp-1st-mixer-orig.lay6",
577 "/io/sprint_layout/karpaty-rx-pcb3-vfo-orig.lay6",
578 "/io/sprint_layout/karpaty-rx-pcb5-buffer-freq-doubler-orig.lay6",
579 "/io/sprint_layout/karpaty-rx-pcb6-mainboard-orig.lay6",
580 "/io/sprint_layout/karpaty-rx-pcb7-power-supply-orig.lay6",
581 "/io/sprint_layout/ku14194revb.lay6",
582 "/io/sprint_layout/pcb100x40_v5.lay6",
583 "/io/sprint_layout/tfcc.lay6",
584 "/io/sprint_layout/12F629_SM.lay6",
587 for(
const auto& file : files )
593 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
599 const int MAX_COORD =
pcbIUScale.mmToIU( 1000.0 );
602 for(
FOOTPRINT* fp : board->Footprints() )
604 for(
PAD*
pad : fp->Pads() )
614 wxString::Format(
"%d pads have coordinates outside +-10m in %s",
615 badCount, wxString::FromUTF8( file ) ) );
628 +
"/io/sprint_layout/mmjoy2-74hc165.lay6";
641 +
"/io/sprint_layout/mmjoy2-74hc165.lay6";
649 for(
size_t i = 0; i < fileData.boards.size(); i++ )
653 std::map<std::string, UTF8> props;
654 props[
"pcb_id"] = std::to_string( i );
657 std::unique_ptr<BOARD> board( plugin.
LoadBoard( dataPath,
nullptr, &props ) );
668 +
"/io/sprint_layout/mmjoy2-74hc165.lay6";
671 bool callbackInvoked =
false;
672 size_t optionCount = 0;
675 [&](
const std::vector<IMPORT_PROJECT_DESC>& aOptions )
677 callbackInvoked =
true;
678 optionCount = aOptions.size();
681 std::vector<IMPORT_PROJECT_DESC> chosen;
682 chosen.push_back( aOptions[1] );
686 std::unique_ptr<BOARD> board( plugin.
LoadBoard( dataPath,
nullptr ) );
688 BOOST_CHECK( callbackInvoked );
697 +
"/io/sprint_layout/mmjoy2-74hc165.lay6";
702 [&](
const std::vector<IMPORT_PROJECT_DESC>& aOptions )
704 return std::vector<IMPORT_PROJECT_DESC>();
707 std::unique_ptr<BOARD> board( plugin.
LoadBoard( dataPath,
nullptr ) );
709 BOOST_CHECK( board ==
nullptr );
716 +
"/io/sprint_layout/gpio2nesc.lay6";
719 bool callbackInvoked =
false;
722 [&](
const std::vector<IMPORT_PROJECT_DESC>& aOptions )
724 callbackInvoked =
true;
728 std::unique_ptr<BOARD> board( plugin.
LoadBoard( dataPath,
nullptr ) );
730 BOOST_CHECK( !callbackInvoked );
745 +
"/io/sprint_layout/12F629_SM.lay6";
747 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
778 int outsideCount = 0;
781 for(
FOOTPRINT* fp : board->Footprints() )
783 for(
PAD*
pad : fp->Pads() )
796 "PIC12F629 board should have SMD pads" );
799 wxString::Format(
"%d of %d SMD pads outside board outline",
800 outsideCount, smdCount ) );
constexpr EDA_IU_SCALE pcbIUScale
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.
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr bool Contains(const Vec &aPoint) const
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 ...
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
virtual void RegisterCallback(CHOOSE_PROJECT_HANDLER aChooseProjectHandler)
Register a different handler to be called when a non-KiCad project contains multiple PCB+Schematic co...
const SPRINT_LAYOUT::FILE_DATA & GetFileData() const
bool ParseBoard(const wxString &aFileName)
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.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ SMD
Smd pad, appears on the solder paste layer (default)
@ PTH
Plated through hole pad.
PCB_IO_SPRINT_LAYOUT m_plugin
SPRINT_LAYOUT_IMPORT_FIXTURE()
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
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_TEST_MESSAGE("\n=== Real-World Polygon PIP Benchmark ===\n"<< formatTable(table))
BOOST_TEST_CONTEXT("Test Clearance")
BOOST_AUTO_TEST_CASE(CanReadLay6File)
wxString result
Test unit parsing edge cases and error handling.
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I