93 BOOST_REQUIRE_MESSAGE( std::filesystem::exists( sourceBoard ),
"Missing test board " << sourceBoard );
98 const size_t originalCount = board->Footprints().size();
99 BOOST_REQUIRE_MESSAGE( originalCount > 1,
"Panel board needs multiple footprints to delete" );
103 const SCOPED_TEMP_DIR workDir( wxS(
"kicad_step_export_23704_" ) );
104 const std::filesystem::path onDisk = workDir.Path() /
"panel.kicad_pcb";
106 const wxString onDiskPath = wxString::FromUTF8( onDisk.string() );
110 std::filesystem::path projectFile = onDisk;
111 projectFile.replace_extension(
".kicad_pro" );
114 std::ofstream
project( projectFile );
116 project <<
"{ \"meta\": { \"version\": 1 } }\n";
120 while( board->Footprints().size() > 1 )
121 board->Remove( board->Footprints().back() );
123 const size_t remainingCount = board->Footprints().size();
124 BOOST_REQUIRE_EQUAL( remainingCount, 1u );
128 std::vector<wxString> tempFiles;
129 wxString errorDetail;
130 const wxString error =
133 BOOST_REQUIRE_MESSAGE( error.IsEmpty(),
"StageBoardForExport failed: " << error.ToStdString() );
135 BOOST_CHECK_MESSAGE( inputPath != onDiskPath,
"Modified board must stage a temporary copy, not the on-disk file" );
144 std::filesystem::path stagedProject = std::filesystem::path( std::string( inputPath.utf8_str() ) );
145 stagedProject.replace_extension(
".kicad_pro" );
146 BOOST_CHECK( std::filesystem::exists( stagedProject ) );
147 BOOST_CHECK_EQUAL( std::filesystem::file_size( stagedProject ), std::filesystem::file_size( projectFile ) );
154 for(
const wxString& f : tempFiles )
156 if( wxFileExists( f ) )
172 const wxString onDiskPath = wxString::FromUTF8( sourceBoard );
175 std::vector<wxString> tempFiles;
176 wxString errorDetail;
178 tempFiles, errorDetail );
180 BOOST_CHECK( error.IsEmpty() );
182 BOOST_CHECK( tempFiles.empty() );
197 std::vector<wxString> tempFiles;
198 wxString errorDetail;
200 tempFiles, errorDetail );
202 BOOST_CHECK( !error.IsEmpty() );
203 BOOST_CHECK( inputPath.IsEmpty() );
204 BOOST_CHECK( tempFiles.empty() );
static wxString StageBoardForExport(const wxString &aBoardPath, bool aContentModified, BOARD *aBoard, wxString &aInputPath, std::vector< wxString > &aTempFiles, wxString &aErrorDetail)
Resolve the board file to hand to the external 3D/STEP exporter.
std::unique_ptr< BOARD > ReadBoardFromFileOrStream(const std::string &aFilename, std::istream &aFallback)
Read a board from a file, or another stream, as appropriate.
BOOST_CHECK_EQUAL(result, "25.4")