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
25
26#include <board.h>
30
31
32namespace
33{
34struct 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
46BOOST_FIXTURE_TEST_SUITE( BoardDesignSettings, BDS_TEST_FIXTURE )
47
48
49
56BOOST_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
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:112
Container for design settings for a BOARD object.
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
virtual bool Store()
Stores the current parameters into the JSON document represented by this object Note: this doesn't do...
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")