KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_odb_soldermask_shape_export.cpp File Reference
#include <filesystem>
#include <fstream>
#include <memory>
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <boost/test/unit_test.hpp>
#include <base_units.h>
#include <board.h>
#include <footprint.h>
#include <kiid.h>
#include <pcb_shape.h>
#include <pcbnew/pcb_io/odbpp/pcb_io_odbpp.h>
#include <settings/settings_manager.h>
#include <core/utf8.h>

Go to the source code of this file.

Functions

static int countOdbSurfaceRecords (const fs::path &aFeaturesFile)
 Count surface ("S ") feature records in a single ODB++ "features" file.
 
static int countMaskSurfaceRecords (const fs::path &aRoot, bool &aFoundFile)
 Sum surface ("S ") feature records across every solder-mask "features" file in an ODB++ tree.
 
 BOOST_AUTO_TEST_CASE (OdbSolderMaskShapeExport)
 Regression guard for GitLab #24690: a footprint polygon on a copper layer with the "Solder mask" flag set must knock a mask opening out of the ODB++ export, matching the Gerber output.
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE()

BOOST_AUTO_TEST_CASE ( OdbSolderMaskShapeExport )

Regression guard for GitLab #24690: a footprint polygon on a copper layer with the "Solder mask" flag set must knock a mask opening out of the ODB++ export, matching the Gerber output.

The mask-layer assignment loops in ODB_STEP_ENTITY::MakeLayerEntity() previously bucketed footprint graphics and board drawings by their single GetLayer(), so a mask-flagged shape never reached the F_Mask layer and the opening was silently dropped.

Definition at line 102 of file test_odb_soldermask_shape_export.cpp.

References KIID::AsString(), BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), countMaskSurfaceRecords(), Edge_Cuts, F_Cu, F_Mask, FOOTPRINT, PCB_SHAPE::IsOnLayer(), pcbIUScale, POLY, PCB_IO_ODBPP::SaveBoard(), SEGMENT, PCB_SHAPE::SetEnd(), EDA_SHAPE::SetFilled(), PCB_SHAPE::SetHasSolderMask(), PCB_SHAPE::SetLayer(), EDA_SHAPE::SetPolyPoints(), PCB_SHAPE::SetStart(), and PCB_SHAPE::SetWidth().

◆ countMaskSurfaceRecords()

static int countMaskSurfaceRecords ( const fs::path & aRoot,
bool & aFoundFile )
static

Sum surface ("S ") feature records across every solder-mask "features" file in an ODB++ tree.

Both front and back mask layers produce a directory whose name contains "mask", so a search that stops at the first match would depend on unspecified std::filesystem iteration order. The shape under test sits on the front mask, so picking the empty back-mask file first would spuriously report zero. Aggregating across all mask layers keeps the check order-independent while matching by substring to stay robust against ODB++ naming changes.

aFoundFile is set when at least one mask features file exists, so the caller can still assert the export produced a solder-mask layer at all.

Definition at line 72 of file test_odb_soldermask_shape_export.cpp.

References countOdbSurfaceRecords().

Referenced by BOOST_AUTO_TEST_CASE().

◆ countOdbSurfaceRecords()

static int countOdbSurfaceRecords ( const fs::path & aFeaturesFile)
static

Count surface ("S ") feature records in a single ODB++ "features" file.

A filled polygon reaches the feature stream as a surface record, so a non-zero count on a solder-mask layer proves the mask opening was emitted.

Definition at line 44 of file test_odb_soldermask_shape_export.cpp.

Referenced by countMaskSurfaceRecords().