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 <alejandro.garciamontoro@gmail.com>
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 <kiway.h>
28 #include <sch_io_mgr.h>
29 
30 #include "eeschema_test_utils.h"
31 
35 BOOST_AUTO_TEST_CASE( FindPlugin )
36 {
37  SCH_PLUGIN* pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE );
38  BOOST_CHECK_NE( pi, nullptr );
40 }
41 
42 
46 static wxFileName getEagleTestSchematic( const wxString& sch_file )
47 {
48  wxFileName fn = KI_TEST::GetEeschemaTestDataDir();
49  fn.AppendDir( "eagle_schematics" );
50  fn.SetFullName( sch_file );
51 
52  return fn;
53 }
54 
55 
60 {
61  SCH_PLUGIN* pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE );
62 
63  const auto fn = getEagleTestSchematic( "eagle-import-testfile.sch" );
64 
65  BOOST_TEST_MESSAGE( fn.GetFullPath() );
66 
67  (void) pi;
68  // This doesn't work with a null KiWay.
69  // const SCH_SHEET* sheet = pi->Load( fn.GetFullPath(), nullptr );
70  // BOOST_CHECK_NE( nullptr, sheet );
71 
73 }
BOOST_AUTO_TEST_CASE(FindPlugin)
Checks that the SCH_IO manager finds the Eagle plugin.
Base class that schematic file and library loading and saving plugins should derive from.
Definition: sch_io_mgr.h:151
wxFileName GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
static wxFileName getEagleTestSchematic(const wxString &sch_file)
Get a schematic file from the test data eagle subdir.
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:69