45bool textFilesMatch(
const wxString& aGoldenPath,
const wxString& aGeneratedPath,
int aSkipLines )
47 std::ifstream goldenStream( aGoldenPath.ToStdString() );
48 std::ifstream generatedStream( aGeneratedPath.ToStdString() );
50 if( !goldenStream.is_open() )
56 if( !generatedStream.is_open() )
62 std::string goldenLine, generatedLine;
64 for(
int i = 0; i < aSkipLines; ++i )
66 std::getline( goldenStream, goldenLine );
67 std::getline( generatedStream, generatedLine );
70 int lineNum = aSkipLines + 1;
72 while( std::getline( goldenStream, goldenLine ) )
74 if( !std::getline( generatedStream, generatedLine ) )
80 if( goldenLine != generatedLine )
83 <<
" golden: " << goldenLine <<
"\n"
84 <<
" generated: " << generatedLine );
91 if( std::getline( generatedStream, generatedLine ) )
144 BOOST_REQUIRE_MESSAGE( Start(), LastError() );
146 wxString testDataDir =
149 wxFileName boardPath( testDataDir, wxS(
"ZoneFill-4.0.7.kicad_pcb" ) );
151 kiapi::common::types::DocumentSpecifier document;
153 BOOST_REQUIRE_MESSAGE( Client().OpenDocument( boardPath.GetFullPath(), &document ),
154 "OpenDocument failed: " + Client().LastError() );
158 wxFileName outputPath( tempDir.
ChildPathStr(
"plot.svg" ) );
160 kiapi::board::jobs::RunBoardJobExportSvg request;
161 *request.mutable_job_settings()->mutable_document() = document;
162 request.mutable_job_settings()->set_output_path( outputPath.GetFullPath().ToUTF8().data() );
164 request.mutable_plot_settings()->add_layers( kiapi::board::types::BL_F_Cu );
165 request.mutable_plot_settings()->set_black_and_white(
true );
166 request.mutable_plot_settings()->set_plot_drawing_sheet(
false );
167 request.mutable_plot_settings()->set_drill_marks( kiapi::board::jobs::PDM_FULL );
168 request.set_page_mode( kiapi::board::jobs::BJPM_EACH_LAYER_OWN_FILE );
169 request.set_precision( 4 );
171 kiapi::common::types::RunJobResponse response;
172 BOOST_REQUIRE_MESSAGE( Client().RunJob( request, &response ),
"RunJob failed: " + Client().LastError() );
174 BOOST_REQUIRE_MESSAGE( response.status() == kiapi::common::types::JS_SUCCESS,
175 "Job failed: " + wxString::FromUTF8( response.message() ) );
177 BOOST_REQUIRE_MESSAGE( response.output_path_size() > 0,
"Job returned no output paths" );
179 wxString generatedPath = wxString::FromUTF8( response.output_path( 0 ) );
180 BOOST_REQUIRE_MESSAGE( wxFileName::FileExists( generatedPath ),
"Generated SVG does not exist: " + generatedPath );
186 BOOST_REQUIRE_MESSAGE( !svg.empty(),
"Generated SVG is empty or unreadable: " + generatedPath );
187 BOOST_CHECK( svg.find(
"<svg" ) != std::string::npos );
188 BOOST_CHECK( svg.find(
"</svg>" ) != std::string::npos );
191 BOOST_CHECK( svg.find(
"width=\"297.0022mm\" height=\"210.0072mm\"" ) != std::string::npos );
194 BOOST_REQUIRE_MESSAGE( !colours.empty(),
"Plot declares no colours at all" );
196 for(
const std::string& colour : colours )
198 BOOST_CHECK_MESSAGE( colour ==
"#000000" || colour ==
"#FFFFFF",
199 "black_and_white was requested but the plot contains " + colour );
242 BOOST_REQUIRE_MESSAGE( Start(), LastError() );
246 wxFileName schPath( testDataDir, wxS(
"basic_test.kicad_sch" ) );
248 kiapi::common::types::DocumentSpecifier document;
250 BOOST_REQUIRE_MESSAGE(
251 Client().OpenDocument( schPath.GetFullPath(), kiapi::common::types::DOCTYPE_SCHEMATIC, &document ),
252 "OpenDocument failed: " + Client().LastError() );
256 wxString outputDir = tempDir.
CreateChildDirStr(
"all" ) + wxFileName::GetPathSeparator();
259 kiapi::schematic::jobs::RunSchematicJobExportPng request;
260 *request.mutable_job_settings()->mutable_document() = document;
261 request.mutable_job_settings()->set_output_path( outputDir.ToUTF8().data() );
262 request.mutable_plot_settings()->set_sheet_mode( kiapi::schematic::jobs::SJSM_ALL_SHEETS );
263 request.mutable_plot_settings()->set_black_and_white(
true );
264 request.set_dpi( 150 );
266 kiapi::common::types::RunJobResponse response;
267 BOOST_REQUIRE_MESSAGE( Client().RunJob( request, &response ),
268 "RunJob failed: " + Client().LastError() );
270 BOOST_REQUIRE_MESSAGE( response.status() == kiapi::common::types::JS_SUCCESS,
271 "Job failed: " + wxString::FromUTF8( response.message() ) );
272 BOOST_REQUIRE_MESSAGE( response.output_path_size() > 0,
"Job returned no output paths" );
274 wxString generatedPath = wxString::FromUTF8( response.output_path( 0 ) );
275 BOOST_REQUIRE_MESSAGE( wxFileName::FileExists( generatedPath ),
276 "Generated PNG does not exist: " + generatedPath );
279 uint32_t width = 0, height = 0;
280 BOOST_REQUIRE_MESSAGE(
pngDimensions( generatedPath, width, height ),
281 "Generated file is not a valid PNG: " + generatedPath );
282 BOOST_CHECK_MESSAGE( width >= 1750 && width <= 1758,
283 "Unexpected PNG width " << width <<
" for 150dpi A4 landscape" );
284 BOOST_CHECK_MESSAGE( height >= 1236 && height <= 1244,
285 "Unexpected PNG height " << height <<
" for 150dpi A4 landscape" );
289 wxFileName singlePath( tempDir.
ChildPathStr(
"single.png" ) );
292 kiapi::schematic::jobs::RunSchematicJobExportPng request;
293 *request.mutable_job_settings()->mutable_document() = document;
294 request.mutable_job_settings()->set_output_path( singlePath.GetFullPath().ToUTF8().data() );
295 request.mutable_plot_settings()->set_sheet_mode( kiapi::schematic::jobs::SJSM_SINGLE_SHEET );
296 request.mutable_plot_settings()->set_black_and_white(
true );
297 request.set_dpi( 300 );
299 kiapi::common::types::RunJobResponse response;
300 BOOST_REQUIRE_MESSAGE( Client().RunJob( request, &response ),
301 "Single-sheet RunJob failed: " + Client().LastError() );
303 BOOST_REQUIRE_MESSAGE( response.status() == kiapi::common::types::JS_SUCCESS,
304 "Single-sheet job failed: " + wxString::FromUTF8( response.message() ) );
305 BOOST_REQUIRE_MESSAGE( response.output_path_size() > 0,
306 "Single-sheet job returned no output paths" );
308 wxString generatedPath = wxString::FromUTF8( response.output_path( 0 ) );
309 BOOST_REQUIRE_MESSAGE( wxFileName::FileExists( generatedPath ),
310 "Generated PNG does not exist: " + generatedPath );
313 uint32_t width = 0, height = 0;
314 BOOST_REQUIRE_MESSAGE(
pngDimensions( generatedPath, width, height ),
315 "Generated file is not a valid PNG: " + generatedPath );
316 BOOST_CHECK_MESSAGE( width >= 3500 && width <= 3516,
317 "Unexpected PNG width " << width <<
" for 300dpi A4 landscape" );
320 BOOST_CHECK_MESSAGE( generatedPath == singlePath.GetFullPath(),
321 "Single-sheet output path not honored: " + generatedPath );
326 kiapi::schematic::jobs::RunSchematicJobExportPng request;
327 *request.mutable_job_settings()->mutable_document() = document;
328 request.mutable_job_settings()->set_output_path( outputDir.ToUTF8().data() );
329 request.mutable_plot_settings()->set_sheet_mode( kiapi::schematic::jobs::SJSM_ALL_SHEETS );
330 request.set_dpi( 10 );
332 kiapi::common::types::RunJobResponse response;
333 BOOST_CHECK_MESSAGE( !Client().RunJob( request, &response ),
334 "Out-of-range dpi was not rejected" );
339 wxString defaultDir = tempDir.
CreateChildDirStr(
"default" ) + wxFileName::GetPathSeparator();
341 kiapi::schematic::jobs::RunSchematicJobExportPng request;
342 *request.mutable_job_settings()->mutable_document() = document;
343 request.mutable_job_settings()->set_output_path( defaultDir.ToUTF8().data() );
344 request.mutable_plot_settings()->set_sheet_mode( kiapi::schematic::jobs::SJSM_ALL_SHEETS );
346 kiapi::common::types::RunJobResponse response;
347 BOOST_REQUIRE_MESSAGE( Client().RunJob( request, &response ),
348 "Default-dpi RunJob failed: " + Client().LastError() );
349 BOOST_REQUIRE_MESSAGE( response.status() == kiapi::common::types::JS_SUCCESS,
350 "Default-dpi job failed: " + wxString::FromUTF8( response.message() ) );
351 BOOST_REQUIRE_MESSAGE( response.output_path_size() > 0,
352 "Default-dpi job returned no output paths" );
354 uint32_t width = 0, height = 0;
355 wxString generatedPath = wxString::FromUTF8( response.output_path( 0 ) );
356 BOOST_REQUIRE_MESSAGE(
pngDimensions( generatedPath, width, height ),
357 "Generated file is not a valid PNG: " + generatedPath );
358 BOOST_CHECK_MESSAGE( width >= 3500 && width <= 3516,
359 "Default dpi should be 300; got width " << width );
366 BOOST_REQUIRE_MESSAGE( Start(), LastError() );
370 wxFileName boardPath( testDataDir, wxS(
"basic_test.kicad_pcb" ) );
372 kiapi::common::types::DocumentSpecifier document;
374 BOOST_REQUIRE_MESSAGE( Client().OpenDocument( boardPath.GetFullPath(), &document ),
375 "OpenDocument failed: " + Client().LastError() );
378 wxString outputDir = tempDir.
CreateChildDirStr(
"drill" ) + wxFileName::GetPathSeparator();
380 kiapi::board::jobs::RunBoardJobExportDrill request;
381 *request.mutable_job_settings()->mutable_document() = document;
382 request.mutable_job_settings()->set_output_path( outputDir.ToUTF8().data() );
383 request.set_format( kiapi::board::jobs::DF_EXCELLON );
385 kiapi::common::types::RunJobResponse response;
386 BOOST_REQUIRE_MESSAGE( Client().RunJob( request, &response ),
"RunJob failed: " + Client().LastError() );
388 BOOST_REQUIRE_MESSAGE( response.status() == kiapi::common::types::JS_SUCCESS,
389 "Job failed: " + wxString::FromUTF8( response.message() ) );
391 BOOST_REQUIRE_MESSAGE( response.output_path_size() > 0,
"Job returned no output paths" );
392 wxString generatedDrillPath;
394 for(
int i = 0; i < response.output_path_size(); ++i )
396 wxString outputPath = wxString::FromUTF8( response.output_path( i ) );
398 if( outputPath.EndsWith( wxS(
".drl" ) ) )
400 generatedDrillPath = outputPath;
405 BOOST_REQUIRE_MESSAGE( !generatedDrillPath.IsEmpty(),
"No .drl file found in job output" );
406 BOOST_REQUIRE_MESSAGE( wxFileName::FileExists( generatedDrillPath ),
407 "Generated drill file does not exist: " + generatedDrillPath );
409 wxString goldenPath = testDataDir + wxS(
"basic_test_excellon_inches.drl" );
410 BOOST_CHECK_MESSAGE(
textFilesMatch( goldenPath, generatedDrillPath, 5 ),
411 "Drill output does not match golden file" );
417 BOOST_REQUIRE_MESSAGE( Start(), LastError() );
420 wxS(
"issue24735.kicad_pcb" ) );
422 kiapi::common::types::DocumentSpecifier document;
424 BOOST_REQUIRE_MESSAGE( Client().OpenDocument( boardPath.GetFullPath(), &document ),
425 "OpenDocument failed: " + Client().LastError() );
430 kiapi::board::jobs::RunBoardJobExportODB request;
431 *request.mutable_job_settings()->mutable_document() = document;
432 request.mutable_job_settings()->set_output_path( target.GetFullPath().ToUTF8().data() );
433 request.set_units( kiapi::common::types::U_MM );
434 request.set_compression( kiapi::board::jobs::ODBC_NONE );
435 request.add_variant_names(
"var1" );
436 request.add_variant_names(
"var2" );
437 request.set_variant_packaging( kiapi::board::jobs::ODBVP_COMBINED );
439 kiapi::common::types::RunJobResponse response;
440 BOOST_REQUIRE_MESSAGE( Client().RunJob( request, &response ),
"RunJob failed: " + Client().LastError() );
441 BOOST_REQUIRE_MESSAGE( response.status() == kiapi::common::types::JS_SUCCESS,
442 "Job failed: " + wxString::FromUTF8( response.message() ) );
444 auto hasLine = [](
const wxString& aPackage,
const wxString& aDir,
const std::string& aLine )
446 wxFileName file( aPackage + wxFileName::GetPathSeparator() + aDir, wxS(
"attrlist" ) );
447 std::ifstream input(
ToFsPath( file.GetFullPath() ) );
450 while( std::getline( input, line ) )
459 BOOST_REQUIRE_EQUAL( response.output_path_size(), 1 );
460 wxString
combined = wxString::FromUTF8( response.output_path( 0 ) );
461 BOOST_REQUIRE_MESSAGE( wxFileName::DirExists(
combined ),
"Missing reported output " +
combined );
462 BOOST_CHECK_MESSAGE( wxFileName::DirName(
combined ).SameAs( wxFileName::DirName( target.GetFullPath() ) ),
463 "Combined output ignored the requested path: " +
combined );
464 BOOST_CHECK( hasLine(
combined, wxS(
"misc" ),
".variant_list=var1:var2" ) );
465 BOOST_CHECK( hasLine(
combined, wxS(
"steps/pcb" ),
".current_variant=var1" ) );
468 wxFileName separateTarget( tempDir.
CreateChildDirStr(
"odb_separate" ), wxS(
"separate" ) );
469 request.mutable_job_settings()->set_output_path( separateTarget.GetFullPath().ToUTF8().data() );
470 request.set_variant_packaging( kiapi::board::jobs::ODBVP_SEPARATE );
473 BOOST_REQUIRE_MESSAGE( Client().RunJob( request, &response ),
"RunJob failed: " + Client().LastError() );
474 BOOST_REQUIRE_MESSAGE( response.status() == kiapi::common::types::JS_SUCCESS,
475 "Separate job failed: " + wxString::FromUTF8( response.message() ) );
476 BOOST_REQUIRE_EQUAL( response.output_path_size(), 2 );
477 std::set<std::string> currentVariants;
479 for(
int i = 0; i < response.output_path_size(); ++i )
481 wxString
package = wxString::FromUTF8( response.output_path( i ) );
482 BOOST_REQUIRE_MESSAGE( wxFileName::DirExists( package ),
"Missing reported output " + package );
483 BOOST_CHECK_MESSAGE( package.StartsWith( separateTarget.GetFullPath() + wxS(
"-" ) ),
484 "Separate output ignored the requested path: " + package );
486 for(
const std::string variant : {
"var1",
"var2" } )
488 if( hasLine( package, wxS(
"steps/pcb" ),
".current_variant=" + variant ) )
489 currentVariants.insert( variant );
493 BOOST_CHECK( currentVariants == std::set<std::string>( {
"var1",
"var2" } ) );
499 BOOST_REQUIRE_MESSAGE( Start(), LastError() );
501 wxString testDataDir =
504 wxFileName boardPath( testDataDir, wxS(
"ZoneFill-4.0.7.kicad_pcb" ) );
506 kiapi::common::types::DocumentSpecifier document;
508 BOOST_REQUIRE_MESSAGE( Client().OpenDocument( boardPath.GetFullPath(), &document ),
509 "OpenDocument failed: " + Client().LastError() );
515 wxString outputDir = tempDir.
CreateChildDirStr(
"multi" ) + wxFileName::GetPathSeparator();
517 kiapi::board::jobs::RunBoardJobExportPng request;
518 *request.mutable_job_settings()->mutable_document() = document;
519 request.mutable_job_settings()->set_output_path( outputDir.ToUTF8().data() );
520 request.mutable_plot_settings()->add_layers( kiapi::board::types::BL_F_Cu );
521 request.mutable_plot_settings()->set_black_and_white(
true );
522 request.set_page_mode( kiapi::board::jobs::BJPM_EACH_LAYER_OWN_FILE );
523 request.set_dpi( 150 );
525 kiapi::common::types::RunJobResponse response;
526 BOOST_REQUIRE_MESSAGE( Client().RunJob( request, &response ),
527 "RunJob failed: " + Client().LastError() );
529 BOOST_REQUIRE_MESSAGE( response.status() == kiapi::common::types::JS_SUCCESS,
530 "Job failed: " + wxString::FromUTF8( response.message() ) );
531 BOOST_REQUIRE_MESSAGE( response.output_path_size() > 0,
"Job returned no output paths" );
533 wxString generatedPath = wxString::FromUTF8( response.output_path( 0 ) );
534 BOOST_REQUIRE_MESSAGE( wxFileName::FileExists( generatedPath ),
535 "Generated PNG does not exist: " + generatedPath );
537 uint32_t width = 0, height = 0;
538 BOOST_REQUIRE_MESSAGE(
pngDimensions( generatedPath, width, height ),
539 "Generated file is not a valid PNG: " + generatedPath );
540 BOOST_CHECK_MESSAGE( width >= 1750 && width <= 1758,
541 "Unexpected PNG width " << width <<
" for 150dpi A4 landscape" );
546 wxFileName outputPath( tempDir.
ChildPathStr(
"single.png" ) );
548 kiapi::board::jobs::RunBoardJobExportPng request;
549 *request.mutable_job_settings()->mutable_document() = document;
550 request.mutable_job_settings()->set_output_path( outputPath.GetFullPath().ToUTF8().data() );
551 request.mutable_plot_settings()->add_layers( kiapi::board::types::BL_F_Cu );
552 request.mutable_plot_settings()->add_layers( kiapi::board::types::BL_F_SilkS );
553 request.mutable_plot_settings()->set_black_and_white(
true );
554 request.set_page_mode( kiapi::board::jobs::BJPM_ALL_LAYERS_ONE_PAGE );
555 request.set_dpi( 300 );
557 kiapi::common::types::RunJobResponse response;
558 BOOST_REQUIRE_MESSAGE( Client().RunJob( request, &response ),
559 "Single-mode RunJob failed: " + Client().LastError() );
561 BOOST_REQUIRE_MESSAGE( response.status() == kiapi::common::types::JS_SUCCESS,
562 "Single-mode job failed: " + wxString::FromUTF8( response.message() ) );
563 BOOST_REQUIRE_MESSAGE( response.output_path_size() > 0,
564 "Single-mode job returned no output paths" );
566 wxString generatedPath = wxString::FromUTF8( response.output_path( 0 ) );
567 BOOST_REQUIRE_MESSAGE( wxFileName::FileExists( generatedPath ),
568 "Generated PNG does not exist: " + generatedPath );
569 BOOST_CHECK_MESSAGE( generatedPath == outputPath.GetFullPath(),
570 "Single-mode output path not honored: " + generatedPath );
572 uint32_t width = 0, height = 0;
573 BOOST_REQUIRE_MESSAGE(
pngDimensions( generatedPath, width, height ),
574 "Generated file is not a valid PNG: " + generatedPath );
575 BOOST_CHECK_MESSAGE( width >= 3500 && width <= 3516,
576 "Unexpected PNG width " << width <<
" for 300dpi A4 landscape" );
583 BOOST_REQUIRE_MESSAGE( Start(), LastError() );
587 wxFileName schPath( testDataDir, wxS(
"basic_test.kicad_sch" ) );
589 kiapi::common::types::DocumentSpecifier document;
591 BOOST_REQUIRE_MESSAGE(
592 Client().OpenDocument( schPath.GetFullPath(), kiapi::common::types::DOCTYPE_SCHEMATIC, &document ),
593 "OpenDocument failed: " + Client().LastError() );
596 wxFileName outputPath( tempDir.
ChildPathStr(
"netlist.cadstar" ) );
598 kiapi::schematic::jobs::RunSchematicJobExportNetlist request;
599 *request.mutable_job_settings()->mutable_document() = document;
600 request.mutable_job_settings()->set_output_path( outputPath.GetFullPath().ToUTF8().data() );
601 request.set_format( kiapi::schematic::jobs::SNF_CADSTAR );
603 kiapi::common::types::RunJobResponse response;
604 BOOST_REQUIRE_MESSAGE( Client().RunJob( request, &response ),
"RunJob failed: " + Client().LastError() );
606 BOOST_REQUIRE_MESSAGE( response.status() == kiapi::common::types::JS_SUCCESS,
607 "Job failed: " + wxString::FromUTF8( response.message() ) );
609 BOOST_REQUIRE_MESSAGE( response.output_path_size() > 0,
"Job returned no output paths" );
611 wxString generatedPath = wxString::FromUTF8( response.output_path( 0 ) );
612 BOOST_REQUIRE_MESSAGE( wxFileName::FileExists( generatedPath ),
613 "Generated netlist does not exist: " + generatedPath );
616 wxString goldenPath = testDataDir + wxS(
"basic_test.netlist.cadstar" );
617 BOOST_CHECK_MESSAGE(
textFilesMatch( goldenPath, generatedPath, 3 ),
"Netlist output does not match golden file" );
623 BOOST_REQUIRE_MESSAGE( Start(), LastError() );
627 wxFileName schPath( testDataDir, wxS(
"variants.kicad_sch" ) );
629 kiapi::common::types::DocumentSpecifier document;
631 BOOST_REQUIRE_MESSAGE(
632 Client().OpenDocument( schPath.GetFullPath(), kiapi::common::types::DOCTYPE_SCHEMATIC, &document ),
633 "OpenDocument failed: " + Client().LastError() );
636 wxFileName outputPath( tempDir.
ChildPathStr(
"bom.csv" ) );
638 kiapi::schematic::jobs::RunSchematicJobExportBOM request;
639 *request.mutable_job_settings()->mutable_document() = document;
640 request.mutable_job_settings()->set_output_path( outputPath.GetFullPath().ToUTF8().data() );
641 request.set_exclude_dnp(
true );
643 request.mutable_format()->set_preset_name(
"CSV" );
645 auto* refField = request.mutable_fields()->add_fields();
646 refField->set_name(
"Reference" );
647 refField->set_label(
"Refs" );
648 refField->set_group_by(
false );
650 auto* valField = request.mutable_fields()->add_fields();
651 valField->set_name(
"Value" );
652 valField->set_label(
"Value" );
653 valField->set_group_by(
false );
655 kiapi::common::types::RunJobResponse response;
656 BOOST_REQUIRE_MESSAGE( Client().RunJob( request, &response ),
"RunJob failed: " + Client().LastError() );
658 BOOST_REQUIRE_MESSAGE( response.status() == kiapi::common::types::JS_SUCCESS,
659 "Job failed: " + wxString::FromUTF8( response.message() ) );
661 BOOST_REQUIRE_MESSAGE( response.output_path_size() > 0,
"Job returned no output paths" );
663 wxString generatedPath = wxString::FromUTF8( response.output_path( 0 ) );
664 BOOST_REQUIRE_MESSAGE( wxFileName::FileExists( generatedPath ),
"Generated BOM does not exist: " + generatedPath );
666 wxString goldenPath = testDataDir + wxS(
"variants_default.bom.csv" );
667 BOOST_CHECK_MESSAGE(
textFilesMatch( goldenPath, generatedPath, 0 ),
"BOM output does not match golden file" );
669 request.mutable_format()->clear_preset_name();
670 request.mutable_format()->set_field_delimiter(
"," );
671 request.mutable_format()->set_string_delimiter(
"\"" );
672 request.mutable_format()->set_ref_delimiter(
"," );
673 request.mutable_format()->set_ref_range_delimiter(
"" );
674 request.mutable_format()->set_include_byte_order_mark(
true );
677 BOOST_REQUIRE_MESSAGE( Client().RunJob( request, &response ),
678 "BOM job with byte order mark failed: " + Client().LastError() );
680 BOOST_REQUIRE_MESSAGE( response.status() == kiapi::common::types::JS_SUCCESS,
681 "BOM job with byte order mark failed: " + wxString::FromUTF8( response.message() ) );
682 BOOST_REQUIRE_MESSAGE( response.output_path_size() > 0,
"BOM job with byte order mark returned no output paths" );
684 generatedPath = wxString::FromUTF8( response.output_path( 0 ) );
685 std::ifstream generatedStream( generatedPath.ToStdString(), std::ios::binary );
686 std::ifstream goldenStream( goldenPath.ToStdString(), std::ios::binary );
690 std::ostringstream generatedContents;
691 std::ostringstream goldenContents;
692 generatedContents << generatedStream.rdbuf();
693 goldenContents << goldenStream.rdbuf();
695 const std::string utf8ByteOrderMark(
"\xEF\xBB\xBF", 3 );
696 const std::string bom = generatedContents.str();
697 BOOST_REQUIRE_GE( bom.size(), utf8ByteOrderMark.size() );
698 BOOST_CHECK_EQUAL( bom.substr( 0, utf8ByteOrderMark.size() ), utf8ByteOrderMark );
699 BOOST_CHECK_EQUAL( bom.substr( utf8ByteOrderMark.size() ), goldenContents.str() );
701 generatedStream.close();
702 goldenStream.close();
BOOST_CHECK_EQUAL(result, "25.4")