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

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 <pcb_text.h>
#include <pcb_track.h>
#include <zone.h>
#include <map>
#include <set>
#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.
 

Detailed Description

Test suite for import of pre-v6 binary Eagle *.brd board files.

Definition in file test_eagle_binary_import.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/9]

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 190 of file test_eagle_binary_import.cpp.

References text.

◆ BOOST_AUTO_TEST_CASE() [2/9]

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 109 of file test_eagle_binary_import.cpp.

◆ BOOST_AUTO_TEST_CASE() [3/9]

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 91 of file test_eagle_binary_import.cpp.

References BOOST_AUTO_TEST_CASE().

◆ BOOST_AUTO_TEST_CASE() [4/9]

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 285 of file test_eagle_binary_import.cpp.

References BOOST_CHECK_EQUAL(), and PCB_LAYER_ID_COUNT.

◆ BOOST_AUTO_TEST_CASE() [5/9]

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 127 of file test_eagle_binary_import.cpp.

◆ BOOST_AUTO_TEST_CASE() [6/9]

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 241 of file test_eagle_binary_import.cpp.

◆ BOOST_AUTO_TEST_CASE() [7/9]

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 221 of file test_eagle_binary_import.cpp.

◆ BOOST_AUTO_TEST_CASE() [8/9]

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 147 of file test_eagle_binary_import.cpp.

◆ BOOST_AUTO_TEST_CASE() [9/9]

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 170 of file test_eagle_binary_import.cpp.