KiCad PCB EDA Suite
test_pad_naming.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 (C) 2018 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>
27 #include <footprint.h>
28 #include <pad_naming.h>
29 
31 {
33  m_board(),
35  {
36  }
37 
39  {
40  PAD pad( &m_footprint );
41 
42  pad.SetAttribute( PAD_ATTRIB::NPTH );
43  pad.SetLayerSet( PAD::UnplatedHoleMask() );
44 
45  return pad;
46  }
47 
49  {
50  PAD pad( &m_footprint );
51 
52  pad.SetAttribute( PAD_ATTRIB::PTH );
53  pad.SetLayerSet( PAD::ApertureMask() );
54 
55  return pad;
56  }
57 
59  {
60  PAD pad( &m_footprint );
61 
62  pad.SetAttribute( PAD_ATTRIB::SMD );
63  pad.SetLayerSet( PAD::SMDMask() );
64 
65  return pad;
66  }
67 
70 };
71 
72 
73 BOOST_FIXTURE_TEST_SUITE( PadNaming, PAD_FIXTURE )
74 
75 
79 {
80  auto npth = MakeNPTH();
81  BOOST_CHECK_EQUAL( false, PAD_NAMING::PadCanHaveName( npth ) );
82 
83  auto aperture = MakeAperture();
84  BOOST_CHECK_EQUAL( false, PAD_NAMING::PadCanHaveName( aperture ) );
85 
86  auto smd = MakeSmd();
87  BOOST_CHECK_EQUAL( true, PAD_NAMING::PadCanHaveName( smd ) );
88 }
89 
90 
91 BOOST_AUTO_TEST_SUITE_END()
Smd pad, appears on the solder paste layer (default)
Plated through hole pad.
like PAD_PTH, but not plated
FOOTPRINT m_footprint
bool PadCanHaveName(const PAD &aPad)
Check if a pad should be named.
Definition: pad_naming.cpp:26
static LSET ApertureMask()
layer set for an aperture pad
Definition: pad.cpp:175
BOOST_AUTO_TEST_CASE(CanName)
Check what gets names and what doesn't.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
Definition: pad.cpp:168
Definition: pad.h:60
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition: pad.cpp:154