KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_easyedapro_import.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, see <https://www.gnu.org/licenses/>.
18
*/
19
24
25
#include <
pcbnew_utils/board_test_utils.h
>
26
#include <
pcbnew_utils/board_file_utils.h
>
27
#include <
qa_utils/wx_utils/unit_test_utils.h
>
28
29
#include <
pcbnew/pcb_io/easyedapro/pcb_io_easyedapro.h
>
30
31
#include <
footprint.h
>
32
#include <
pad.h
>
33
34
35
struct
EASYEDAPRO_IMPORT_FIXTURE
36
{
37
EASYEDAPRO_IMPORT_FIXTURE
() {}
38
39
PCB_IO_EASYEDAPRO
plugin
;
40
};
41
42
43
BOOST_FIXTURE_TEST_SUITE( EasyedaproImport,
EASYEDAPRO_IMPORT_FIXTURE
)
44
45
46
51
BOOST_AUTO_TEST_CASE
( PolygonPadImport )
52
{
53
std::string dataPath =
KI_TEST::GetPcbnewTestDataDir
()
54
+
"plugins/easyedapro/PDFN-8_L3.2-W3.1-P0.65-LS3.4-BL-EP2.efoo"
;
55
56
wxString fpName = wxS(
"PDFN-8_L3.2-W3.1-P0.65-LS3.4-BL-EP2"
);
57
FOOTPRINT
* fp = plugin.FootprintLoad( dataPath, fpName,
false
,
nullptr
);
58
59
BOOST_REQUIRE
( fp );
60
61
// The footprint should have 10 pads: 8 numbered pads plus 2 polygon-shaped pads (9 and 10)
62
BOOST_CHECK_EQUAL
( fp->
Pads
().size(), 10 );
63
64
// Find the polygon pads (pads 9 and 10 in the test file)
65
PAD
* pad9 = fp->
FindPadByNumber
(
"9"
);
66
PAD
* pad10 = fp->
FindPadByNumber
(
"10"
);
67
68
BOOST_REQUIRE
( pad9 );
69
BOOST_REQUIRE
( pad10 );
70
71
// These pads should be custom shape (POLYGON in EasyEDA Pro becomes CUSTOM in KiCad)
72
BOOST_CHECK_EQUAL
(
static_cast<
int
>
( pad9->
GetShape
(
PADSTACK::ALL_LAYERS
) ),
73
static_cast<
int
>
(
PAD_SHAPE::CUSTOM
) );
74
BOOST_CHECK_EQUAL
(
static_cast<
int
>
( pad10->
GetShape
(
PADSTACK::ALL_LAYERS
) ),
75
static_cast<
int
>
(
PAD_SHAPE::CUSTOM
) );
76
77
// Check that primitives were added to the custom pads
78
BOOST_CHECK( !pad9->
GetPrimitives
(
PADSTACK::ALL_LAYERS
).empty() );
79
BOOST_CHECK( !pad10->
GetPrimitives
(
PADSTACK::ALL_LAYERS
).empty() );
80
81
delete
fp;
82
}
83
84
85
BOOST_AUTO_TEST_SUITE_END
()
board_file_utils.h
General utilities for PCB file IO for QA programs.
board_test_utils.h
FOOTPRINT
Definition
footprint.h:288
FOOTPRINT::Pads
std::deque< PAD * > & Pads()
Definition
footprint.h:375
FOOTPRINT::FindPadByNumber
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition
footprint.cpp:2424
PADSTACK::ALL_LAYERS
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
Definition
padstack.h:177
PAD
Definition
pad.h:61
PAD::GetPrimitives
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives(PCB_LAYER_ID aLayer) const
Accessor to the basic shape list for custom-shaped pads.
Definition
pad.h:370
PAD::GetShape
PAD_SHAPE GetShape(PCB_LAYER_ID aLayer) const
Definition
pad.h:202
PCB_IO_EASYEDAPRO
Definition
pcb_io_easyedapro.h:32
footprint.h
KI_TEST::GetPcbnewTestDataDir
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
Definition
board_file_utils.cpp:38
pad.h
PAD_SHAPE::CUSTOM
@ CUSTOM
Definition
padstack.h:61
pcb_io_easyedapro.h
EASYEDAPRO_IMPORT_FIXTURE
Definition
test_easyedapro_import.cpp:36
EASYEDAPRO_IMPORT_FIXTURE::plugin
PCB_IO_EASYEDAPRO plugin
Definition
test_easyedapro_import.cpp:39
EASYEDAPRO_IMPORT_FIXTURE::EASYEDAPRO_IMPORT_FIXTURE
EASYEDAPRO_IMPORT_FIXTURE()
Definition
test_easyedapro_import.cpp:37
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
Definition
test_api_enums.cpp:71
BOOST_REQUIRE
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
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
pcb_io
easyedapro
test_easyedapro_import.cpp
Generated on Fri Jun 26 2026 00:05:45 for KiCad PCB EDA Suite by
1.13.2