|
KiCad PCB EDA Suite
|
#include <pcbnew_utils/board_test_utils.h>#include <pcbnew_utils/board_file_utils.h>#include <qa_utils/wx_utils/unit_test_utils.h>#include <pcb_io/pads/pcb_io_pads.h>#include <layer_ids.h>#include <padstack.h>#include <board.h>#include <pcb_text.h>#include <pcb_shape.h>#include <pcb_field.h>#include <pad.h>#include <pcb_track.h>#include <footprint.h>#include <zone.h>#include <board_design_settings.h>#include <pcb_dimension.h>#include <project/net_settings.h>#include <board_stackup_manager/board_stackup.h>#include <set>Go to the source code of this file.
Classes | |
| struct | PADS_BOARD_INFO |
Functions | |
| static wxString | GetBoardPath (const PADS_BOARD_INFO &aBoard) |
| static std::unique_ptr< BOARD > | LoadAndVerify (const PADS_BOARD_INFO &aBoard) |
| Verify that the PADS file is recognized and loads without crashing. | |
| static void | RunStructuralChecks (const PADS_BOARD_INFO &aBoard) |
| Run structural integrity checks on a successfully loaded board. | |
| BOOST_AUTO_TEST_CASE (ImportClaySight_MK1) | |
| BOOST_AUTO_TEST_CASE (ClaySight_MK1_ElementCounts) | |
| Verify element counts for ClaySight_MK1 (V10.0 BASIC units). | |
| BOOST_AUTO_TEST_CASE (ImportTMS1mmX19) | |
| BOOST_AUTO_TEST_CASE (ImportMC4_PLUS_CSHAPE) | |
| BOOST_AUTO_TEST_CASE (ImportMC2_PLUS_REV1) | |
| BOOST_AUTO_TEST_CASE (ImportEms4_Rev2) | |
| BOOST_AUTO_TEST_CASE (ImportLCORE_4) | |
| BOOST_AUTO_TEST_CASE (ImportLCORE_2) | |
| BOOST_AUTO_TEST_CASE (ImportDexter_MotorCtrl) | |
| BOOST_AUTO_TEST_CASE (ImportMAIS_FC) | |
| BOOST_AUTO_TEST_CASE (ImportNonCopperTrackSkipped) | |
| BOOST_AUTO_TEST_CASE (ImportTextOnUnmappedLayer) | |
| BOOST_AUTO_TEST_CASE (ImportClaySight_MK2) | |
| BOOST_AUTO_TEST_CASE (ClaySight_MK2_ElementCounts) | |
| Verify element counts for ClaySight_MK2 (V10.0 BASIC units, EasyEDA export). | |
| BOOST_AUTO_TEST_CASE (MAIS_FC_Stackup) | |
| Verify stackup is built from LAYER DATA for MAIS_FC (V5.0 BASIC, 2-layer). | |
| BOOST_AUTO_TEST_CASE (ImportDegeneratePourSkipped) | |
| Verify that degenerate pour definitions (PADTHERM/VIATHERM with < 3 points) are skipped without crashing. | |
| BOOST_AUTO_TEST_CASE (ImportFilledCopperSingleOutline) | |
| Verify that filled copper shapes produce zones with exactly one valid outline. | |
| BOOST_AUTO_TEST_CASE (Importer_SpecificFixes) | |
| Verify Importer.asc (V10.0 BASIC, 6-layer) imports correctly. | |
| BOOST_AUTO_TEST_CASE (Peka_ViaImport) | |
| Verify peka.asc (V9.0 BASIC, 4-layer) via import. | |
| BOOST_AUTO_TEST_CASE (Importer_OvalDrillHits) | |
| Verify that U1 pads 1-5 in Importer.asc have oval drill hits. | |
| BOOST_AUTO_TEST_CASE (Peka_AlternateDecalDrill) | |
| Verify M4 pad 1 in peka.asc uses the alternate MTHOLEAAAB decal. | |
| BOOST_AUTO_TEST_CASE (Peka_ZoneFillNoSelfIntersection) | |
| Verify zone fills imported from peka.asc are not self-intersecting. | |
Variables | |
| static const PADS_BOARD_INFO | PADS_BOARDS [] |
| BOOST_AUTO_TEST_CASE | ( | ClaySight_MK1_ElementCounts | ) |
Verify element counts for ClaySight_MK1 (V10.0 BASIC units).
This board is a 2-layer design with 36 components, routed traces on F.Cu and B.Cu, no vias, no copper pours, and a rectangular board outline. Counts are derived from the ASC source file sections.
Definition at line 220 of file test_pads_import.cpp.
References B_Cu, BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), Edge_Cuts, F_Cu, NETINFO_ITEM::GetNetname(), LoadAndVerify(), PADS_BOARDS, PCB_ARC_T, PCB_TRACE_T, and PCB_VIA_T.
| BOOST_AUTO_TEST_CASE | ( | ClaySight_MK2_ElementCounts | ) |
Verify element counts for ClaySight_MK2 (V10.0 BASIC units, EasyEDA export).
EasyEDA exports footprint silkscreen outlines as COPPER type entries on the silkscreen layer in the LINES section. These are imported as silkscreen graphics rather than copper tracks. Route tracks come from SIGNAL sections.
Definition at line 433 of file test_pads_import.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), Edge_Cuts, F_SilkS, NET_SETTINGS::GetDefaultNetclass(), NETINFO_ITEM::GetNetname(), IsCopperLayer(), LoadAndVerify(), BOARD_DESIGN_SETTINGS::m_CopperEdgeClearance, BOARD_DESIGN_SETTINGS::m_NetSettings, BOARD_DESIGN_SETTINGS::m_ViasDimensionsList, PADS_BOARDS, PCB_ARC_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, RECTANGLE, and text.
| BOOST_AUTO_TEST_CASE | ( | ImportClaySight_MK1 | ) |
Definition at line 207 of file test_pads_import.cpp.
References BOOST_AUTO_TEST_CASE(), PADS_BOARDS, and RunStructuralChecks().
| BOOST_AUTO_TEST_CASE | ( | ImportClaySight_MK2 | ) |
Definition at line 420 of file test_pads_import.cpp.
References PADS_BOARDS, and RunStructuralChecks().
| BOOST_AUTO_TEST_CASE | ( | ImportDegeneratePourSkipped | ) |
Verify that degenerate pour definitions (PADTHERM/VIATHERM with < 3 points) are skipped without crashing.
Before the fix, these created zones with empty SHAPE_LINE_CHAIN outlines which caused a SIGABRT in the renderer's DrawPolyline() when accessing CPoint(0) on a zero-length vector.
Definition at line 609 of file test_pads_import.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), SHAPE_POLY_SET::COutline(), KI_TEST::GetPcbnewTestDataDir(), PCB_IO_PADS::LoadBoard(), ZONE::Outline(), SHAPE_POLY_SET::OutlineCount(), and SHAPE_LINE_CHAIN::PointCount().
| BOOST_AUTO_TEST_CASE | ( | ImportDexter_MotorCtrl | ) |
Definition at line 344 of file test_pads_import.cpp.
References PADS_BOARDS, and RunStructuralChecks().
| BOOST_AUTO_TEST_CASE | ( | ImportEms4_Rev2 | ) |
Definition at line 326 of file test_pads_import.cpp.
References PADS_BOARDS, and RunStructuralChecks().
| BOOST_AUTO_TEST_CASE | ( | Importer_OvalDrillHits | ) |
Verify that U1 pads 1-5 in Importer.asc have oval drill hits.
The DIOB_D100JHT160V decal's PAD 0 definition includes slotted drill parameters (2250000 x 9000000 BASIC units at 0 degrees). The converter must set PAD_DRILL_SHAPE::OBLONG with the correct major/minor dimensions rather than treating the drill as round.
Definition at line 888 of file test_pads_import.cpp.
References std::abs(), BOOST_REQUIRE(), KI_TEST::GetPcbnewTestDataDir(), PCB_IO_PADS::LoadBoard(), OBLONG, pad, FOOTPRINT::Pads(), VECTOR2< T >::x, and VECTOR2< T >::y.
| BOOST_AUTO_TEST_CASE | ( | Importer_SpecificFixes | ) |
Verify Importer.asc (V10.0 BASIC, 6-layer) imports correctly.
This board exercises four specific import scenarios:
Definition at line 670 of file test_pads_import.cpp.
References PADSTACK::ALL_LAYERS, BOOST_REQUIRE(), Dwgs_User, end, KI_TEST::GetPcbnewTestDataDir(), PCB_IO_PADS::LoadBoard(), OVAL, pad, FOOTPRINT::Pads(), VECTOR2< T >::x, and VECTOR2< T >::y.
| BOOST_AUTO_TEST_CASE | ( | ImportFilledCopperSingleOutline | ) |
Verify that filled copper shapes produce zones with exactly one valid outline.
Before the fix, loadCopperShapes() called NewOutline() then Append(SHAPE_LINE_CHAIN), which created two outlines per zone: an empty polygon from NewOutline() and the real one from the implicit SHAPE_LINE_CHAIN->SHAPE_POLY_SET conversion. The empty outline (0 points, but closed) crashed the renderer via CPoint(0) on an empty vector.
Definition at line 643 of file test_pads_import.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), SHAPE_POLY_SET::COutline(), KI_TEST::GetPcbnewTestDataDir(), PCB_IO_PADS::LoadBoard(), ZONE::Outline(), SHAPE_POLY_SET::OutlineCount(), and SHAPE_LINE_CHAIN::PointCount().
| BOOST_AUTO_TEST_CASE | ( | ImportLCORE_2 | ) |
Definition at line 338 of file test_pads_import.cpp.
References PADS_BOARDS, and RunStructuralChecks().
| BOOST_AUTO_TEST_CASE | ( | ImportLCORE_4 | ) |
Definition at line 332 of file test_pads_import.cpp.
References PADS_BOARDS, and RunStructuralChecks().
| BOOST_AUTO_TEST_CASE | ( | ImportMAIS_FC | ) |
Definition at line 350 of file test_pads_import.cpp.
References PADS_BOARDS, and RunStructuralChecks().
| BOOST_AUTO_TEST_CASE | ( | ImportMC2_PLUS_REV1 | ) |
Definition at line 320 of file test_pads_import.cpp.
References PADS_BOARDS, and RunStructuralChecks().
| BOOST_AUTO_TEST_CASE | ( | ImportMC4_PLUS_CSHAPE | ) |
Definition at line 314 of file test_pads_import.cpp.
References PADS_BOARDS, and RunStructuralChecks().
| BOOST_AUTO_TEST_CASE | ( | ImportNonCopperTrackSkipped | ) |
Definition at line 356 of file test_pads_import.cpp.
References BOOST_REQUIRE(), KI_TEST::GetPcbnewTestDataDir(), IsCopperLayer(), PCB_IO_PADS::LoadBoard(), PCB_ARC_T, and PCB_TRACE_T.
| BOOST_AUTO_TEST_CASE | ( | ImportTextOnUnmappedLayer | ) |
Definition at line 382 of file test_pads_import.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), Cmts_User, F_Cu, F_SilkS, KI_TEST::GetPcbnewTestDataDir(), PCB_IO_PADS::LoadBoard(), text, and UNDEFINED_LAYER.
| BOOST_AUTO_TEST_CASE | ( | ImportTMS1mmX19 | ) |
Definition at line 308 of file test_pads_import.cpp.
References PADS_BOARDS, and RunStructuralChecks().
| BOOST_AUTO_TEST_CASE | ( | MAIS_FC_Stackup | ) |
Verify stackup is built from LAYER DATA for MAIS_FC (V5.0 BASIC, 2-layer).
MAIS_FC has meaningful stackup data for its 2 copper layers: LAYER_THICKNESS 304800, COPPER_THICKNESS 38100, DIELECTRIC 3.8.
Definition at line 567 of file test_pads_import.cpp.
References BOOST_REQUIRE(), BS_ITEM_TYPE_COPPER, BS_ITEM_TYPE_DIELECTRIC, BOARD_DESIGN_SETTINGS::GetBoardThickness(), BOARD_STACKUP::GetList(), BOARD_DESIGN_SETTINGS::GetStackupDescriptor(), LoadAndVerify(), BOARD_DESIGN_SETTINGS::m_HasStackup, and PADS_BOARDS.
| BOOST_AUTO_TEST_CASE | ( | Peka_AlternateDecalDrill | ) |
Verify M4 pad 1 in peka.asc uses the alternate MTHOLEAAAB decal.
The MTHOLE part type has alternate decals separated by colons. M4 has ALT=1 which selects MTHOLEAAAB (250 mil pad, 125 mil circular drill). The converter must resolve through the PARTTYPE section to pick the correct alternate rather than defaulting to the base MTHOLE decal.
Definition at line 960 of file test_pads_import.cpp.
References std::abs(), BOOST_REQUIRE(), CIRCLE, F_Cu, KI_TEST::GetPcbnewTestDataDir(), PCB_IO_PADS::LoadBoard(), pad, FOOTPRINT::Pads(), VECTOR2< T >::x, and VECTOR2< T >::y.
| BOOST_AUTO_TEST_CASE | ( | Peka_ViaImport | ) |
Verify peka.asc (V9.0 BASIC, 4-layer) via import.
STANDARDVIA spans all 4 copper layers (-2=top, -1=bottom) plus non-copper entries (layer 0=inner pad, layer 25=soldermask). Three specific issues:
Definition at line 787 of file test_pads_import.cpp.
References BLIND, BOOST_REQUIRE(), F_Cu, KI_TEST::GetPcbnewTestDataDir(), PCB_IO_PADS::LoadBoard(), TENTED, THROUGH, via, VECTOR2< T >::x, and VECTOR2< T >::y.
| BOOST_AUTO_TEST_CASE | ( | Peka_ZoneFillNoSelfIntersection | ) |
Verify zone fills imported from peka.asc are not self-intersecting.
The HATOUT records define complex outlines with arcs that get converted to polyline approximations. Errors in arc conversion (wrong winding, bad radius, or incorrect center) can produce outlines that cross themselves. Every filled polygon on every layer must be clean.
Definition at line 1021 of file test_pads_import.cpp.
References BOOST_REQUIRE(), SHAPE_POLY_SET::CIterateSegmentsWithHoles(), Collide(), KI_TEST::GetPcbnewTestDataDir(), and PCB_IO_PADS::LoadBoard().
|
static |
Definition at line 67 of file test_pads_import.cpp.
References PADS_BOARD_INFO::dir, PADS_BOARD_INFO::file, and KI_TEST::GetPcbnewTestDataDir().
Referenced by LoadAndVerify().
|
static |
Verify that the PADS file is recognized and loads without crashing.
Definition at line 76 of file test_pads_import.cpp.
References PCB_IO_PADS::CanReadBoard(), PADS_BOARD_INFO::dir, GetBoardPath(), and PCB_IO_PADS::LoadBoard().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and RunStructuralChecks().
|
static |
Run structural integrity checks on a successfully loaded board.
Uses BOOST_WARN for checks that expose known parser limitations so they report issues without failing the test suite. Invariant checks (no duplicate vias, tracks on copper) use BOOST_CHECK since they must always hold.
Definition at line 113 of file test_pads_import.cpp.
References PADSTACK::ALL_LAYERS, SHAPE_POLY_SET::COutline(), PADS_BOARD_INFO::dir, BOX2< Vec >::Intersects(), IsCopperLayer(), LoadAndVerify(), BOX2< Vec >::Merge(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), pad, PCB_ARC_T, PCB_TRACE_T, SHAPE_LINE_CHAIN::PointCount(), BOX2< Vec >::SetMaximum(), THROUGH, and via.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 53 of file test_pads_import.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().