59 BOOST_REQUIRE_MESSAGE( std::filesystem::exists( sourceBoard ),
"Missing test board " << sourceBoard );
64 const size_t originalCount = board->Footprints().size();
65 BOOST_REQUIRE_MESSAGE( originalCount > 1,
"Panel board needs multiple footprints to delete" );
70 const std::filesystem::path& onDisk = workDir.
Path() /
"panel.kicad_pcb";
72 const wxString onDiskPath = wxString::FromUTF8( onDisk.string() );
76 std::filesystem::path projectFile = onDisk;
77 projectFile.replace_extension(
".kicad_pro" );
80 std::ofstream
project( projectFile );
82 project <<
"{ \"meta\": { \"version\": 1 } }\n";
86 while( board->Footprints().size() > 1 )
87 board->Remove( board->Footprints().back() );
89 const size_t remainingCount = board->Footprints().size();
90 BOOST_REQUIRE_EQUAL( remainingCount, 1u );
94 std::vector<wxString> tempFiles;
96 const wxString error =
99 BOOST_REQUIRE_MESSAGE( error.IsEmpty(),
"StageBoardForExport failed: " << error.ToStdString() );
101 BOOST_CHECK_MESSAGE( inputPath != onDiskPath,
"Modified board must stage a temporary copy, not the on-disk file" );
110 std::filesystem::path stagedProject = std::filesystem::path( std::string( inputPath.utf8_str() ) );
111 stagedProject.replace_extension(
".kicad_pro" );
112 BOOST_CHECK( std::filesystem::exists( stagedProject ) );
113 BOOST_CHECK_EQUAL( std::filesystem::file_size( stagedProject ), std::filesystem::file_size( projectFile ) );
120 for(
const wxString& f : tempFiles )
122 if( wxFileExists( f ) )
138 const wxString onDiskPath = wxString::FromUTF8( sourceBoard );
141 std::vector<wxString> tempFiles;
142 wxString errorDetail;
144 tempFiles, errorDetail );
146 BOOST_CHECK( error.IsEmpty() );
148 BOOST_CHECK( tempFiles.empty() );
163 std::vector<wxString> tempFiles;
164 wxString errorDetail;
166 tempFiles, errorDetail );
168 BOOST_CHECK( !error.IsEmpty() );
169 BOOST_CHECK( inputPath.IsEmpty() );
170 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")