Browse Source

Improve error handling when reading test board data

newinvert
John Beard 2 years ago
parent
commit
11be5d6f1d
  1. 12
      qa/pcbnew_utils/board_file_utils.cpp
  2. 10
      qa/pcbnew_utils/board_test_utils.cpp

12
qa/pcbnew_utils/board_file_utils.cpp

@ -106,6 +106,12 @@ std::unique_ptr<BOARD> ReadBoardFromFileOrStream( const std::string& aFilename,
else
{
file_stream.open( aFilename );
if( !file_stream.is_open() )
{
return nullptr;
}
in_stream = &file_stream;
}
@ -127,6 +133,12 @@ std::unique_ptr<FOOTPRINT> ReadFootprintFromFileOrStream( const std::string& aFi
else
{
file_stream.open( aFilename );
if( !file_stream.is_open() )
{
return nullptr;
}
in_stream = &file_stream;
}

10
qa/pcbnew_utils/board_test_utils.cpp

@ -86,7 +86,17 @@ void LoadBoard( SETTINGS_MANAGER& aSettingsManager, const wxString& aRelPath,
else if( legacyProject.Exists() )
aSettingsManager.LoadProject( legacyProject.GetFullPath() );
BOOST_TEST_MESSAGE( "Loading board file: " << boardPath );
try {
aBoard = ReadBoardFromFileOrStream( boardPath );
}
catch( const IO_ERROR& ioe )
{
BOOST_TEST_ERROR( ioe.What() );
}
BOOST_REQUIRE( aBoard );
if( projectFile.Exists() || legacyProject.Exists() )
aBoard->SetProject( &aSettingsManager.Prj() );

Loading…
Cancel
Save