58 BOOST_CHECK( m_plugin.CanReadBoard(
path ) );
65 BOOST_CHECK( !m_plugin.CanReadBoard( kicadPath ) );
71 BOOST_CHECK( !m_plugin.CanReadBoard( wxT(
"/nonexistent/path/file.lay6" ) ) );
83 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
86 BOOST_CHECK( board->Footprints().size() > 0 );
93 +
"/io/sprint_layout/cacazi-a8-zigbee_cr2032_1.2mm.lay6";
95 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
98 BOOST_CHECK( board->Footprints().size() > 0 );
105 +
"/io/sprint_layout/mdb-rs232.lay6";
107 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
110 BOOST_CHECK( board->Footprints().size() > 0 );
119 std::unique_ptr<BOARD> baseBoard( m_plugin.LoadBoard( dataPath,
nullptr ) );
123 size_t originalFootprints = baseBoard->Footprints().size();
124 size_t originalDrawings = baseBoard->Drawings().size();
133 BOOST_CHECK( baseBoard->Footprints().size() >= originalFootprints * 2 );
134 BOOST_CHECK( baseBoard->Drawings().size() >= originalDrawings * 2 );
146 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
150 int edgeCutsCount = 0;
172 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
196 boardBox.
Merge( shapeBox );
209 int outsideCount = 0;
211 for(
FOOTPRINT* fp : board->Footprints() )
213 for(
PAD*
pad : fp->Pads() )
221 wxString::Format(
"%d pads found outside board outline", outsideCount ) );
233 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
236 BOOST_CHECK( board->GetCopperLayerCount() >= 2 );
244 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
248 std::vector<FOOTPRINT*> cached = m_plugin.GetImportedCachedLibraryFootprints();
251 BOOST_CHECK( cached.size() > 0 );
262 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
269 for(
FOOTPRINT* fp : board->Footprints() )
271 for(
PAD*
pad : fp->Pads() )
282 "Board should have at least some pads" );
294 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
299 int negativeCount = 0;
301 for(
FOOTPRINT* fp : board->Footprints() )
303 for(
PAD*
pad : fp->Pads() )
305 if(
pad->GetPosition().y < 0 )
311 wxString::Format(
"%d pads have negative Y (Y-flip error)", negativeCount ) );
319 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
323 int copperDrawings = 0;
324 int silkDrawings = 0;
337 "Board should have drawings on copper or silkscreen layers" );
347 std::vector<std::string> files = {
348 "/io/sprint_layout/gpio2nesc.lay6",
349 "/io/sprint_layout/cacazi-a8-zigbee_cr2032_1.2mm.lay6",
350 "/io/sprint_layout/mdb-rs232.lay6",
351 "/io/sprint_layout/mdb-master-rev2a.lay6",
352 "/io/sprint_layout/smalldualrgb-withmask.lay6",
353 "/io/sprint_layout/amiga2000-remake.lay6",
354 "/io/sprint_layout/karpaty-rx-pcb1-bpf-orig.lay6",
355 "/io/sprint_layout/karpaty-rx-pcb2-rfamp-1st-mixer-orig.lay6",
356 "/io/sprint_layout/karpaty-rx-pcb3-vfo-orig.lay6",
357 "/io/sprint_layout/karpaty-rx-pcb5-buffer-freq-doubler-orig.lay6",
358 "/io/sprint_layout/karpaty-rx-pcb6-mainboard-orig.lay6",
359 "/io/sprint_layout/karpaty-rx-pcb7-power-supply-orig.lay6",
360 "/io/sprint_layout/ku14194revb.lay6",
361 "/io/sprint_layout/pcb100x40_v5.lay6",
362 "/io/sprint_layout/tfcc.lay6",
363 "/io/sprint_layout/12F629_SM.lay6",
366 for(
const auto& file : files )
372 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
373 BOOST_CHECK( board !=
nullptr );
386 +
"/io/sprint_layout/mmjoy2-74hc165.lay6";
388 std::map<std::string, UTF8> props;
389 props[
"pcb_id"] =
"0";
391 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr, &props ) );
394 BOOST_CHECK( board->Footprints().size() > 0 );
398 for(
FOOTPRINT* fp : board->Footprints() )
399 padCount +=
static_cast<int>( fp->Pads().size() );
408 +
"/io/sprint_layout/smalldualrgb-withmask.lay6";
410 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
413 BOOST_CHECK( board->Footprints().size() > 0 );
420 +
"/io/sprint_layout/mdb-master-rev2a.lay6";
422 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
425 BOOST_CHECK( board->Footprints().size() > 0 );
426 BOOST_CHECK( board->GetCopperLayerCount() >= 2 );
437 +
"/io/sprint_layout/karpaty-rx-pcb1-bpf-orig.lay6";
439 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
442 BOOST_CHECK( board->Footprints().size() > 0 );
449 +
"/io/sprint_layout/karpaty-rx-pcb2-rfamp-1st-mixer-orig.lay6";
451 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
454 BOOST_CHECK( board->Footprints().size() > 0 );
461 +
"/io/sprint_layout/karpaty-rx-pcb3-vfo-orig.lay6";
463 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
466 BOOST_CHECK( board->Footprints().size() > 0 );
473 +
"/io/sprint_layout/karpaty-rx-pcb5-buffer-freq-doubler-orig.lay6";
475 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
478 BOOST_CHECK( board->Footprints().size() > 0 );
485 +
"/io/sprint_layout/karpaty-rx-pcb6-mainboard-orig.lay6";
487 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
490 BOOST_CHECK( board->Footprints().size() > 0 );
497 +
"/io/sprint_layout/karpaty-rx-pcb7-power-supply-orig.lay6";
499 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
502 BOOST_CHECK( board->Footprints().size() > 0 );
513 +
"/io/sprint_layout/ku14194revb.lay6";
515 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
518 BOOST_CHECK( board->Footprints().size() > 0 );
525 +
"/io/sprint_layout/pcb100x40_v5.lay6";
527 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
530 BOOST_CHECK( board->Footprints().size() > 0 );
537 +
"/io/sprint_layout/tfcc.lay6";
539 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
542 BOOST_CHECK( board->Footprints().size() > 0 );
553 +
"/io/sprint_layout/amiga2000-remake.lay6";
555 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
560 wxString::Format(
"Amiga 2000 should have many footprints, got %zu",
561 board->Footprints().size() ) );
563 BOOST_CHECK( board->GetCopperLayerCount() >= 2 );
573 std::vector<std::string> files = {
574 "/io/sprint_layout/gpio2nesc.lay6",
575 "/io/sprint_layout/mdb-rs232.lay6",
576 "/io/sprint_layout/mdb-master-rev2a.lay6",
577 "/io/sprint_layout/smalldualrgb-withmask.lay6",
578 "/io/sprint_layout/amiga2000-remake.lay6",
579 "/io/sprint_layout/karpaty-rx-pcb1-bpf-orig.lay6",
580 "/io/sprint_layout/karpaty-rx-pcb2-rfamp-1st-mixer-orig.lay6",
581 "/io/sprint_layout/karpaty-rx-pcb3-vfo-orig.lay6",
582 "/io/sprint_layout/karpaty-rx-pcb5-buffer-freq-doubler-orig.lay6",
583 "/io/sprint_layout/karpaty-rx-pcb6-mainboard-orig.lay6",
584 "/io/sprint_layout/karpaty-rx-pcb7-power-supply-orig.lay6",
585 "/io/sprint_layout/ku14194revb.lay6",
586 "/io/sprint_layout/pcb100x40_v5.lay6",
587 "/io/sprint_layout/tfcc.lay6",
588 "/io/sprint_layout/12F629_SM.lay6",
591 for(
const auto& file : files )
597 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
603 const int MAX_COORD =
pcbIUScale.mmToIU( 1000.0 );
606 for(
FOOTPRINT* fp : board->Footprints() )
608 for(
PAD*
pad : fp->Pads() )
618 wxString::Format(
"%d pads have coordinates outside +-10m in %s",
619 badCount, wxString::FromUTF8( file ) ) );
632 +
"/io/sprint_layout/mmjoy2-74hc165.lay6";
645 +
"/io/sprint_layout/mmjoy2-74hc165.lay6";
653 for(
size_t i = 0; i < fileData.boards.size(); i++ )
657 std::map<std::string, UTF8> props;
658 props[
"pcb_id"] = std::to_string( i );
661 std::unique_ptr<BOARD> board( plugin.
LoadBoard( dataPath,
nullptr, &props ) );
672 +
"/io/sprint_layout/mmjoy2-74hc165.lay6";
675 bool callbackInvoked =
false;
676 size_t optionCount = 0;
679 [&](
const std::vector<IMPORT_PROJECT_DESC>& aOptions )
681 callbackInvoked =
true;
682 optionCount = aOptions.size();
685 std::vector<IMPORT_PROJECT_DESC> chosen;
686 chosen.push_back( aOptions[1] );
690 std::unique_ptr<BOARD> board( plugin.
LoadBoard( dataPath,
nullptr ) );
692 BOOST_CHECK( callbackInvoked );
701 +
"/io/sprint_layout/mmjoy2-74hc165.lay6";
706 [&](
const std::vector<IMPORT_PROJECT_DESC>& aOptions )
708 return std::vector<IMPORT_PROJECT_DESC>();
711 std::unique_ptr<BOARD> board( plugin.
LoadBoard( dataPath,
nullptr ) );
713 BOOST_CHECK( board ==
nullptr );
720 +
"/io/sprint_layout/gpio2nesc.lay6";
723 bool callbackInvoked =
false;
726 [&](
const std::vector<IMPORT_PROJECT_DESC>& aOptions )
728 callbackInvoked =
true;
732 std::unique_ptr<BOARD> board( plugin.
LoadBoard( dataPath,
nullptr ) );
734 BOOST_CHECK( !callbackInvoked );
749 +
"/io/sprint_layout/12F629_SM.lay6";
751 std::unique_ptr<BOARD> board( m_plugin.LoadBoard( dataPath,
nullptr ) );
782 int outsideCount = 0;
785 for(
FOOTPRINT* fp : board->Footprints() )
787 for(
PAD*
pad : fp->Pads() )
800 "PIC12F629 board should have SMD pads" );
803 wxString::Format(
"%d of %d SMD pads outside board outline",
804 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 Parse(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