27#include <boost/test/unit_test.hpp>
37namespace fs = std::filesystem;
50 std::ifstream stream( aFeaturesFile );
53 while( std::getline( stream, line ) )
55 if( line.rfind(
"L ", 0 ) == 0 )
80 for(
const fs::directory_entry& entry : fs::recursive_directory_iterator( aRoot ) )
82 if( !entry.is_regular_file() || entry.path().filename() !=
"features" )
85 const std::string layerDir = entry.path().parent_path().filename().string();
87 if( layerDir.find(
"silk" ) == std::string::npos )
107 for(
const BOARD_ITEM* item : board->Drawings() )
119 std::map<std::string, UTF8> props;
120 props[
"units"] =
"mm";
121 props[
"sigfig"] =
"6";
123 BOOST_REQUIRE_NO_THROW( odbExporter.
SaveBoard( outDir.
Path().string(), *board, &props ) );
125 BOOST_REQUIRE_MESSAGE( fs::exists( outDir.
Path() ),
"ODB++ export produced no output tree" );
127 bool foundSilk =
false;
130 BOOST_REQUIRE_MESSAGE( foundSilk,
"ODB++ export produced no silkscreen features file" );
132 BOOST_CHECK_MESSAGE( lineCount > 0,
133 "Dimensions were dropped from the ODB++ export (no line features emitted)" );
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...
const std::filesystem::path & Path() const
Get the path to the temporary directory as a std::filesystem::path.
const std::vector< std::shared_ptr< SHAPE > > & GetShapes() 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::unique_ptr< BOARD > RequireBoardFromPcbnewQAData(const std::filesystem::path &aFilename)
Require a board from the path relative to the pcbnew QA data directory.
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
static int countOdbLineRecords(const fs::path &aFeaturesFile)
Count line ("L ") feature records in a single ODB++ "features" file.
BOOST_AUTO_TEST_CASE(OdbDimensionExport)
static int countSilkLineRecords(const fs::path &aRoot, bool &aFoundFile)
Sum line ("L ") feature records across every silkscreen "features" file in an ODB++ export tree.
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)