38 const std::filesystem::path boardPath =
43 const std::filesystem::path outputRoot =
44 std::filesystem::temp_directory_path() /
"kicad_pdf_single_doc_test";
45 const std::filesystem::path outputPath =
46 outputRoot /
"Assembly" /
"Assembly_output.pdf";
48 if( std::filesystem::exists( outputRoot ) )
49 std::filesystem::remove_all( outputRoot );
51 auto pdfJob = std::make_unique<JOB_EXPORT_PCB_PDF>();
52 pdfJob->m_filename = wxString::FromUTF8( boardPath.string().c_str() );
53 pdfJob->SetConfiguredOutputPath( wxString::FromUTF8( outputPath.string().c_str() ) );
54 pdfJob->m_plotDrawingSheet =
false;
55 pdfJob->m_pdfSingle =
true;
57 pdfJob->m_plotLayerSequence =
LSEQ( {
F_Cu } );
62 BOOST_CHECK( std::filesystem::exists( outputPath ) );
63 BOOST_CHECK( std::filesystem::is_regular_file( outputPath ) );
65 const std::filesystem::path nestedPdf =
66 outputPath / ( boardPath.stem().
string() +
".pdf" );
67 BOOST_CHECK( !std::filesystem::exists( nestedPdf ) );
69 std::filesystem::remove_all( outputRoot );
78 const std::filesystem::path boardPath =
82 const std::filesystem::path outputRoot =
83 std::filesystem::temp_directory_path() /
"kicad_pdf_trailing_disabled_test";
84 const std::filesystem::path outputPath = outputRoot /
"out.pdf";
86 if( std::filesystem::exists( outputRoot ) )
87 std::filesystem::remove_all( outputRoot );
89 auto pdfJob = std::make_unique<JOB_EXPORT_PCB_PDF>();
90 pdfJob->m_filename = wxString::FromUTF8( boardPath.string().c_str() );
91 pdfJob->SetConfiguredOutputPath( wxString::FromUTF8( outputPath.string().c_str() ) );
92 pdfJob->m_plotDrawingSheet =
false;
93 pdfJob->m_pdfSingle =
true;
104 std::ifstream in( outputPath, std::ios::binary );
105 std::string pdf( ( std::istreambuf_iterator<char>( in ) ), std::istreambuf_iterator<char>() );
107 size_t pageCount = 0;
109 for(
size_t pos = pdf.find(
"/Type /Page\n" ); pos != std::string::npos;
110 pos = pdf.find(
"/Type /Page\n", pos + 1 ) )
115 std::filesystem::remove_all( outputRoot );
wxString result
Test unit parsing edge cases and error handling.
BOOST_CHECK_EQUAL(result, "25.4")