KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcbnew/pcb_io/easyedapro/test_easyedapro_v3_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, 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
28
31
34
35#include <board.h>
36#include <footprint.h>
37
38#include <memory>
39
40
41BOOST_AUTO_TEST_SUITE( EasyedaproV3Import )
42
43
45{
46 return wxString::FromUTF8( KI_TEST::GetTestDataRootDir() + "eeschema/plugins/easyedapro/LS2K0300_Symbol.elibz2" );
47}
48
49
51{
52 return wxString::FromUTF8( KI_TEST::GetPcbnewTestDataDir()
53 + "plugins/easyedapro/LS2K0300_Footprint_2025-11-14.elibz2" );
54}
55
56
57BOOST_AUTO_TEST_CASE( FootprintLibraryCanReadOnlyFootprintElibz2 )
58{
60 BOOST_REQUIRE( plugin );
61
62 BOOST_CHECK( plugin->CanReadLibrary( getEasyEdaProV3FootprintLibPath() ) );
63 BOOST_CHECK( !plugin->CanReadLibrary( getEasyEdaProV3SymbolLibPath() ) );
64}
65
66
67BOOST_AUTO_TEST_CASE( FootprintLibraryEnumeratesAndLoadsElibz2 )
68{
70 BOOST_REQUIRE( plugin );
71
72 wxArrayString footprintNames;
73 BOOST_REQUIRE_NO_THROW( plugin->FootprintEnumerate( footprintNames, getEasyEdaProV3FootprintLibPath(), false ) );
74
75 BOOST_REQUIRE_EQUAL( footprintNames.GetCount(), 1 );
76 BOOST_CHECK_EQUAL( footprintNames[0], wxString( wxS( "BGA-286_17x17_12.0x12.0mm" ) ) );
77
78 std::unique_ptr<FOOTPRINT> footprint(
79 plugin->FootprintLoad( getEasyEdaProV3FootprintLibPath(), wxS( "BGA-286_17x17_12.0x12.0mm" ) ) );
80
81 BOOST_REQUIRE( footprint );
82 BOOST_CHECK_EQUAL( footprint->GetFPID().GetLibItemName(), UTF8( "BGA-286_17x17_12.0x12.0mm" ) );
83 BOOST_CHECK_EQUAL( footprint->Pads().size(), 286 );
84}
85
86
87BOOST_AUTO_TEST_CASE( BoardLoadImportsInnerLayers )
88{
89 wxString dataPath = wxString::FromUTF8(
91 + "plugins/easyedapro/ProProject_LS2K0300Core_2025-11-14.epro2" );
92
93 std::map<std::string, UTF8> properties;
94 properties["pcb_id"] = "eb9fbfba682940f7a002816e66fbb3d7";
95
97 BOOST_REQUIRE( plugin );
98
99 std::unique_ptr<BOARD> board( plugin->LoadBoard( dataPath, nullptr, &properties ) );
100 BOOST_REQUIRE( board );
101
102 BOOST_CHECK( board->Footprints().size() > 0 );
103 BOOST_CHECK( board->GetNetCount() > 0 );
104
105 // A 4-layer board whose inner and back copper carry their EasyEDA names.
106 BOOST_CHECK_EQUAL( board->GetCopperLayerCount(), 4 );
107 BOOST_CHECK_EQUAL( board->GetLayerName( In1_Cu ), wxString( wxS( "Inner1" ) ) );
108 BOOST_CHECK_EQUAL( board->GetLayerName( In2_Cu ), wxString( wxS( "Inner2" ) ) );
109 BOOST_CHECK_EQUAL( board->GetLayerName( B_Cu ), wxString( wxS( "Bottom Layer" ) ) );
110}
111
112
General utilities for PCB file IO for QA programs.
static PCB_IO * FindPlugin(PCB_FILE_T aFileType)
Return a #PLUGIN which the caller can use to import, export, save, or load design documents.
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
Definition utf8.h:67
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
Definition io_mgr.h:33
@ B_Cu
Definition layer_ids.h:61
@ In2_Cu
Definition layer_ids.h:63
@ In1_Cu
Definition layer_ids.h:62
std::string GetTestDataRootDir()
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
static wxString getEasyEdaProV3FootprintLibPath()
BOOST_AUTO_TEST_CASE(FootprintLibraryCanReadOnlyFootprintElibz2)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
static wxString getEasyEdaProV3SymbolLibPath()
static wxString getEasyEdaProV3FootprintLibPath()
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")