KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_issue25606_derived_symbol_footprint.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 modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
24
26
27#include <lib_symbol.h>
28#include <sch_field.h>
29
30
31BOOST_AUTO_TEST_SUITE( DerivedSymbolFootprint )
32
33
34
39BOOST_AUTO_TEST_CASE( InheritedFootprintResolution )
40{
41 LIB_SYMBOL base( wxS( "Base" ) );
42 LIB_SYMBOL derived( wxS( "Derived" ) );
43
44 base.GetFootprintField().SetText( wxS( "Package_DFN_QFN:DHWQFN-14" ) );
45 derived.SetParent( &base );
46
47 BOOST_CHECK( derived.IsDerived() );
48 BOOST_CHECK( derived.GetFootprintField().GetText().IsEmpty() );
49 BOOST_CHECK_EQUAL( derived.GetFootprint(), wxS( "Package_DFN_QFN:DHWQFN-14" ) );
50
51 // An override on the derived symbol wins over the parent
52 derived.GetFootprintField().SetText( wxS( "Package_SO:SOIC-14" ) );
53 BOOST_CHECK_EQUAL( derived.GetFootprint(), wxS( "Package_SO:SOIC-14" ) );
54
55 // A root symbol with no footprint still reports none
56 LIB_SYMBOL orphan( wxS( "Orphan" ) );
57 BOOST_CHECK( orphan.GetFootprint().IsEmpty() );
58}
59
60
Define a library symbol object.
Definition lib_symbol.h:114
bool IsDerived() const
Definition lib_symbol.h:241
SCH_FIELD & GetFootprintField()
Definition lib_symbol.h:455
void SetParent(LIB_SYMBOL *aParent=nullptr)
wxString GetFootprint() const override
For items with footprint fields.
virtual const wxString & GetText() const override
Return the string associated with the text object.
Definition sch_field.h:139
void SetText(const wxString &aText) override
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")