KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_fabmaster_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, 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
28
32
34
35#include <board.h>
36#include <footprint.h>
37#include <zone.h>
38
39
46
47
48BOOST_FIXTURE_TEST_SUITE( FabmasterImport, FABMASTER_IMPORT_FIXTURE )
49
50
51
60BOOST_AUTO_TEST_CASE( EmptyRefdesInPins )
61{
62 std::string dataPath =
63 KI_TEST::GetPcbnewTestDataDir() + "plugins/fabmaster/cds2f_only_2_comp.txt";
64
65 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
66
67 m_fabmasterPlugin.LoadBoard( dataPath, board.get(), nullptr );
68
69 BOOST_REQUIRE( board );
70
71 // The board should have footprints
72 BOOST_REQUIRE_GT( board->Footprints().size(), 0 );
73
74 // Each footprint should have pads (before the fix, pads were missing because
75 // the lookup by empty REFDES failed)
76 int totalPads = 0;
77
78 for( const FOOTPRINT* fp : board->Footprints() )
79 {
80 totalPads += fp->Pads().size();
81 }
82
83 BOOST_CHECK_MESSAGE( totalPads > 0,
84 "Footprints should have pads when REFDES is empty in PIN section" );
85}
86
87
99BOOST_AUTO_TEST_CASE( StaticShapesPreserved )
100{
101 std::string dataPath =
102 KI_TEST::GetPcbnewTestDataDir() + "plugins/fabmaster/cds2f_14066-20316FBRD.txt";
103
104 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
105
106 m_fabmasterPlugin.LoadBoard( dataPath, board.get(), nullptr );
107
108 BOOST_REQUIRE( board );
109
110 // Count zones - static shapes should be preserved as zones with net codes
111 int zonesWithNets = 0;
112
113 for( ZONE* zone : board->Zones() )
114 {
115 if( zone->GetNetCode() > 0 )
116 zonesWithNets++;
117 }
118
119 // The board should have some zones with nets assigned (static shapes).
120 // Before the fix, all netted zones were deleted because they were considered
121 // redundant fills. With the fix, unmatched static shapes are preserved.
122 BOOST_CHECK_MESSAGE( zonesWithNets > 0,
123 "Static shape zones with nets should be preserved" );
124}
125
126
General utilities for PCB file IO for QA programs.
Handle a list of polygons defining a copper zone.
Definition zone.h:74
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(EmptyRefdesInPins)
Test that footprints with pads are properly imported when the REFDES column is empty in the PIN secti...
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()