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
25
#include <
qa_utils/wx_utils/unit_test_utils.h
>
26
27
#include <
lib_symbol.h
>
28
#include <
sch_field.h
>
29
30
31
BOOST_AUTO_TEST_SUITE
( DerivedSymbolFootprint )
32
33
34
39
BOOST_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
61
BOOST_AUTO_TEST_SUITE_END
()
LIB_SYMBOL
Define a library symbol object.
Definition
lib_symbol.h:114
LIB_SYMBOL::IsDerived
bool IsDerived() const
Definition
lib_symbol.h:241
LIB_SYMBOL::GetFootprintField
SCH_FIELD & GetFootprintField()
Definition
lib_symbol.h:455
LIB_SYMBOL::SetParent
void SetParent(LIB_SYMBOL *aParent=nullptr)
Definition
lib_symbol.cpp:853
LIB_SYMBOL::GetFootprint
wxString GetFootprint() const override
For items with footprint fields.
Definition
lib_symbol.cpp:896
SCH_FIELD::GetText
virtual const wxString & GetText() const override
Return the string associated with the text object.
Definition
sch_field.h:139
SCH_FIELD::SetText
void SetText(const wxString &aText) override
Definition
sch_field.cpp:1148
lib_symbol.h
sch_field.h
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
Definition
test_api_enums.cpp:80
BOOST_AUTO_TEST_SUITE
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
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
eeschema
test_issue25606_derived_symbol_footprint.cpp
Generated on Tue Oct 27 2026 00:06:42 for KiCad PCB EDA Suite by
1.13.2