KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_eagle_lbr_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, see <https://www.gnu.org/licenses/>.
18 */
19
24
28
31
32#include <footprint.h>
33#include <pad.h>
34#include <zone.h>
35
36
44
45
49BOOST_FIXTURE_TEST_SUITE( EagleLbrLibImport, EAGLE_LBR_IMPORT_FIXTURE )
50
51
52
55BOOST_AUTO_TEST_CASE( EagleLbrLibImport )
56{
57 // clang-format off
58 std::vector<std::pair<wxString, wxString>> tests = {
59 { "SparkFun-GPS.lbr", "SparkFun-GPS.pretty" }
60 };
61 // clang-format on
62
63 std::string dataPath = KI_TEST::GetPcbnewTestDataDir() + "plugins/eagle/lbr/";
64
65 for( const std::pair<wxString, wxString>& libName : tests )
66 {
67 wxString eagleLibraryPath = dataPath + libName.first;
68 wxString kicadLibraryPath = dataPath + libName.second;
69
70 wxArrayString eagleFootprintNames;
71 wxArrayString kicadFootprintNames;
72
73 eaglePlugin.FootprintEnumerate( eagleFootprintNames, eagleLibraryPath, true, nullptr );
74 kicadPlugin.FootprintEnumerate( kicadFootprintNames, kicadLibraryPath, true, nullptr );
75
76 BOOST_CHECK_EQUAL( eagleFootprintNames.GetCount(), kicadFootprintNames.GetCount() );
77
78 for( size_t i = 0; i < eagleFootprintNames.GetCount(); i++ )
79 {
80 wxString footprintName = eagleFootprintNames[i];
81
82 BOOST_TEST_CONTEXT( wxString::Format( wxT( "Import '%s' from '%s'" ), footprintName,
83 libName.first ) )
84 {
85 FOOTPRINT* eagleFp = eaglePlugin.FootprintLoad( eagleLibraryPath, footprintName,
86 false, nullptr );
87 BOOST_CHECK( eagleFp );
88
89 BOOST_CHECK_EQUAL( "REF**", eagleFp->GetReference() );
90 BOOST_CHECK_EQUAL( footprintName, eagleFp->GetValue() );
91
92 FOOTPRINT* kicadFp = kicadPlugin.FootprintLoad( kicadLibraryPath, footprintName,
93 true, nullptr );
94 BOOST_CHECK( kicadFp );
95
96 KI_TEST::CheckFootprint( kicadFp, eagleFp );
97 }
98 }
99 }
100}
101
102
General utilities for PCB file IO for QA programs.
const wxString & GetValue() const
Definition footprint.h:863
const wxString & GetReference() const
Definition footprint.h:841
Works with Eagle 6.x XML board files and footprints to implement the Pcbnew #PLUGIN API or a portion ...
A #PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
void CheckFootprint(const FOOTPRINT *expected, const FOOTPRINT *fp)
Helper method to check if two footprints are semantically the same.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST_CONTEXT("Test Clearance")
BOOST_CHECK_EQUAL(result, "25.4")