KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_import_design_rules.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
21
22#include <reporter.h>
23#include <wx/file.h>
24#include <wx/filename.h>
25#include <wx/stdpaths.h>
26#include <wx/utils.h>
27
28#include <import_design_rules.h>
29
30
31BOOST_AUTO_TEST_SUITE( ImportDesignRules )
32
33
34// A board with no name has nowhere to put rules but a hidden file, which must not be written
35BOOST_AUTO_TEST_CASE( NamelessBoardWritesNothing )
36{
37 wxFileName dir = wxFileName::DirName( wxStandardPaths::Get().GetTempDir() );
38 dir.AppendDir( wxString::Format( wxS( "import_design_rules-qa-%lu" ), wxGetProcessId() ) );
39 dir.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );
40
41 wxFileName board( dir.GetPath(), wxEmptyString, wxS( "kicad_pcb" ) );
42 wxFileName hidden( dir.GetPath(), wxEmptyString, wxS( "kicad_dru" ) );
43
44 BOOST_CHECK( !SaveImportedDesignRules( wxS( "(version 1)" ), board, NULL_REPORTER::GetInstance() ) );
45 BOOST_CHECK( !hidden.FileExists() );
46}
47
48
static REPORTER & GetInstance()
Definition reporter.cpp:207
bool SaveImportedDesignRules(const wxString &aRules, const wxFileName &aBoardPath, REPORTER &aReporter)
Save the custom rules an importer derived beside the board it produced.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()