KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_allegro_import.cpp File Reference

Test suite for import of Cadence Allegro PCB .brd files. More...

#include "allegro_test_utils.h"
#include <pcbnew_utils/board_test_utils.h>
#include <pcbnew_utils/board_file_utils.h>
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <pcbnew/pcb_io/allegro/pcb_io_allegro.h>
#include <board.h>
#include <geometry/shape_utils.h>
#include <footprint.h>
#include <pad.h>
#include <pcb_shape.h>
#include <pcb_text.h>
#include <pcb_track.h>
#include <zone.h>
#include <board_connected_item.h>
#include <netinfo.h>
#include <netclass.h>
#include <board_design_settings.h>
#include <project/net_settings.h>
#include <reporter.h>
#include <algorithm>
#include <cstdlib>
#include <filesystem>
#include <functional>
#include <fstream>
#include <map>
#include <set>

Go to the source code of this file.

Classes

struct  ALLEGRO_IMPORT_FIXTURE
 
struct  ALLEGRO_BOARD_TEST_CASE
 Data for parameterized all-boards test. More...
 
struct  ALLEGRO_COMPREHENSIVE_FIXTURE
 Fixture for comprehensive board import tests with error capturing. More...
 
struct  ALG_ZONE_POLYGON
 Parse a FabMaster .alg file and extract reference data for cross-validation. More...
 
struct  ALG_REFERENCE_DATA
 
struct  BRD_ALG_PAIR
 
struct  ALG_OUTLINE_DATA
 Parse board outline geometry from a .alg ASCII reference file. More...
 
struct  ALG_OUTLINE_DATA::OUTLINE_SEGMENT
 

Functions

 BOOST_AUTO_TEST_CASE (FootprintRefDes)
 Test that footprints have valid reference designators.
 
 BOOST_AUTO_TEST_CASE (UnreferencedFootprintsAreBoardOnly)
 Test that footprints without a reference designator are board only, so they do not need a schematic symbol.
 
 BOOST_AUTO_TEST_CASE (FootprintLibItemNames)
 Test that placed footprints carry their package name as a library-less FPID.
 
 BOOST_AUTO_TEST_CASE (UnplatedHolesHaveSize)
 Test that unplated holes keep a non-zero pad size, which KiCad rejects when it reads them back.
 
 BOOST_AUTO_TEST_CASE (NearStraightArcsSurviveReorientation)
 Test that every imported footprint can be reoriented, as saving it to a library does.
 
 BOOST_AUTO_TEST_CASE (Release161Loads)
 Test that a 16.1 file, whose constraint sets carry 12 values per layer, loads.
 
 BOOST_AUTO_TEST_CASE (PlaneLayerLinesAreNotCopper)
 Test that lines drawn on a negative plane layer are not left as unnetted copper, which shorts the vias.
 
 BOOST_AUTO_TEST_CASE (PlaneLayerLinesAreNotCopperBefore165)
 Test that lines drawn on a negative plane layer are not copper in a file that keeps the layer flags after the layer name.
 
 BOOST_AUTO_TEST_CASE (OverlappingPadsAreNetTie)
 Test that overlapping pads of different nets in one footprint are declared as a net tie.
 
 BOOST_AUTO_TEST_CASE (V164PadstackMaskAndPaste)
 Test that 16.4 padstacks take their solder mask and paste from the 16.x fixed slots.
 
 BOOST_AUTO_TEST_CASE (EdgeConnectorBottomFingers)
 Test that the far fingers of an edge connector land on the bottom copper layer.
 
 BOOST_AUTO_TEST_CASE (AntiEtchLinesAreNotCopper)
 Test that anti-etch lines on a routing layer remove copper and are not imported as unnetted copper.
 
 BOOST_AUTO_TEST_CASE (PlaneCopperIsAZone)
 Test that a negative plane's copper is a zone for KiCad to fill, not a fixed polygon over the vias.
 
 BOOST_AUTO_TEST_CASE (PlaneFillRespectsVoids)
 Test that a refilled plane stays clear of the voids drawn on it, so the pour does not close them.
 
 BOOST_AUTO_TEST_CASE (CustomPadsAreOnePolygon)
 Test that a custom pad's anchor and outline join into one polygon, which KiCad requires.
 
 BOOST_AUTO_TEST_CASE (PadSizes)
 Test that pads have valid sizes and are not degenerate.
 
 BOOST_AUTO_TEST_CASE (ViaSizes)
 Test that vias have valid sizes (not hardcoded fallback values).
 
 BOOST_AUTO_TEST_CASE (TrackWidths)
 Test that track widths are reasonable.
 
 BOOST_AUTO_TEST_CASE (PadNumbers)
 Test that pad numbers are set correctly.
 
static unsigned CountOutlineElements (const BOARD &board)
 
static void AssertOutlineValid (const BOARD &aBoard)
 
 BOOST_AUTO_TEST_CASE (BoardOutline)
 Test that board outline is imported correctly.
 
 BOOST_AUTO_TEST_CASE (PadsInsideOutline)
 Test that all pads are inside the board outline.
 
 BOOST_AUTO_TEST_CASE (PreV16FileRejection)
 Verify that pre-v16 Allegro files are rejected with an informative error message rather than an opaque "Unknown Allegro file version" error.
 
 BOOST_AUTO_TEST_CASE (RectsZoneVsCopperPolygon)
 Test that rects.brd imports one zone fill (left rectangle) and one standalone copper polygon with a net (right rectangle).
 
 BOOST_AUTO_TEST_CASE (CopperText)
 Test that copper_text.brd imports the "TESTING" text on F.Cu.
 
 BOOST_AUTO_TEST_CASE (CoincidentGraphicsAreDropped)
 
 BOOST_AUTO_TEST_CASE (ImportIsRepeatable)
 
 BOOST_AUTO_TEST_CASE (Footprint3DModels)
 
 BOOST_AUTO_TEST_CASE (BeagleBone_OutermostZoneNets)
 Verify that the outermost (largest area) zone on each copper layer of BeagleBone Black is assigned the GND_EARTH net.
 
 BOOST_AUTO_TEST_CASE (PadSizesPositive)
 Verify that all pads have positive sizes (no negative dimensions).
 
 BOOST_AUTO_TEST_CASE (ViaDrillNotLargerThanSize)
 Verify that via drill sizes are not larger than via diameters.
 
 BOOST_AUTO_TEST_CASE (SmdPadDetection)
 Verify that pads with no drill hole are properly marked as SMD.
 
 BOOST_AUTO_TEST_CASE (QuadPackagePadRotation)
 Verify that pads on quad flat packages (QFN/QFP) have proper rotation.
 
 BOOST_AUTO_TEST_CASE (FootprintLayerPlacement)
 Verify that footprints are placed on the correct layer.
 
 BOOST_AUTO_TEST_CASE (ArcConnectivity)
 Verify that arc start points connect to adjacent track endpoints.
 
static std::vector< BRD_ALG_PAIR > getBoardsWithAlg ()
 Get a list of all board files in the test data that have a corresponding .alg reference file.
 
 BOOST_AUTO_TEST_CASE (AlgReferenceNetNames)
 Cross-validate imported board net names against .alg ASCII reference export.
 
 BOOST_AUTO_TEST_CASE (AlgReferenceComponentPlacement)
 Cross-validate imported board component reference designators against .alg reference.
 
 BOOST_AUTO_TEST_CASE (AllTracksPositiveWidth)
 Verify that all tracks and arcs have positive width across all boards.
 
 BOOST_AUTO_TEST_CASE (OutlineSegmentCount)
 Compare board outline segment count from binary import against .alg reference.
 
 BOOST_AUTO_TEST_CASE (OutlineBoundingBox)
 Compare board bounding box from binary import against .alg outline coordinates.
 
 BOOST_AUTO_TEST_CASE (OutlineEndpoints)
 For boards with line-only outlines, verify each segment endpoint matches the .alg reference within tolerance.
 
 BOOST_AUTO_TEST_CASE (PadDrillConsistency)
 Verify PTH pads have nonzero drill and SMD pads have zero drill across all boards.
 
 BOOST_AUTO_TEST_CASE (ZoneCountMatchesAlg)
 Cross-validate the number of copper zones against .alg ETCH SHAPE records.
 
 BOOST_AUTO_TEST_CASE (ZoneLayerDistribution)
 Cross-validate how many zones appear on each copper layer.
 
 BOOST_AUTO_TEST_CASE (ZoneBoundingBoxes)
 Cross-validate zone bounding box sizes between binary import and .alg reference.
 
 BOOST_AUTO_TEST_CASE (PadContainedInFabOutline)
 Verify that footprint pads are contained within their F.Fab outline bounding box.
 
 BOOST_AUTO_TEST_CASE (PadOrientationP6P10)
 Verify pad orientation on footprints P6 and P10.
 
 BOOST_AUTO_TEST_CASE (SlotHoles)
 Verify that oblong (slot) drill holes are imported with the correct shape and dimensions.
 
 BOOST_AUTO_TEST_CASE (FootprintOrientation)
 Verify that footprint J1 in BeagleBone_Black_RevC imports at 180 degrees orientation.
 
 BOOST_AUTO_TEST_CASE (UIImportPath_NullBoard)
 Test that LoadBoard works when aAppendToMe is nullptr, which is the path used by the KiCad UI "Import Non-KiCad Board" flow.
 
 BOOST_AUTO_TEST_CASE (SmdPadLayerConsistency)
 Verify that SMD pad layer sets are consistent with their parent footprint side.
 
 BOOST_AUTO_TEST_CASE (SmdFootprintTechLayers)
 Verify that SMD-only footprint tech layers are consistent with the footprint side.
 
 BOOST_AUTO_TEST_CASE (BeagleBone_DrillSlotOrientation)
 Verify that oblong drill slots on BeagleBone connectors align with their copper pad orientation.
 
 BOOST_AUTO_TEST_CASE (BeagleBone_ZoneFills)
 Verify that zones on BeagleBone have fill polygons imported from Allegro's computed copper.
 
 BOOST_AUTO_TEST_CASE (BeagleBone_Teardrops)
 Verify that Allegro dynamic copper shapes (m_Unknown2 bit 12) are imported as teardrop zones, and that the pads/vias anchoring those teardrops have teardrops enabled.
 
 BOOST_AUTO_TEST_CASE (BeagleBone_TeardropFillsHaveNoArcs)
 
 BOOST_AUTO_TEST_CASE (PreV172_NoTeardrops)
 Verify that pre-V172 boards (which lack the m_Unknown2 discriminator field) have no teardrop zones and no pads/vias with teardrops enabled.
 
 BOOST_AUTO_TEST_CASE (LegacyNetclassFlags)
 Verify that the importer sets the legacy netclass and design settings flags so that netclasses survive the SetProject() call during UI import (which replaces m_NetSettings with the project's version unless these flags are set).
 
 BOOST_AUTO_TEST_CASE (NetclassesCreatedForAllBoards)
 Verify that netclasses with correct DRC values are created for every board that has constraint sets.
 

Detailed Description

Test suite for import of Cadence Allegro PCB .brd files.

Definition in file test_allegro_import.cpp.

Function Documentation

◆ AssertOutlineValid()

◆ BOOST_AUTO_TEST_CASE() [1/58]

BOOST_AUTO_TEST_CASE ( AlgReferenceComponentPlacement )

Cross-validate imported board component reference designators against .alg reference.

Definition at line 2112 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), getBoardsWithAlg(), ALG_REFERENCE_DATA::ParseAlgFile(), and ALG_REFERENCE_DATA::refDes.

◆ BOOST_AUTO_TEST_CASE() [2/58]

BOOST_AUTO_TEST_CASE ( AlgReferenceNetNames )

Cross-validate imported board net names against .alg ASCII reference export.

Definition at line 2064 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), getBoardsWithAlg(), BOARD::GetNetInfo(), ALG_REFERENCE_DATA::netNames, and ALG_REFERENCE_DATA::ParseAlgFile().

◆ BOOST_AUTO_TEST_CASE() [3/58]

BOOST_AUTO_TEST_CASE ( AllTracksPositiveWidth )

Verify that all tracks and arcs have positive width across all boards.

Definition at line 2171 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), PCB_ARC_T, PCB_TRACE_T, and BOARD::Tracks().

◆ BOOST_AUTO_TEST_CASE() [4/58]

BOOST_AUTO_TEST_CASE ( AntiEtchLinesAreNotCopper )

Test that anti-etch lines on a routing layer remove copper and are not imported as unnetted copper.

Definition at line 438 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), EDA_SHAPE::GetShape(), IsInnerCopperLayer(), PCB_SHAPE_T, and SEGMENT.

◆ BOOST_AUTO_TEST_CASE() [5/58]

BOOST_AUTO_TEST_CASE ( ArcConnectivity )

Verify that arc start points connect to adjacent track endpoints.

This checks that arc orientation/winding is correct.

Definition at line 1686 of file test_allegro_import.cpp.

References BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), PCB_TRACK::GetEnd(), BOARD_CONNECTED_ITEM::GetNetCode(), PCB_TRACK::GetStart(), pad, PCB_ARC_T, PCB_TRACE_T, PCB_VIA_T, BOARD::Tracks(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [6/58]

BOOST_AUTO_TEST_CASE ( BeagleBone_DrillSlotOrientation )

Verify that oblong drill slots on BeagleBone connectors align with their copper pad orientation.

P6 pads 20/21, P3 pad 6, and P1 pads 1-3 have vertical oblong pads that require vertical slots. Previously the slot dimensions were imported as (primary, secondary) instead of matching the pad aspect ratio, producing horizontal slots on vertical pads.

Definition at line 3315 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), F_Cu, BOARD::Footprints(), pad, FOOTPRINT::Pads(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [7/58]

BOOST_AUTO_TEST_CASE ( BeagleBone_OutermostZoneNets )

Verify that the outermost (largest area) zone on each copper layer of BeagleBone Black is assigned the GND_EARTH net.

Allegro stores these as BOUNDARY shapes with net pointers resolved through the Ptr7 -> 0x2C TABLE -> 0x37 -> 0x1B NET chain.

Definition at line 1316 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_AUTO_TEST_CASE(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOX2< Vec >::GetHeight(), BOARD::GetLayerID(), BOARD_CONNECTED_ITEM::GetNetname(), BOX2< Vec >::GetWidth(), UNDEFINED_LAYER, and BOARD::Zones().

◆ BOOST_AUTO_TEST_CASE() [8/58]

BOOST_AUTO_TEST_CASE ( BeagleBone_TeardropFillsHaveNoArcs )

◆ BOOST_AUTO_TEST_CASE() [9/58]

BOOST_AUTO_TEST_CASE ( BeagleBone_Teardrops )

Verify that Allegro dynamic copper shapes (m_Unknown2 bit 12) are imported as teardrop zones, and that the pads/vias anchoring those teardrops have teardrops enabled.

Definition at line 3432 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), pad, PCB_VIA_T, BOARD::Tracks(), and BOARD::Zones().

◆ BOOST_AUTO_TEST_CASE() [10/58]

BOOST_AUTO_TEST_CASE ( BeagleBone_ZoneFills )

Verify that zones on BeagleBone have fill polygons imported from Allegro's computed copper.

The GND_EARTH zones should have non-empty fill polygon data.

Definition at line 3394 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), and BOARD::Zones().

◆ BOOST_AUTO_TEST_CASE() [11/58]

BOOST_AUTO_TEST_CASE ( BoardOutline )

Test that board outline is imported correctly.

Definition at line 908 of file test_allegro_import.cpp.

References AssertOutlineValid(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), and CountOutlineElements().

◆ BOOST_AUTO_TEST_CASE() [12/58]

◆ BOOST_AUTO_TEST_CASE() [13/58]

BOOST_AUTO_TEST_CASE ( CopperText )

Test that copper_text.brd imports the "TESTING" text on F.Cu.

Definition at line 1063 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), F_Cu, IsCopperLayer(), PCB_TEXT_T, and text.

◆ BOOST_AUTO_TEST_CASE() [14/58]

BOOST_AUTO_TEST_CASE ( CustomPadsAreOnePolygon )

Test that a custom pad's anchor and outline join into one polygon, which KiCad requires.

Definition at line 619 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), CUSTOM, name, and pad.

◆ BOOST_AUTO_TEST_CASE() [15/58]

BOOST_AUTO_TEST_CASE ( EdgeConnectorBottomFingers )

Test that the far fingers of an edge connector land on the bottom copper layer.

Definition at line 399 of file test_allegro_import.cpp.

References B_Cu, B_Mask, BOOST_REQUIRE(), F_Cu, F_Mask, FOOTPRINT::FindPadByNumber(), PAD::IsOnLayer(), and top().

◆ BOOST_AUTO_TEST_CASE() [16/58]

BOOST_AUTO_TEST_CASE ( Footprint3DModels )

◆ BOOST_AUTO_TEST_CASE() [17/58]

BOOST_AUTO_TEST_CASE ( FootprintLayerPlacement )

Verify that footprints are placed on the correct layer.

Tests that bottom-layer components are imported with correct layer assignment. BeagleBone Black C78 is known to be a bottom-layer component.

Definition at line 1632 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), B_Cu, BOOST_TEST_MESSAGE(), F_Cu, BOARD::Footprints(), FOOTPRINT::GetLayer(), BOARD::GetLayerName(), and FOOTPRINT::IsFlipped().

◆ BOOST_AUTO_TEST_CASE() [18/58]

BOOST_AUTO_TEST_CASE ( FootprintLibItemNames )

Test that placed footprints carry their package name as a library-less FPID.

Definition at line 132 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), and BOOST_TEST_MESSAGE().

◆ BOOST_AUTO_TEST_CASE() [19/58]

BOOST_AUTO_TEST_CASE ( FootprintOrientation )

Verify that footprint J1 in BeagleBone_Black_RevC imports at 180 degrees orientation.

This catches a bug where EDA_ANGLE was constructed without DEGREES_T, causing the rotation value to be misinterpreted.

Definition at line 3099 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), EDA_ANGLE::AsDegrees(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), and FOOTPRINT::GetOrientation().

◆ BOOST_AUTO_TEST_CASE() [20/58]

BOOST_AUTO_TEST_CASE ( FootprintRefDes )

Test that footprints have valid reference designators.

Definition at line 79 of file test_allegro_import.cpp.

References BOOST_AUTO_TEST_CASE(), BOOST_REQUIRE(), and BOOST_TEST_MESSAGE().

◆ BOOST_AUTO_TEST_CASE() [21/58]

BOOST_AUTO_TEST_CASE ( ImportIsRepeatable )

◆ BOOST_AUTO_TEST_CASE() [22/58]

BOOST_AUTO_TEST_CASE ( LegacyNetclassFlags )

Verify that the importer sets the legacy netclass and design settings flags so that netclasses survive the SetProject() call during UI import (which replaces m_NetSettings with the project's version unless these flags are set).

Definition at line 3561 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_REQUIRE(), PCB_IO::LoadBoard(), reporter, and IO_BASE::SetReporter().

◆ BOOST_AUTO_TEST_CASE() [23/58]

BOOST_AUTO_TEST_CASE ( NearStraightArcsSurviveReorientation )

Test that every imported footprint can be reoriented, as saving it to a library does.

Definition at line 185 of file test_allegro_import.cpp.

References ANGLE_0, BOOST_REQUIRE(), and copy.

◆ BOOST_AUTO_TEST_CASE() [24/58]

BOOST_AUTO_TEST_CASE ( NetclassesCreatedForAllBoards )

Verify that netclasses with correct DRC values are created for every board that has constraint sets.

Tests the full matrix of boards and their expected netclass counts.

Definition at line 3584 of file test_allegro_import.cpp.

References BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::m_NetSettings, and name.

◆ BOOST_AUTO_TEST_CASE() [25/58]

◆ BOOST_AUTO_TEST_CASE() [26/58]

BOOST_AUTO_TEST_CASE ( OutlineEndpoints )

For boards with line-only outlines, verify each segment endpoint matches the .alg reference within tolerance.

Allegro's Y axis is inverted relative to KiCad, so we compare absolute coordinate differences.

Definition at line 2502 of file test_allegro_import.cpp.

References std::abs(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), ALG_OUTLINE_DATA::designOutlineCount, ALG_OUTLINE_DATA::designOutlineSegments, BOARD::Drawings(), Edge_Cuts, end, getBoardsWithAlg(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetShape(), EDA_SHAPE::GetStart(), ALG_OUTLINE_DATA::LINE, ALG_OUTLINE_DATA::ParseAlgOutlines(), PCB_SHAPE_T, ALG_OUTLINE_DATA::RECTANGLE, SEGMENT, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [27/58]

BOOST_AUTO_TEST_CASE ( OutlineSegmentCount )

Compare board outline segment count from binary import against .alg reference.

Uses DESIGN_OUTLINE records since those are what the binary importer targets.

Definition at line 2369 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), ALG_OUTLINE_DATA::designOutlineCount, BOARD::Drawings(), Edge_Cuts, ALG_OUTLINE_DATA::expectedEdgeCutsSegments(), getBoardsWithAlg(), ALG_OUTLINE_DATA::outlineCount, ALG_OUTLINE_DATA::ParseAlgOutlines(), and PCB_SHAPE_T.

◆ BOOST_AUTO_TEST_CASE() [28/58]

BOOST_AUTO_TEST_CASE ( OverlappingPadsAreNetTie )

Test that overlapping pads of different nets in one footprint are declared as a net tie.

Definition at line 308 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), and FOOTPRINT::GetNetTiePadGroups().

◆ BOOST_AUTO_TEST_CASE() [29/58]

BOOST_AUTO_TEST_CASE ( PadContainedInFabOutline )

Verify that footprint pads are contained within their F.Fab outline bounding box.

This catches coordinate-space bugs where 0x0D pad positions (footprint-local) are incorrectly treated as board-absolute, causing pads to be placed far from their footprint's fabrication outline.

Definition at line 2918 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), B_Fab, BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOX2< Vec >::Contains(), F_Fab, BOARD::Footprints(), BOX2< Vec >::Inflate(), BOX2< Vec >::Merge(), pad, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [30/58]

BOOST_AUTO_TEST_CASE ( PadDrillConsistency )

Verify PTH pads have nonzero drill and SMD pads have zero drill across all boards.

Definition at line 2664 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), pad, PTH, and SMD.

◆ BOOST_AUTO_TEST_CASE() [31/58]

BOOST_AUTO_TEST_CASE ( PadNumbers )

Test that pad numbers are set correctly.

Definition at line 775 of file test_allegro_import.cpp.

References BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), and pad.

◆ BOOST_AUTO_TEST_CASE() [32/58]

BOOST_AUTO_TEST_CASE ( PadOrientationP6P10 )

Verify pad orientation on footprints P6 and P10.

The binary format stores pad rotation in footprint-local space via 0x0D. An earlier bug double-subtracted footprint rotation, causing pads to appear rotated 90 degrees from their correct orientation.

Definition at line 2998 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOARD::Footprints(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), and pad.

◆ BOOST_AUTO_TEST_CASE() [33/58]

BOOST_AUTO_TEST_CASE ( PadsInsideOutline )

◆ BOOST_AUTO_TEST_CASE() [34/58]

BOOST_AUTO_TEST_CASE ( PadSizes )

Test that pads have valid sizes and are not degenerate.

Definition at line 654 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), F_Cu, pad, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [35/58]

BOOST_AUTO_TEST_CASE ( PadSizesPositive )

Verify that all pads have positive sizes (no negative dimensions).

Definition at line 1371 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), F_Cu, BOARD::Footprints(), pad, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [36/58]

BOOST_AUTO_TEST_CASE ( PlaneCopperIsAZone )

Test that a negative plane's copper is a zone for KiCad to fill, not a fixed polygon over the vias.

Definition at line 478 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), KI_TEST::FillZones(), EDA_SHAPE::GetShape(), IsInnerCopperLayer(), PCB_SHAPE_T, PCB_VIA_T, and POLY.

◆ BOOST_AUTO_TEST_CASE() [37/58]

BOOST_AUTO_TEST_CASE ( PlaneFillRespectsVoids )

Test that a refilled plane stays clear of the voids drawn on it, so the pour does not close them.

Definition at line 572 of file test_allegro_import.cpp.

References SHAPE_POLY_SET::Area(), SHAPE_POLY_SET::BooleanIntersection(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), and KI_TEST::FillZones().

◆ BOOST_AUTO_TEST_CASE() [38/58]

BOOST_AUTO_TEST_CASE ( PlaneLayerLinesAreNotCopper )

Test that lines drawn on a negative plane layer are not left as unnetted copper, which shorts the vias.

Definition at line 246 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), IsInnerCopperLayer(), and PCB_SHAPE_T.

◆ BOOST_AUTO_TEST_CASE() [39/58]

BOOST_AUTO_TEST_CASE ( PlaneLayerLinesAreNotCopperBefore165 )

Test that lines drawn on a negative plane layer are not copper in a file that keeps the layer flags after the layer name.

Definition at line 268 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), EDA_SHAPE::GetShape(), IsInnerCopperLayer(), PCB_SHAPE_T, and SEGMENT.

◆ BOOST_AUTO_TEST_CASE() [40/58]

BOOST_AUTO_TEST_CASE ( PreV16FileRejection )

Verify that pre-v16 Allegro files are rejected with an informative error message rather than an opaque "Unknown Allegro file version" error.

Definition at line 1003 of file test_allegro_import.cpp.

References IO_ERROR::What().

◆ BOOST_AUTO_TEST_CASE() [41/58]

BOOST_AUTO_TEST_CASE ( PreV172_NoTeardrops )

Verify that pre-V172 boards (which lack the m_Unknown2 discriminator field) have no teardrop zones and no pads/vias with teardrops enabled.

Definition at line 3524 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOARD::Footprints(), pad, and BOARD::Zones().

◆ BOOST_AUTO_TEST_CASE() [42/58]

BOOST_AUTO_TEST_CASE ( QuadPackagePadRotation )

Verify that pads on quad flat packages (QFN/QFP) have proper rotation.

Pads on the sides should be rotated 90° from each other.

Definition at line 1516 of file test_allegro_import.cpp.

References EDA_ANGLE::AsDegrees(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), BOX2< Vec >::Merge(), EDA_ANGLE::Normalize(), and pad.

◆ BOOST_AUTO_TEST_CASE() [43/58]

BOOST_AUTO_TEST_CASE ( RectsZoneVsCopperPolygon )

Test that rects.brd imports one zone fill (left rectangle) and one standalone copper polygon with a net (right rectangle).

Verifies that BOUNDARY shapes with unnamed nets correctly resolve their net from overlapping fills.

Definition at line 1022 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), ZONE::GetFirstLayer(), PCB_SHAPE::GetLayer(), BOARD_CONNECTED_ITEM::GetNetCode(), EDA_SHAPE::GetShape(), IsCopperLayer(), ZONE::IsFilled(), PCB_SHAPE_T, and POLY.

◆ BOOST_AUTO_TEST_CASE() [44/58]

BOOST_AUTO_TEST_CASE ( Release161Loads )

Test that a 16.1 file, whose constraint sets carry 12 values per layer, loads.

Definition at line 218 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), and BOOST_REQUIRE().

◆ BOOST_AUTO_TEST_CASE() [45/58]

BOOST_AUTO_TEST_CASE ( SlotHoles )

Verify that oblong (slot) drill holes are imported with the correct shape and dimensions.

The builder must set PAD_DRILL_SHAPE::OBLONG when width != height.

BeagleBone Black has 7 slot holes in total: 2x 50x15 mil, 2x 95x40 mil, 1x 120x40 mil @90, 1x 120x40 mil, 1x 140x40 mil

Definition at line 3054 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), OBLONG, pad, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BOOST_AUTO_TEST_CASE() [46/58]

BOOST_AUTO_TEST_CASE ( SmdFootprintTechLayers )

Verify that SMD-only footprint tech layers are consistent with the footprint side.

A front-side SMD footprint should have shapes/text only on front tech layers (F.SilkS, F.CrtYd, F.Fab, F.Mask, F.Paste). A bottom-side SMD footprint should have them only on back tech layers. Mixed-side items indicate the importer failed to canonicalize footprint children before flipping.

Definition at line 3234 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), BOARD::GetLayerName(), IsBackLayer(), IsFrontLayer(), pad, PTH, and SMD.

◆ BOOST_AUTO_TEST_CASE() [47/58]

BOOST_AUTO_TEST_CASE ( SmdPadDetection )

Verify that pads with no drill hole are properly marked as SMD.

If a pad has drill size of 0, it should have PAD_ATTRIB::SMD, not PTH.

Definition at line 1459 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), BOARD::Footprints(), NPTH, pad, PTH, and SMD.

◆ BOOST_AUTO_TEST_CASE() [48/58]

BOOST_AUTO_TEST_CASE ( SmdPadLayerConsistency )

Verify that SMD pad layer sets are consistent with their parent footprint side.

In KiCad, footprint definitions always use F.Cu for SMD pads. When a footprint is placed on the bottom of the board, Flip() moves pads to B.Cu. So after import:

  • Front footprints should have SMD pads on F.Cu
  • Bottom footprints should have SMD pads on B.Cu

Definition at line 3174 of file test_allegro_import.cpp.

References B_Cu, BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), LSET::Contains(), F_Cu, BOARD::Footprints(), pad, and SMD.

◆ BOOST_AUTO_TEST_CASE() [49/58]

BOOST_AUTO_TEST_CASE ( TrackWidths )

Test that track widths are reasonable.

Definition at line 744 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), and PCB_TRACE_T.

◆ BOOST_AUTO_TEST_CASE() [50/58]

BOOST_AUTO_TEST_CASE ( UIImportPath_NullBoard )

Test that LoadBoard works when aAppendToMe is nullptr, which is the path used by the KiCad UI "Import Non-KiCad Board" flow.

The plugin must create and return a new BOARD.

Definition at line 3130 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardFile(), BOOST_CHECK_EQUAL(), BOOST_TEST_MESSAGE(), PCB_IO::LoadBoard(), KI_TEST::PrintBoardStats(), reporter, IO_BASE::SetReporter(), IO_ERROR::What(), and IO_ERROR::what().

◆ BOOST_AUTO_TEST_CASE() [51/58]

BOOST_AUTO_TEST_CASE ( UnplatedHolesHaveSize )

Test that unplated holes keep a non-zero pad size, which KiCad rejects when it reads them back.

Definition at line 157 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), and pad.

◆ BOOST_AUTO_TEST_CASE() [52/58]

BOOST_AUTO_TEST_CASE ( UnreferencedFootprintsAreBoardOnly )

Test that footprints without a reference designator are board only, so they do not need a schematic symbol.

Definition at line 108 of file test_allegro_import.cpp.

References BOOST_REQUIRE(), and FP_BOARD_ONLY.

◆ BOOST_AUTO_TEST_CASE() [53/58]

BOOST_AUTO_TEST_CASE ( V164PadstackMaskAndPaste )

Test that 16.4 padstacks take their solder mask and paste from the 16.x fixed slots.

Definition at line 341 of file test_allegro_import.cpp.

References B_Mask, B_Paste, BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), LSET::Contains(), expected, F_Mask, F_Paste, name, pad, and SMD.

◆ BOOST_AUTO_TEST_CASE() [54/58]

BOOST_AUTO_TEST_CASE ( ViaDrillNotLargerThanSize )

Verify that via drill sizes are not larger than via diameters.

This would indicate a parsing error in the padstack.

Definition at line 1413 of file test_allegro_import.cpp.

References BOOST_CHECK_EQUAL(), BOOST_TEST_CONTEXT(), BOOST_TEST_MESSAGE(), F_Cu, PCB_VIA_T, BOARD::Tracks(), and via.

◆ BOOST_AUTO_TEST_CASE() [55/58]

BOOST_AUTO_TEST_CASE ( ViaSizes )

Test that vias have valid sizes (not hardcoded fallback values).

Definition at line 701 of file test_allegro_import.cpp.

References BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), F_Cu, PCB_VIA_T, and via.

◆ BOOST_AUTO_TEST_CASE() [56/58]

BOOST_AUTO_TEST_CASE ( ZoneBoundingBoxes )

◆ BOOST_AUTO_TEST_CASE() [57/58]

BOOST_AUTO_TEST_CASE ( ZoneCountMatchesAlg )

◆ BOOST_AUTO_TEST_CASE() [58/58]

BOOST_AUTO_TEST_CASE ( ZoneLayerDistribution )

◆ CountOutlineElements()

static unsigned CountOutlineElements ( const BOARD & board)
static

Definition at line 806 of file test_allegro_import.cpp.

References BOARD::Drawings(), Edge_Cuts, and PCB_SHAPE_T.

Referenced by BOOST_AUTO_TEST_CASE().

◆ getBoardsWithAlg()

static std::vector< BRD_ALG_PAIR > getBoardsWithAlg ( )
static

Get a list of all board files in the test data that have a corresponding .alg reference file.

This allows us to automatically run cross-validation tests on all boards with reference data.

Definition at line 2026 of file test_allegro_import.cpp.

References KI_TEST::AllegroBoardDataDir().

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(), and BOOST_AUTO_TEST_CASE().