29#include <boost/test/unit_test.hpp>
40namespace fs = std::filesystem;
51 std::ifstream stream( aFeaturesFile );
54 while( std::getline( stream, line ) )
56 if( line.rfind(
"S ", 0 ) == 0 )
81 for(
const fs::directory_entry& entry : fs::recursive_directory_iterator( aRoot ) )
83 if( !entry.is_regular_file() || entry.path().filename() !=
"features" )
86 const std::string layerDir = entry.path().parent_path().filename().string();
88 if( layerDir.find(
"mask" ) == std::string::npos )
116 BOOST_REQUIRE_EQUAL( board->Footprints().size(), 1u );
118 const FOOTPRINT* fp = board->Footprints().front();
129 const fs::path outDir =
130 fs::temp_directory_path() / (
"kicad_qa_odb_soldermask_24690_" +
KIID().
AsString().ToStdString() );
135 std::map<std::string, UTF8> props;
136 props[
"units"] =
"mm";
137 props[
"sigfig"] =
"6";
139 BOOST_REQUIRE_NO_THROW( odbExporter.
SaveBoard( outDir.string(), *board, &props ) );
141 BOOST_REQUIRE_MESSAGE( fs::exists( outDir ),
"ODB++ export produced no output tree" );
143 bool foundMask =
false;
146 BOOST_REQUIRE_MESSAGE( foundMask,
"ODB++ export produced no solder-mask features file" );
148 BOOST_CHECK_MESSAGE( surfaceCount > 0,
"Mask-flagged shape was dropped from the ODB++ export "
149 "(no surface features on the solder-mask layer)" );
151 fs::remove_all( outDir );
General utilities for PCB file IO for QA programs.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
wxString AsString() const
void SaveBoard(const wxString &aFileName, BOARD &aBoard, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Write aBoard to a storage file in a format that this PCB_IO implementation knows about or it can be u...
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
std::unique_ptr< BOARD > ReadBoardFromFileOrStream(const std::string &aFilename, std::istream &aFallback)
Read a board from a file, or another stream, as appropriate.
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_CASE(OdbSolderMaskShapeExport)
Regression guard for GitLab #24690: a footprint polygon on a copper layer with the "Solder mask" flag...
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.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers