KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_easyedapro_v3_plugin.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
25
26#include <lib_symbol.h>
27#include <sch_io/sch_io.h>
28#include <sch_io/sch_io_mgr.h>
29#include <sch_pin.h>
30
31#include <memory>
32
33
35{
36 return wxString::FromUTF8(
38 + "pcbnew/plugins/easyedapro/ProProject_LS2K0300Core_2025-11-14.epro2" );
39}
40
41
43{
44 return wxString::FromUTF8( KI_TEST::GetTestDataRootDir() + "eeschema/plugins/easyedapro/LS2K0300_Symbol.elibz2" );
45}
46
47
49{
50 return wxString::FromUTF8( KI_TEST::GetTestDataRootDir()
51 + "pcbnew/plugins/easyedapro/LS2K0300_Footprint_2025-11-14.elibz2" );
52}
53
54
55BOOST_AUTO_TEST_CASE( EasyEdaProV3FindPlugin )
56{
57 IO_RELEASER<SCH_IO> plugin( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EASYEDAPRO_V3 ) );
58 BOOST_CHECK_NE( plugin.get(), nullptr );
59}
60
61
62BOOST_AUTO_TEST_CASE( EasyEdaProV3CanReadSchematicFile )
63{
64 IO_RELEASER<SCH_IO> plugin( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EASYEDAPRO_V3 ) );
65 BOOST_REQUIRE( plugin );
66
67 BOOST_CHECK( plugin->CanReadSchematicFile( getEasyEdaProV3ArchivePath() ) );
68}
69
70
71BOOST_AUTO_TEST_CASE( EasyEdaProV3GuessPluginType )
72{
75 SCH_IO_MGR::SCH_EASYEDAPRO_V3 );
76}
77
78
79BOOST_AUTO_TEST_CASE( EasyEdaProV3CanReadSymbolLibrary )
80{
81 IO_RELEASER<SCH_IO> plugin( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EASYEDAPRO_V3 ) );
82 BOOST_REQUIRE( plugin );
83
84 BOOST_CHECK( plugin->CanReadLibrary( getEasyEdaProV3SymbolLibPath() ) );
85 BOOST_CHECK( !plugin->CanReadLibrary( getEasyEdaProV3FootprintLibPath() ) );
86}
87
88
89BOOST_AUTO_TEST_CASE( EasyEdaProV3EnumeratesAndLoadsSymbolLibrary )
90{
91 IO_RELEASER<SCH_IO> plugin( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EASYEDAPRO_V3 ) );
92 BOOST_REQUIRE( plugin );
93
94 wxArrayString symbolNames;
95 BOOST_REQUIRE_NO_THROW( plugin->EnumerateSymbolLib( symbolNames, getEasyEdaProV3SymbolLibPath() ) );
96
97 BOOST_REQUIRE_EQUAL( symbolNames.GetCount(), 1 );
98 BOOST_CHECK_EQUAL( symbolNames[0], wxString( wxS( "LS2K0300" ) ) );
99
100 std::unique_ptr<LIB_SYMBOL> symbol( plugin->LoadSymbol( getEasyEdaProV3SymbolLibPath(), wxS( "LS2K0300" ) ) );
101
102 BOOST_REQUIRE( symbol );
103 BOOST_CHECK_EQUAL( symbol->GetName(), wxString( wxS( "LS2K0300" ) ) );
104 BOOST_CHECK_EQUAL( symbol->GetUnitCount(), 5 );
105 BOOST_CHECK( symbol->GetPins().size() > 200 );
106}
static SCH_FILE_T GuessPluginTypeFromSchPath(const wxString &aSchematicPath, int aCtl=0)
Return a plugin type given a schematic using the file extension of aSchematicPath.
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
Definition io_mgr.h:33
std::string GetTestDataRootDir()
static wxString getEasyEdaProV3SymbolLibPath()
BOOST_AUTO_TEST_CASE(EasyEdaProV3FindPlugin)
static wxString getEasyEdaProV3ArchivePath()
static wxString getEasyEdaProV3FootprintLibPath()
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_CHECK_EQUAL(result, "25.4")