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

Test suite for IPC-2581 export validation. 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/ipc2581/pcb_io_ipc2581.h>
#include <pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <board.h>
#include <board_design_settings.h>
#include <board_stackup_manager/board_stackup.h>
#include <footprint.h>
#include <pad.h>
#include <wx/dir.h>
#include <wx/file.h>
#include <wx/filename.h>
#include <wx/process.h>
#include <wx/txtstrm.h>
#include <fstream>
#include <sstream>

Go to the source code of this file.

Classes

struct  IPC2581_EXPORT_FIXTURE
 

Functions

 BOOST_AUTO_TEST_CASE (SurfaceFinishExport)
 Test that surface finish is exported correctly (Issue #22690)
 
 BOOST_AUTO_TEST_CASE (NoSurfaceFinishExport)
 Test that boards without surface finish don't generate coating layers.
 
 BOOST_AUTO_TEST_CASE (SchemaValidationVersionB)
 Validate IPC-2581B export against schema for multiple boards.
 
 BOOST_AUTO_TEST_CASE (SchemaValidationVersionC)
 Validate IPC-2581C export against schema for multiple boards.
 
 BOOST_AUTO_TEST_CASE (ComplexBoardExport)
 Test export of boards with complex features.
 
 BOOST_AUTO_TEST_CASE (SmdPadSolderMaskExport_Issue16658)
 Test that SMD pad solder mask openings are exported (Issue #16658)
 
, or PinRef/@componentRef attributes, which are

Test that footprints with empty references produce valid XML attributes.

Footprints with blank GetReference() must not produce empty refDes, RefDes/ schema-invalid qualified names.

 BOOST_AUTO_TEST_CASE (EmptyRefDesProducesValidXml)
 
 BOOST_AUTO_TEST_CASE (FlippedComponentRotation)
 Test that flipped component rotation is not inverted (Finding A / Issue #18013)
 
 BOOST_AUTO_TEST_CASE (ContentBomRef)
 Test that Content section includes BomRef when BOM is emitted.
 

Detailed Description

Test suite for IPC-2581 export validation.

Tests per GitLab issues:

  • #22690: Surface finish data not exported
  • #19912: OtherSideView may be incorrect for bottom components

Definition in file test_ipc2581_export.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/9]

BOOST_AUTO_TEST_CASE ( ComplexBoardExport )

Test export of boards with complex features.

Tests boards with zones, custom pads, and other features that may exercise edge cases in the IPC-2581 exporter.

Definition at line 417 of file test_ipc2581_export.cpp.

References BOOST_TEST_CONTEXT(), and LoadBoard().

◆ BOOST_AUTO_TEST_CASE() [2/9]

BOOST_AUTO_TEST_CASE ( ContentBomRef )

Test that Content section includes BomRef when BOM is emitted.

Definition at line 615 of file test_ipc2581_export.cpp.

References BOOST_REQUIRE(), and LoadBoard().

◆ BOOST_AUTO_TEST_CASE() [3/9]

BOOST_AUTO_TEST_CASE ( EmptyRefDesProducesValidXml )

Definition at line 530 of file test_ipc2581_export.cpp.

References BOOST_REQUIRE(), BOOST_TEST_CONTEXT(), and LoadBoard().

◆ BOOST_AUTO_TEST_CASE() [4/9]

BOOST_AUTO_TEST_CASE ( FlippedComponentRotation )

Test that flipped component rotation is not inverted (Finding A / Issue #18013)

IPC-2581C 3.3.2 defines positive rotation as CCW from board top. mirror="true" handles the X-axis negation for bottom components. The component rotation must be the normalized board-top angle, NOT its inverse.

Definition at line 570 of file test_ipc2581_export.cpp.

References BOOST_REQUIRE(), and LoadBoard().

◆ BOOST_AUTO_TEST_CASE() [5/9]

BOOST_AUTO_TEST_CASE ( NoSurfaceFinishExport )

Test that boards without surface finish don't generate coating layers.

Definition at line 287 of file test_ipc2581_export.cpp.

References BOOST_REQUIRE(), LoadBoard(), and BOARD_STACKUP::m_FinishType.

◆ BOOST_AUTO_TEST_CASE() [6/9]

BOOST_AUTO_TEST_CASE ( SchemaValidationVersionB )

Validate IPC-2581B export against schema for multiple boards.

This test exports each board in VALIDATION_TEST_BOARDS to IPC-2581B format and validates against the IPC-2581B1.xsd schema using xmllint (if available).

Definition at line 331 of file test_ipc2581_export.cpp.

References BOOST_TEST_CONTEXT(), and LoadBoard().

◆ BOOST_AUTO_TEST_CASE() [7/9]

BOOST_AUTO_TEST_CASE ( SchemaValidationVersionC )

Validate IPC-2581C export against schema for multiple boards.

This test exports each board in VALIDATION_TEST_BOARDS to IPC-2581C format and validates against the IPC-2581C.xsd schema using xmllint (if available).

Definition at line 374 of file test_ipc2581_export.cpp.

References BOOST_TEST_CONTEXT(), and LoadBoard().

◆ BOOST_AUTO_TEST_CASE() [8/9]

BOOST_AUTO_TEST_CASE ( SmdPadSolderMaskExport_Issue16658 )

Test that SMD pad solder mask openings are exported (Issue #16658)

This test verifies that SMD pads which have implicit solder mask openings (pads on copper layers that don't explicitly include F_Mask/B_Mask in their layer set) still get exported with solder mask features in the IPC-2581 output.

Definition at line 462 of file test_ipc2581_export.cpp.

References BOOST_REQUIRE(), F_Cu, F_Mask, LoadBoard(), pad, and SMD.

◆ BOOST_AUTO_TEST_CASE() [9/9]

BOOST_AUTO_TEST_CASE ( SurfaceFinishExport )

Test that surface finish is exported correctly (Issue #22690)

This test verifies that when a board has a surface finish defined:

  1. A Spec element with SurfaceFinish is created
  2. COATING_TOP and COATING_BOTTOM Layer elements are created with layerFunction="COATINGCOND"
  3. StackupLayer entries reference the surface finish Spec

Definition at line 239 of file test_ipc2581_export.cpp.

References BOOST_AUTO_TEST_CASE(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), LoadBoard(), and BOARD_STACKUP::m_FinishType.