KiCad PCB EDA Suite
test_eagle_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 (C) 2017 CERN
5 * @author Alejandro GarcĂ­a Montoro <[email protected]>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
26
27#include <ignore.h>
28#include <kiway.h>
29#include <sch_io_mgr.h>
30
31#include "eeschema_test_utils.h"
32
37{
38 SCH_PLUGIN* pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE );
39 BOOST_CHECK_NE( pi, nullptr );
41}
42
43
47static wxFileName getEagleTestSchematic( const wxString& sch_file )
48{
49 wxFileName fn = KI_TEST::GetEeschemaTestDataDir();
50 fn.AppendDir( "eagle_schematics" );
51 fn.SetFullName( sch_file );
52
53 return fn;
54}
55
56
61{
62 SCH_PLUGIN* pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE );
63
64 const auto fn = getEagleTestSchematic( "eagle-import-testfile.sch" );
65
66 BOOST_TEST_MESSAGE( fn.GetFullPath() );
67
68 ignore_unused( pi );
69 // This doesn't work with a null KiWay.
70 // const SCH_SHEET* sheet = pi->Load( fn.GetFullPath(), nullptr );
71 // BOOST_CHECK_NE( nullptr, sheet );
72
74}
KICAD_PLUGIN_EXPORT SCENEGRAPH * Load(char const *aFileName)
reads a model file and creates a generic display structure
static void ReleasePlugin(SCH_PLUGIN *aPlugin)
Release a SCH_PLUGIN back to the system, and may cause it to be unloaded from memory.
Definition: sch_io_mgr.cpp:71
Base class that schematic file and library loading and saving plugins should derive from.
Definition: sch_io_mgr.h:155
void ignore_unused(const T &)
Definition: ignore.h:24
wxFileName GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
BOOST_AUTO_TEST_CASE(FindPlugin)
Checks that the SCH_IO manager finds the Eagle plugin.
static wxFileName getEagleTestSchematic(const wxString &sch_file)
Get a schematic file from the test data eagle subdir.