|
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 <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) | |
| Regression test for inline long-text (0x3200) records. | |
| BOOST_AUTO_TEST_CASE (LoadV3RecursiveCountOverrun) | |
| Regression test for an over-counted recursive subsection. | |
| 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 (LoadIssue24812CopperPours) | |
| Regression test for issue 24812. | |
| 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 | ) |
Regression test for inline long-text (0x3200) records.
A text string longer than the 5-byte inline field is stored as an empty text record followed by a 0x3200 longtext record carrying the full string. The decoder once had no row for 0x3200 and aborted with "Unknown Eagle binary block id 0x3200"; it now folds the string onto the preceding text item. Each asserted string exceeds the inline field, so it can only originate from a 0x3200 record.
Definition at line 206 of file test_eagle_binary_import.cpp.
References 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 125 of file test_eagle_binary_import.cpp.
| 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().
| 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 301 of file test_eagle_binary_import.cpp.
References BOOST_CHECK_EQUAL(), and PCB_LAYER_ID_COUNT.
| BOOST_AUTO_TEST_CASE | ( | LoadIssue24812CopperPours | ) |
Regression test for issue 24812.
This 5.12 Professional board's two copper pours were reported missing after import because their outline wire segments were never rebuilt as vertices. The board is not license-clean and is not committed, so this loads only when the sample is present locally.
Definition at line 428 of file test_eagle_binary_import.cpp.
| 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 536 of file test_eagle_binary_import.cpp.
References ARC, BOOST_CHECK_MESSAGE(), 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. The board is not license-clean and is not committed, so this loads only when present locally.
Definition at line 449 of file test_eagle_binary_import.cpp.
References BOOST_CHECK_EQUAL(), 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. Local-only, like the sibling test.
Definition at line 500 of file test_eagle_binary_import.cpp.
References PADSTACK::ALL_LAYERS, BOOST_CHECK_EQUAL(), 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 364 of file test_eagle_binary_import.cpp.
References 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 401 of file test_eagle_binary_import.cpp.
References BOOST_CHECK_EQUAL().
| 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 143 of file test_eagle_binary_import.cpp.
| 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 257 of file test_eagle_binary_import.cpp.
| BOOST_AUTO_TEST_CASE | ( | LoadV3RecursiveCountOverrun | ) |
Regression test for an over-counted recursive subsection.
This board's signal subsection declares more recursive children than the stream actually holds, so the count-driven block walk ran off the end of the block stream and reached the trailing free-text sentinel (0x1312), which is not a block and aborted the load with "Unknown Eagle binary block id". The walk now stops when it reaches the free-text section instead of treating it as another block.
Definition at line 237 of file test_eagle_binary_import.cpp.
| 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 163 of file test_eagle_binary_import.cpp.
| 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 186 of file test_eagle_binary_import.cpp.