26 #include <wx/filename.h> 35 #include <boost/filesystem.hpp> 36 #include <boost/test/unit_test.hpp> 43 m_dump_boards(
std::getenv(
"KICAD_TEST_DUMP_BOARD_FILES" ) )
53 auto path = boost::filesystem::temp_directory_path() / aName;
56 BOOST_TEST_MESSAGE(
"Dumping board file: " <<
path.string() );
62 std::unique_ptr<BOARD>& aBoard )
66 aBoard->SetProject(
nullptr );
71 wxFileName projectFile( absPath +
".kicad_pro" );
72 wxFileName legacyProject( absPath +
".pro" );
73 std::string boardPath = absPath +
".kicad_pcb";
74 wxFileName rulesFile( absPath +
".kicad_dru" );
76 if( projectFile.Exists() )
77 aSettingsManager.
LoadProject( projectFile.GetFullPath() );
78 else if( legacyProject.Exists() )
79 aSettingsManager.
LoadProject( legacyProject.GetFullPath() );
83 if( projectFile.Exists() || legacyProject.Exists() )
84 aBoard->SetProject( &aSettingsManager.
Prj() );
86 auto m_DRCEngine = std::make_shared<DRC_ENGINE>( aBoard.get(), &aBoard->GetDesignSettings() );
88 if( rulesFile.Exists() )
89 m_DRCEngine->InitEngine( rulesFile );
91 m_DRCEngine->InitEngine( wxFileName() );
93 aBoard->GetDesignSettings().m_DRCEngine = m_DRCEngine;
94 aBoard->BuildListOfNets();
95 aBoard->BuildConnectivity();
102 toolMgr.
SetEnvironment( m_board,
nullptr,
nullptr,
nullptr,
nullptr );
106 std::vector<ZONE*> toFill;
111 toFill.push_back( zone );
113 if( filler.
Fill( toFill,
false,
nullptr ) )
114 commit.
Push(
_(
"Fill Zone(s)" ),
false,
false );
int m_ZoneFillVersion
Option to select different fill algorithms.
PROJECT & Prj() const
A helper while we are not MDI-capable – return the one and only project.
void DumpBoardToFile(BOARD &aBoard, const std::string &aName) const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
bool Fill(std::vector< ZONE * > &aZones, bool aCheck=false, wxWindow *aParent=nullptr)
Fills the given list of zones.
void DumpBoardToFile(BOARD &board, const std::string &aFilename)
Utility function to simply write a Board out to a file.
Handle a list of polygons defining a copper zone.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Loads a project or sets up a new project with a specified path.
Information pertinent to a Pcbnew printed circuit board.
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Revert the commit by restoring the modified items state.
General utilities for PCB file IO for QA programs.
std::unique_ptr< BOARD > ReadBoardFromFileOrStream(const std::string &aFilename, std::istream &aFallback)
Read a board from a file, or another stream, as appropriate.
void FillZones(BOARD *m_board, int aFillVersion)
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
void LoadBoard(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard)