KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_odb_dimension_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 <kiid.h>
#include <pcb_dimension.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 countOdbLineRecords (const fs::path &aFeaturesFile)
 Count line ("L ") feature records in a single ODB++ "features" file.
 
static int countSilkLineRecords (const fs::path &aRoot, bool &aFoundFile)
 Sum line ("L ") feature records across every silkscreen "features" file in an ODB++ export tree.
 
 BOOST_AUTO_TEST_CASE (OdbDimensionExport)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE()

◆ countOdbLineRecords()

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

Count line ("L ") feature records in a single ODB++ "features" file.

A dimension's extension lines, crossbar and arrowheads are emitted as line records, so a non-zero count in the silkscreen layer proves the dimension reached the feature stream (regression guard for GitLab #20249, where the PCB_DIM_*_T cases were stubbed out of the ODB++ feature generator).

Definition at line 46 of file test_odb_dimension_export.cpp.

Referenced by countSilkLineRecords().

◆ countSilkLineRecords()

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

Sum line ("L ") feature records across every silkscreen "features" file in an ODB++ export tree.

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

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

Definition at line 74 of file test_odb_dimension_export.cpp.

References countOdbLineRecords().

Referenced by BOOST_AUTO_TEST_CASE().