KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_pads_sch_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 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
20#include <boost/test/unit_test.hpp>
22
23#include <schematic.h>
25#include <sch_io/sch_io_mgr.h>
27
28
29namespace
30{
31
32struct PADS_SCH_IMPORT_FIXTURE
33{
34 PADS_SCH_IMPORT_FIXTURE() : m_schematic( nullptr )
35 {
36 m_settingsManager.LoadProject( "" );
37 m_schematic.SetProject( &m_settingsManager.Prj() );
38 m_schematic.Reset();
39 }
40
41 ~PADS_SCH_IMPORT_FIXTURE()
42 {
43 m_schematic.Reset();
44 }
45
46 SETTINGS_MANAGER m_settingsManager;
47 SCHEMATIC m_schematic;
48};
49
50} // namespace
51
52
53BOOST_FIXTURE_TEST_SUITE( PadsSchImport, PADS_SCH_IMPORT_FIXTURE )
54
55
56BOOST_AUTO_TEST_CASE( CanReadSchematicFile )
57{
58 SCH_IO_PADS plugin;
59
60 wxString padsFile = wxString::FromUTF8(
61 KI_TEST::GetEeschemaTestDataDir() + "/plugins/pads/simple_schematic.txt" );
62
63 BOOST_CHECK( plugin.CanReadSchematicFile( padsFile ) );
64}
65
66
67BOOST_AUTO_TEST_CASE( CanReadSchematicFile_RejectNonPads )
68{
69 SCH_IO_PADS plugin;
70
71 wxString kicadFile = wxString::FromUTF8(
72 KI_TEST::GetEeschemaTestDataDir() + "/plugins/pads/simple_schematic.txt" );
73
74 BOOST_CHECK( plugin.CanReadSchematicFile( kicadFile ) );
75}
76
77
79{
80 IO_RELEASER<SCH_IO> pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_PADS ) );
81 BOOST_CHECK_NE( pi.get(), nullptr );
82}
83
84
A SCH_IO derivation for loading PADS Logic schematic files.
Definition sch_io_pads.h:40
bool CanReadSchematicFile(const wxString &aFileName) const override
Checks if this SCH_IO can read the specified schematic file.
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 GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(CanReadSchematicFile)