|
KiCad PCB EDA Suite
|
Test suite for import of pre-v6 binary Eagle *.brd board 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/eagle/pcb_io_eagle.h>#include <board.h>#include <footprint.h>#include <netinfo.h>#include <pad.h>#include <pcb_shape.h>#include <pcb_text.h>#include <pcb_track.h>#include <zone.h>#include <algorithm>#include <map>#include <set>#include <vector>#include <wx/filename.h>Go to the source code of this file.
Classes | |
| struct | EAGLE_BINARY_IMPORT_FIXTURE |
Functions | |
| BOOST_AUTO_TEST_CASE (LoadBinaryV4V5) | |
| Load a v4/v5 binary board (magic 0x10 0x00) which also carries the trailing free-text and DRC sections. | |
| BOOST_AUTO_TEST_CASE (LoadBinaryV3) | |
| Load a v3 binary board (magic 0x10 0x80). | |
| BOOST_AUTO_TEST_CASE (LoadV3CustomAttributes) | |
| Regression test for custom element attributes. | |
| BOOST_AUTO_TEST_CASE (LoadV3UnnamedSignals) | |
| Regression test for unnamed (auto-generated) signals. | |
| BOOST_AUTO_TEST_CASE (LoadV4V5DegeneratePolygons) | |
| Regression test for degenerate (vertex-less) polygons. | |
| BOOST_AUTO_TEST_CASE (LoadBinaryLongText) | |
| A text string too long for the 6-byte inline field is stored as a 0x7F marker plus a pointer into the trailing free-text section, which readNotes() and resolveLongPointers() reassemble. | |
| BOOST_AUTO_TEST_CASE (LoadV3FootprintRotationRing) | |
| Regression test for the binary rotation decode. | |
| BOOST_AUTO_TEST_CASE (LoadDropsUnmappedLayers) | |
| Regression test for unmapped Eagle layers. | |
| BOOST_AUTO_TEST_CASE (LoadRoutesSmashedValueText) | |
| Regression test for the six-byte inline text field. | |
| BOOST_AUTO_TEST_CASE (LoadV3CopperPourPolygons) | |
| Regression test for copper pour polygons. | |
| BOOST_AUTO_TEST_CASE (LoadIssue24827PadNamesAndSignals) | |
| Regression test for issue 24827. | |
| BOOST_AUTO_TEST_CASE (LoadIssue24827PadShapes) | |
| Regression test for the pad shapes in issue 24827. | |
| BOOST_AUTO_TEST_CASE (LoadIssue24827CurvedWireArcs) | |
| Regression test for the curved-wire arcs in issue 24827. | |
Test suite for import of pre-v6 binary Eagle *.brd board files.
Definition in file test_eagle_binary_import.cpp.
| BOOST_AUTO_TEST_CASE | ( | LoadBinaryLongText | ) |
A text string too long for the 6-byte inline field is stored as a 0x7F marker plus a pointer into the trailing free-text section, which readNotes() and resolveLongPointers() reassemble.
Both asserted strings exceed the inline field, so neither can survive the import unless that indirection resolves.
Definition at line 194 of file test_eagle_binary_import.cpp.
References BOOST_REQUIRE(), and text.
| BOOST_AUTO_TEST_CASE | ( | LoadBinaryV3 | ) |
Load a v3 binary board (magic 0x10 0x80).
v3 files have no DRC or free-text sections, so this exercises the graceful-fallback path where the trailing sections are absent.
Definition at line 123 of file test_eagle_binary_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | LoadBinaryV4V5 | ) |
Load a v4/v5 binary board (magic 0x10 0x00) which also carries the trailing free-text and DRC sections.
This load is the smoke test: the binary stream is decoded into a synthesized XML DOM and then walked by the shared XML loader.
Definition at line 107 of file test_eagle_binary_import.cpp.
References BOOST_AUTO_TEST_CASE(), and BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | LoadDropsUnmappedLayers | ) |
Regression test for unmapped Eagle layers.
Layers with no automatic KiCad target (Eagle tRestrict/bRestrict/vRestrict/Measures and similar) resolve to UNSELECTED_LAYER during a headless import, where no dialog can remap them. The item loaders only skipped UNDEFINED_LAYER, so graphics on those layers were stranded on the out-of-range UNSELECTED_LAYER (-2). Restrict layers carry keepout shapes, which must survive as rule areas even though they have no graphic layer; only the genuinely unmappable graphics are dropped. boomchak and turnemoff exercise both halves.
Definition at line 261 of file test_eagle_binary_import.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), and PCB_LAYER_ID_COUNT.
| BOOST_AUTO_TEST_CASE | ( | LoadIssue24827CurvedWireArcs | ) |
Regression test for the curved-wire arcs in issue 24827.
A curved wire stores its arc center as three bytes interleaved with the endpoint fields; the decoder combined them with a byte bias that neither recovered the stored byte nor formed a valid 24-bit value, so the center landed far from the body. The TO-92 transistor outlines were the visible casualty: Q2's rounded back flattened and IC3's sides caved inward. Both packages draw their silk body as concentric arcs of one circle, so a correct decode leaves every body arc sharing a center and radius.
Definition at line 474 of file test_eagle_binary_import.cpp.
References ARC, BOOST_REQUIRE(), center, F_SilkS, PCB_SHAPE::GetLayer(), EDA_SHAPE::GetShape(), and pcbIUScale.
| BOOST_AUTO_TEST_CASE | ( | LoadIssue24827PadNamesAndSignals | ) |
Regression test for issue 24827.
Eagle 4.x pad and SMD records carry the same rotation word and offset-19 name as the 5.x layout, but their signature clears the bits that distinguished the two layouts, so every pad bound the Eagle 3.x short row and read an empty name. Contactrefs resolve to a pad by name, so all of an element's pads collapsed onto whichever signal was written last, wiring every multi-pin part to a single net. brenner57e is a 4.x board; a correct decode names each pad and keeps its signals distinct.
Definition at line 392 of file test_eagle_binary_import.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), and pad.
| BOOST_AUTO_TEST_CASE | ( | LoadIssue24827PadShapes | ) |
Regression test for the pad shapes in issue 24827.
The binary stores a pad's shape as an ordinal, but the shared XML reader matches it by name and falls back to round for anything else, so every through-hole pad imported as a circle. The ordinal maps one-to-one to the reader's shape names: brenner57e's 0207 resistors carry octagon pads (imported as chamfered rectangles) and its TO-92 transistors oblong pads (imported as ovals), which also pins down the mapping direction.
Definition at line 440 of file test_eagle_binary_import.cpp.
References PADSTACK::ALL_LAYERS, BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), CHAMFERED_RECT, CIRCLE, and OVAL.
| BOOST_AUTO_TEST_CASE | ( | LoadRoutesSmashedValueText | ) |
Regression test for the six-byte inline text field.
Eagle stores a text-family record's string in the final six bytes of its 24-byte block; the decoder read only five, so the six-character ">VALUE" arrived as ">VALU". That truncated string missed the ">VALUE" special case and fell through to the generic variable substitution, producing the unresolvable "${VALU}" placeholder the DRC flagged. blink1_b1a places ">VALUE" on several footprints, so a correct decode routes each into the footprint value field and never emits the truncated placeholder.
Definition at line 322 of file test_eagle_binary_import.cpp.
References BOOST_REQUIRE(), and text.
| BOOST_AUTO_TEST_CASE | ( | LoadV3CopperPourPolygons | ) |
Regression test for copper pour polygons.
Eagle stores a polygon outline as a chain of connected wire segments, but the XML reader expects <vertex> nodes; the binary decoder emitted the raw wires, so loadPolygon() saw zero vertices and dropped every pour ("less than 3 vertices"). The decoder now rebuilds the vertices from the segment start points. boomchak carries two signal pours on copper (Eagle layers 1 and 16).
Definition at line 357 of file test_eagle_binary_import.cpp.
References BOOST_CHECK_EQUAL(), and BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | LoadV3CustomAttributes | ) |
Regression test for custom element attributes.
The binary attribute record has no name field, so the decoder once emitted nameless <attribute> nodes that the shared XML reader rejected ("required attribute name is missing"). The decoder now drops those unrecoverable nodes, so the board loads.
Definition at line 139 of file test_eagle_binary_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | LoadV3FootprintRotationRing | ) |
Regression test for the binary rotation decode.
boomchak places LED1..LED16 in a ring spaced 22.5 degrees apart. The original decoder routed every angle below 90 degrees through a v3 fallback that masked the wrong nibble, collapsing LED2, LED3 and LED4 onto a single 180 degree orientation; the angle is now read as the full-circle / 4096 fixed-point value the format stores for all versions.
Definition at line 219 of file test_eagle_binary_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | LoadV3UnnamedSignals | ) |
Regression test for unnamed (auto-generated) signals.
Their empty net name collided with the reserved unconnected net, so the net code requested for every item routed on them was never registered, tripping the m_netinfo assertion in BOARD_CONNECTED_ITEM::SetNetCode(). Unnamed nets now get a unique fallback name and items take the net code the board actually assigned.
Definition at line 157 of file test_eagle_binary_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | LoadV4V5DegeneratePolygons | ) |
Regression test for degenerate (vertex-less) polygons.
A package polygon with no vertices dereferenced an empty vertex list in packagePolygon(); the loader now skips polygons with fewer than three vertices, matching loadPolygon().
Definition at line 178 of file test_eagle_binary_import.cpp.
References BOOST_REQUIRE().