KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_board_design_settings.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, you may find one here:
18
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19
* or you may search the http://www.gnu.org website for the version 2 license,
20
* or you may write to the Free Software Foundation, Inc.,
21
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22
*/
23
24
#include <
qa_utils/wx_utils/unit_test_utils.h
>
25
26
#include <
board.h
>
27
#include <
board_design_settings.h
>
28
#include <
settings/settings_manager.h
>
29
#include <
pcbnew_utils/board_test_utils.h
>
30
31
32
namespace
33
{
34
struct
BDS_TEST_FIXTURE
35
{
36
BDS_TEST_FIXTURE() :
37
m_board( new
BOARD
() )
38
{ }
39
40
SETTINGS_MANAGER m_settingsManager;
41
std::unique_ptr<BOARD> m_board;
42
};
43
}
// namespace
44
45
46
BOOST_FIXTURE_TEST_SUITE( BoardDesignSettings, BDS_TEST_FIXTURE )
47
48
49
56
BOOST_AUTO_TEST_CASE
( NegativeSilkClearanceRoundTrip )
57
{
58
BOARD_DESIGN_SETTINGS
& bds = m_board->GetDesignSettings();
59
60
int
negativeValue =
pcbIUScale
.mmToIU( -0.1 );
61
bds.
m_SilkClearance
= negativeValue;
62
63
// Store all params into the JSON backing store
64
bds.
Store
();
65
66
// Reset to default
67
bds.
m_SilkClearance
= 0;
68
69
// Load back from JSON
70
bds.
Load
();
71
72
BOOST_CHECK_EQUAL
( bds.
m_SilkClearance
, negativeValue );
73
}
74
75
76
BOOST_AUTO_TEST_SUITE_END
()
pcbIUScale
constexpr EDA_IU_SCALE pcbIUScale
Definition
base_units.h:112
board.h
board_design_settings.h
board_test_utils.h
BOARD_DESIGN_SETTINGS
Container for design settings for a BOARD object.
Definition
board_design_settings.h:250
BOARD_DESIGN_SETTINGS::m_SilkClearance
int m_SilkClearance
Definition
board_design_settings.h:703
JSON_SETTINGS::Load
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
Definition
json_settings.cpp:137
JSON_SETTINGS::Store
virtual bool Store()
Stores the current parameters into the JSON document represented by this object Note: this doesn't do...
Definition
json_settings.cpp:381
KICAD3D_MODEL_TYPE::BOARD
@ BOARD
Definition
kicad3d_info.h:35
settings_manager.h
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
Definition
test_api_enums.cpp:136
BOOST_AUTO_TEST_SUITE_END
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL
BOOST_CHECK_EQUAL(result, "25.4")
unit_test_utils.h
src
qa
tests
pcbnew
test_board_design_settings.cpp
Generated on Fri Mar 13 2026 00:07:44 for KiCad PCB EDA Suite by
1.13.2