26#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 )
110 for(
const BOARD_ITEM* item : board->Drawings() )
119 const fs::path outDir = fs::temp_directory_path()
120 / (
"kicad_qa_odb_dimension_20249_" +
KIID().
AsString().ToStdString() );
125 std::map<std::string, UTF8> props;
126 props[
"units"] =
"mm";
127 props[
"sigfig"] =
"6";
129 BOOST_REQUIRE_NO_THROW( odbExporter.
SaveBoard( outDir.string(), *board, &props ) );
131 BOOST_REQUIRE_MESSAGE( fs::exists( outDir ),
"ODB++ export produced no output tree" );
133 bool foundSilk =
false;
136 BOOST_REQUIRE_MESSAGE( foundSilk,
"ODB++ export produced no silkscreen features file" );
138 BOOST_CHECK_MESSAGE( lineCount > 0,
139 "Dimensions were dropped from the ODB++ export (no line features emitted)" );
141 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
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::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())
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)