|
KiCad PCB EDA Suite
|
Test suite for import of DipTrace PCB (.dip) files. More...
#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/diptrace/pcb_io_diptrace.h>#include <pcbnew/pcb_io/diptrace/diptrace_pcb_parser.h>#include <board.h>#include <board_design_settings.h>#include <footprint.h>#include <netclass.h>#include <project/net_settings.h>#include <pad.h>#include <pcb_track.h>#include <pcb_shape.h>#include <wx/ffile.h>#include <wx/filefn.h>#include <wx/filename.h>Go to the source code of this file.
Classes | |
| struct | DIPTRACE_PCB_IMPORT_FIXTURE |
Functions | |
| BOOST_AUTO_TEST_CASE (CanReadBoard) | |
| Test that CanReadBoard correctly identifies DipTrace .dip files by their magic header bytes (0x07 "DTBOARD"). | |
| BOOST_AUTO_TEST_CASE (InvalidComponentHeaderFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (InvalidRouteChainNodeCountFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (InvalidNetNameLengthFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (InvalidZoneMinWidthFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (LoadKeyboard) | |
| Load keyboard.dip (DipTrace format v54, complex board with ~103 components). | |
| BOOST_AUTO_TEST_CASE (ObjectsAreFieldLocatedNotScanned) | |
| Determinism gate for the DipTrace PCB importer. | |
| BOOST_AUTO_TEST_CASE (Load156Bus) | |
| Load 156bus_narrow.dip (DipTrace format v41, has board outline with arcs and text objects). | |
| BOOST_AUTO_TEST_CASE (LoadV37) | |
| Load project4.dip (DipTrace format v37, oldest supported format using legacy ASCII string encoding). | |
| BOOST_AUTO_TEST_CASE (LoadLogicProbe) | |
| Load logic_probe.dip and verify basic import succeeds. | |
| BOOST_AUTO_TEST_CASE (LoadZ80Board) | |
| Load Z80 board and verify component, net, and pad import. | |
| BOOST_AUTO_TEST_CASE (LoadV37Pads) | |
| Load project4.dip (v37) and verify pad parsing works for the oldest supported format. | |
| BOOST_AUTO_TEST_CASE (LoadKeyboardPads) | |
| Load keyboard.dip (v54) and verify pad parsing works for the modern format. | |
| BOOST_AUTO_TEST_CASE (KeyboardFootprintGraphics) | |
| Load keyboard.dip (v54) and verify that footprint graphics are parsed from the per-layer font block format introduced in v46. | |
| BOOST_AUTO_TEST_CASE (LogicProbeFootprintGraphics) | |
| Load logic_probe.dip (v46) and verify footprint graphics. | |
| BOOST_AUTO_TEST_CASE (Z80FootprintGraphics) | |
| Load z80_board.dip (v45) and verify footprint graphics still work with the original fixed-record parser path. | |
| BOOST_AUTO_TEST_CASE (LogicProbeTextPositioning) | |
| Load logic_probe.dip (v46) and verify text positioning fields are parsed from the 37-byte component tail. | |
| BOOST_AUTO_TEST_CASE (Z80TextPositioning) | |
| Load z80_board.dip (v45) and verify text positioning is parsed. | |
| BOOST_AUTO_TEST_CASE (KeyboardTextPositioning) | |
| Load keyboard.dip (v54) and verify text positioning for the modern format. | |
| BOOST_AUTO_TEST_CASE (V37TextPositioning) | |
| Load project4.dip (v37) and verify text positioning for the oldest supported format. | |
| BOOST_AUTO_TEST_CASE (FootprintGraphicShapeTypes) | |
| Load logic_probe.dip and keyboard.dip, count footprint graphics by shape type, and verify that curved shapes (CIRCLE or ARC) are present alongside line segments. | |
| BOOST_AUTO_TEST_CASE (Z80PolygonPads) | |
| Load z80_board.dip (v45) and verify that polygon/custom pad shapes are imported. | |
| BOOST_AUTO_TEST_CASE (Z80RectangularPads) | |
| Load z80_board.dip (v45) and verify that rectangular pads (padStyleC=2) are imported with PAD_SHAPE::RECTANGLE instead of being treated as OVAL. | |
| BOOST_AUTO_TEST_CASE (KeyboardPadShapes) | |
| Load keyboard.dip (v54) and verify pad shape differentiation. | |
| BOOST_AUTO_TEST_CASE (LogicProbeBoardSettings) | |
| Load logic_probe.dip (v46) and verify that board design settings are applied. | |
| BOOST_AUTO_TEST_CASE (Z80BoardSettings) | |
| Load z80_board.dip (v45) and verify board copper layer count. | |
Test suite for import of DipTrace PCB (.dip) files.
Definition in file test_diptrace_import.cpp.
| BOOST_AUTO_TEST_CASE | ( | CanReadBoard | ) |
Test that CanReadBoard correctly identifies DipTrace .dip files by their magic header bytes (0x07 "DTBOARD").
Definition at line 70 of file test_diptrace_import.cpp.
References BOOST_AUTO_TEST_CASE(), and BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | FootprintGraphicShapeTypes | ) |
Load logic_probe.dip and keyboard.dip, count footprint graphics by shape type, and verify that curved shapes (CIRCLE or ARC) are present alongside line segments.
Definition at line 637 of file test_diptrace_import.cpp.
References ARC, BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), CIRCLE, EDA_SHAPE::GetShape(), PCB_SHAPE_T, and SEGMENT.
| BOOST_AUTO_TEST_CASE | ( | InvalidComponentHeaderFailsDeterministically | ) |
Definition at line 98 of file test_diptrace_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | InvalidNetNameLengthFailsDeterministically | ) |
Definition at line 154 of file test_diptrace_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | InvalidRouteChainNodeCountFailsDeterministically | ) |
Definition at line 126 of file test_diptrace_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | InvalidZoneMinWidthFailsDeterministically | ) |
Definition at line 182 of file test_diptrace_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | KeyboardFootprintGraphics | ) |
Load keyboard.dip (v54) and verify that footprint graphics are parsed from the per-layer font block format introduced in v46.
Before the fix, the v45 fixed-record shape parser found zero shapes in v46+ files because the binary format changed to per-layer Tahoma font blocks containing line coordinates.
Definition at line 431 of file test_diptrace_import.cpp.
References BOOST_REQUIRE(), and PCB_SHAPE_T.
| BOOST_AUTO_TEST_CASE | ( | KeyboardPadShapes | ) |
Load keyboard.dip (v54) and verify pad shape differentiation.
The keyboard board has both circular THT pads and rectangular SMD pads.
Definition at line 752 of file test_diptrace_import.cpp.
References PADSTACK::ALL_LAYERS, BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), CIRCLE, OVAL, pad, and RECTANGLE.
| BOOST_AUTO_TEST_CASE | ( | KeyboardTextPositioning | ) |
Load keyboard.dip (v54) and verify text positioning for the modern format.
Definition at line 583 of file test_diptrace_import.cpp.
References BOOST_REQUIRE(), and VECTOR2< T >::y.
| BOOST_AUTO_TEST_CASE | ( | Load156Bus | ) |
Load 156bus_narrow.dip (DipTrace format v41, has board outline with arcs and text objects).
Verifies board outline is present on Edge.Cuts.
Definition at line 295 of file test_diptrace_import.cpp.
References BOOST_REQUIRE(), and Edge_Cuts.
| BOOST_AUTO_TEST_CASE | ( | LoadKeyboard | ) |
Load keyboard.dip (DipTrace format v54, complex board with ~103 components).
Verifies that the board loads without assertions and has a reasonable number of footprints.
Definition at line 215 of file test_diptrace_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | LoadKeyboardPads | ) |
Load keyboard.dip (v54) and verify pad parsing works for the modern format.
Definition at line 408 of file test_diptrace_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | LoadLogicProbe | ) |
Load logic_probe.dip and verify basic import succeeds.
Definition at line 338 of file test_diptrace_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | LoadV37 | ) |
Load project4.dip (DipTrace format v37, oldest supported format using legacy ASCII string encoding).
Ensures backward compatibility.
Definition at line 324 of file test_diptrace_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | LoadV37Pads | ) |
Load project4.dip (v37) and verify pad parsing works for the oldest supported format.
Definition at line 387 of file test_diptrace_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | LoadZ80Board | ) |
Load Z80 board and verify component, net, and pad import.
The Z80 board is a paired test with a matching schematic.
Definition at line 353 of file test_diptrace_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | LogicProbeBoardSettings | ) |
Load logic_probe.dip (v46) and verify that board design settings are applied.
This file has ViaStyles and design rules that should be mapped to the board defaults.
Definition at line 790 of file test_diptrace_import.cpp.
References BOOST_REQUIRE(), NET_SETTINGS::GetDefaultNetclass(), and BOARD_DESIGN_SETTINGS::m_NetSettings.
| BOOST_AUTO_TEST_CASE | ( | LogicProbeFootprintGraphics | ) |
Load logic_probe.dip (v46) and verify footprint graphics.
This is the earliest version using font block shapes.
Definition at line 460 of file test_diptrace_import.cpp.
References BOOST_REQUIRE(), and PCB_SHAPE_T.
| BOOST_AUTO_TEST_CASE | ( | LogicProbeTextPositioning | ) |
Load logic_probe.dip (v46) and verify text positioning fields are parsed from the 37-byte component tail.
The refdes and value text should have non-zero Y offsets for components with visible text.
Definition at line 517 of file test_diptrace_import.cpp.
References BOOST_REQUIRE(), and VECTOR2< T >::y.
| BOOST_AUTO_TEST_CASE | ( | ObjectsAreFieldLocatedNotScanned | ) |
Determinism gate for the DipTrace PCB importer.
Every component, pad, shape, mount hole, and post-component section must be located by a field-derived offset, not by byte-pattern scanning. PCB_PARSER::ScanLocatorUseCount() counts the scan-based locates; a fully deterministic decode reports zero. This mirrors the schematic importer's ComponentBoundaryScanCount() == 0 invariant. The remaining pattern scanners are retained only as recovery fallbacks.
This is the gate for the staged determinism work (see ~/Developer/AGENT/plans/2026-06-01-diptrace-pcb-deterministic-import.md). It currently fails because object/section location is still scan-based; it is driven to zero category-by-category.
Definition at line 244 of file test_diptrace_import.cpp.
References BOOST_CHECK_MESSAGE(), DIPTRACE::PCB_PARSER::ComponentLocatorScans(), DIPTRACE::PCB_PARSER::MountHoleLocatorScans(), name, DIPTRACE::PCB_PARSER::PadLocatorScans(), DIPTRACE::PCB_PARSER::Parse(), path, DIPTRACE::PCB_PARSER::ScanLocatorUseCount(), DIPTRACE::PCB_PARSER::SectionLocatorScans(), and DIPTRACE::PCB_PARSER::ShapeLocatorScans().
| BOOST_AUTO_TEST_CASE | ( | V37TextPositioning | ) |
Load project4.dip (v37) and verify text positioning for the oldest supported format.
Definition at line 609 of file test_diptrace_import.cpp.
References BOOST_REQUIRE(), and VECTOR2< T >::y.
| BOOST_AUTO_TEST_CASE | ( | Z80BoardSettings | ) |
Load z80_board.dip (v45) and verify board copper layer count.
Definition at line 817 of file test_diptrace_import.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), NET_SETTINGS::GetDefaultNetclass(), and BOARD_DESIGN_SETTINGS::m_NetSettings.
| BOOST_AUTO_TEST_CASE | ( | Z80FootprintGraphics | ) |
Load z80_board.dip (v45) and verify footprint graphics still work with the original fixed-record parser path.
Definition at line 487 of file test_diptrace_import.cpp.
References BOOST_REQUIRE(), and PCB_SHAPE_T.
| BOOST_AUTO_TEST_CASE | ( | Z80PolygonPads | ) |
Load z80_board.dip (v45) and verify that polygon/custom pad shapes are imported.
The Z80 board contains pads with C=3 pad style (custom polygon outlines), such as oblong THT pads and circular QFP pads encoded as vertex polygons.
Definition at line 697 of file test_diptrace_import.cpp.
References PADSTACK::ALL_LAYERS, BOOST_REQUIRE(), CUSTOM, and pad.
| BOOST_AUTO_TEST_CASE | ( | Z80RectangularPads | ) |
Load z80_board.dip (v45) and verify that rectangular pads (padStyleC=2) are imported with PAD_SHAPE::RECTANGLE instead of being treated as OVAL.
Definition at line 724 of file test_diptrace_import.cpp.
References PADSTACK::ALL_LAYERS, BOOST_REQUIRE(), pad, and RECTANGLE.
| BOOST_AUTO_TEST_CASE | ( | Z80TextPositioning | ) |
Load z80_board.dip (v45) and verify text positioning is parsed.
Definition at line 551 of file test_diptrace_import.cpp.
References BOOST_REQUIRE(), and VECTOR2< T >::y.