59 BOOST_REQUIRE_MESSAGE( std::filesystem::exists( sourceBoard ),
"Missing test board " << sourceBoard );
63 const size_t originalCount = board->Footprints().size();
64 BOOST_REQUIRE_MESSAGE( originalCount > 1,
"Panel board needs multiple footprints to delete" );
69 const std::filesystem::path& onDisk = workDir.
Path() /
"panel.kicad_pcb";
71 const wxString onDiskPath = wxString::FromUTF8( onDisk.string() );
75 std::filesystem::path projectFile = onDisk;
76 projectFile.replace_extension(
".kicad_pro" );
79 std::ofstream
project( projectFile );
81 project <<
"{ \"meta\": { \"version\": 1 } }\n";
85 while( board->Footprints().size() > 1 )
86 board->Remove( board->Footprints().back() );
88 const size_t remainingCount = board->Footprints().size();
89 BOOST_REQUIRE_EQUAL( remainingCount, 1u );
93 std::vector<wxString> tempFiles;
95 const wxString error =
98 BOOST_REQUIRE_MESSAGE( error.IsEmpty(),
"StageBoardForExport failed: " << error.ToStdString() );
100 BOOST_CHECK_MESSAGE( inputPath != onDiskPath,
"Modified board must stage a temporary copy, not the on-disk file" );
109 std::filesystem::path stagedProject = std::filesystem::path( std::string( inputPath.utf8_str() ) );
110 stagedProject.replace_extension(
".kicad_pro" );
111 BOOST_CHECK( std::filesystem::exists( stagedProject ) );
112 BOOST_CHECK_EQUAL( std::filesystem::file_size( stagedProject ), std::filesystem::file_size( projectFile ) );
119 for(
const wxString& f : tempFiles )
121 if( wxFileExists( f ) )
136 const wxString onDiskPath = wxString::FromUTF8( sourceBoard );
139 std::vector<wxString> tempFiles;
140 wxString errorDetail;
142 tempFiles, errorDetail );
144 BOOST_CHECK( error.IsEmpty() );
146 BOOST_CHECK( tempFiles.empty() );
158 std::vector<wxString> tempFiles;
159 wxString errorDetail;
161 tempFiles, errorDetail );
163 BOOST_CHECK( !error.IsEmpty() );
164 BOOST_CHECK( inputPath.IsEmpty() );
165 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")