KiCad PCB EDA Suite
board_test_utils.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) 2019-2021 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
25
26#include <wx/filename.h>
27#include <board.h>
29#include <footprint.h>
30#include <fp_shape.h>
31#include <fp_text.h>
32#include <pad.h>
35#include <tool/tool_manager.h>
36#include <zone_filler.h>
37
38// For the temp directory logic: can be std::filesystem in C++17
39#include <boost/filesystem.hpp>
40#include <boost/test/unit_test.hpp>
41#include <board_commit.h>
42
43
44#define CHECK_ENUM_CLASS_EQUAL( L, R ) \
45 BOOST_CHECK_EQUAL( static_cast<int>( L ), static_cast<int>( R ) )
46
47
48namespace KI_TEST
49{
50
52 m_dump_boards( std::getenv( "KICAD_TEST_DUMP_BOARD_FILES" ) )
53{
54}
55
56
57void BOARD_DUMPER::DumpBoardToFile( BOARD& aBoard, const std::string& aName ) const
58{
59 if( !m_dump_boards )
60 return;
61
62 auto path = boost::filesystem::temp_directory_path() / aName;
63 path += ".kicad_pcb";
64
65 BOOST_TEST_MESSAGE( "Dumping board file: " << path.string() );
66 ::KI_TEST::DumpBoardToFile( aBoard, path.string() );
67}
68
69
70void LoadBoard( SETTINGS_MANAGER& aSettingsManager, const wxString& aRelPath,
71 std::unique_ptr<BOARD>& aBoard )
72{
73 if( aBoard )
74 {
75 aBoard->SetProject( nullptr );
76 aBoard = nullptr;
77 }
78
79 std::string absPath = GetPcbnewTestDataDir() + aRelPath.ToStdString();
80 wxFileName projectFile( absPath + ".kicad_pro" );
81 wxFileName legacyProject( absPath + ".pro" );
82 std::string boardPath = absPath + ".kicad_pcb";
83 wxFileName rulesFile( absPath + ".kicad_dru" );
84
85 if( projectFile.Exists() )
86 aSettingsManager.LoadProject( projectFile.GetFullPath() );
87 else if( legacyProject.Exists() )
88 aSettingsManager.LoadProject( legacyProject.GetFullPath() );
89
90 aBoard = ReadBoardFromFileOrStream( boardPath );
91
92 if( projectFile.Exists() || legacyProject.Exists() )
93 aBoard->SetProject( &aSettingsManager.Prj() );
94
95 auto m_DRCEngine = std::make_shared<DRC_ENGINE>( aBoard.get(), &aBoard->GetDesignSettings() );
96
97 if( rulesFile.Exists() )
98 m_DRCEngine->InitEngine( rulesFile );
99 else
100 m_DRCEngine->InitEngine( wxFileName() );
101
102 aBoard->GetDesignSettings().m_DRCEngine = m_DRCEngine;
103 aBoard->BuildListOfNets();
104 aBoard->BuildConnectivity();
105}
106
107
108void FillZones( BOARD* m_board )
109{
110 TOOL_MANAGER toolMgr;
111 toolMgr.SetEnvironment( m_board, nullptr, nullptr, nullptr, nullptr );
112
113 BOARD_COMMIT commit( &toolMgr );
114 ZONE_FILLER filler( m_board, &commit );
115 std::vector<ZONE*> toFill;
116
117 for( ZONE* zone : m_board->Zones() )
118 toFill.push_back( zone );
119
120 if( filler.Fill( toFill, false, nullptr ) )
121 commit.Push( _( "Fill Zone(s)" ), SKIP_UNDO | SKIP_SET_DIRTY | ZONE_FILL_OP | SKIP_CONNECTIVITY );
122
123 m_board->BuildConnectivity();
124}
125
126
127#define TEST( a, b ) \
128 { \
129 if( a != b ) \
130 return a < b; \
131 }
132#define TEST_PT( a, b ) \
133 { \
134 if( a.x != b.x ) \
135 return a.x < b.x; \
136 if( a.y != b.y ) \
137 return a.y < b.y; \
138 }
139
140
142{
144
145 bool operator()( const BOARD_ITEM* itemA, const BOARD_ITEM* itemB ) const
146 {
147 TEST( itemA->Type(), itemB->Type() );
148
149 if( itemA->GetLayerSet() != itemB->GetLayerSet() )
150 return itemA->GetLayerSet().Seq() < itemB->GetLayerSet().Seq();
151
152 if( itemA->Type() == PCB_FP_TEXT_T )
153 {
154 const FP_TEXT* textA = static_cast<const FP_TEXT*>( itemA );
155 const FP_TEXT* textB = static_cast<const FP_TEXT*>( itemB );
156
157 TEST( textA->GetType(), textB->GetType() );
158 TEST_PT( textA->GetPosition(), textB->GetPosition() );
159 TEST( textA->GetTextAngle(), textB->GetTextAngle() );
160 }
161
162 return fp_comp( itemA, itemB );
163 }
164};
165
166
168{
169 CHECK_ENUM_CLASS_EQUAL( expected->Type(), fp->Type() );
170
171 // TODO: validate those informations match the importer
172 BOOST_CHECK_EQUAL( expected->GetPosition(), fp->GetPosition() );
173 BOOST_CHECK_EQUAL( expected->GetOrientation(), fp->GetOrientation() );
174
175 BOOST_CHECK_EQUAL( expected->GetReference(), fp->GetReference() );
176 BOOST_CHECK_EQUAL( expected->GetValue(), fp->GetValue() );
177 BOOST_CHECK_EQUAL( expected->GetDescription(), fp->GetDescription() );
178 BOOST_CHECK_EQUAL( expected->GetKeywords(), fp->GetKeywords() );
179 BOOST_CHECK_EQUAL( expected->GetAttributes(), fp->GetAttributes() );
180 BOOST_CHECK_EQUAL( expected->GetFlag(), fp->GetFlag() );
181 //BOOST_CHECK_EQUAL( expected->GetProperties(), fp->GetProperties() );
182 BOOST_CHECK_EQUAL( expected->GetTypeName(), fp->GetTypeName() );
183
184 // simple test if count matches
185 BOOST_CHECK_EQUAL( expected->Pads().size(), fp->Pads().size() );
186 BOOST_CHECK_EQUAL( expected->GraphicalItems().size(), fp->GraphicalItems().size() );
187 BOOST_CHECK_EQUAL( expected->Zones().size(), fp->Zones().size() );
188 BOOST_CHECK_EQUAL( expected->Groups().size(), fp->Groups().size() );
189 BOOST_CHECK_EQUAL( expected->Models().size(), fp->Models().size() );
190
191 std::set<PAD*, FOOTPRINT::cmp_pads> expectedPads( expected->Pads().begin(),
192 expected->Pads().end() );
193 std::set<PAD*, FOOTPRINT::cmp_pads> fpPads( fp->Pads().begin(), fp->Pads().end() );
194 for( auto itExpected = expectedPads.begin(), itFp = fpPads.begin();
195 itExpected != expectedPads.end() && itFp != fpPads.end(); itExpected++, itFp++ )
196 {
197 CheckFpPad( *itExpected, *itFp );
198 }
199
200 std::set<BOARD_ITEM*, kitest_cmp_drawings> expectedGraphicalItems(
201 expected->GraphicalItems().begin(), expected->GraphicalItems().end() );
202 std::set<BOARD_ITEM*, kitest_cmp_drawings> fpGraphicalItems( fp->GraphicalItems().begin(),
203 fp->GraphicalItems().end() );
204 for( auto itExpected = expectedGraphicalItems.begin(), itFp = fpGraphicalItems.begin();
205 itExpected != expectedGraphicalItems.end() && itFp != fpGraphicalItems.end();
206 itExpected++, itFp++ )
207 {
208 BOOST_CHECK_EQUAL( ( *itExpected )->Type(), ( *itFp )->Type() );
209 switch( ( *itExpected )->Type() )
210 {
211 case PCB_FP_TEXT_T:
212 {
213 const FP_TEXT* expectedText = static_cast<const FP_TEXT*>( *itExpected );
214 const FP_TEXT* text = static_cast<const FP_TEXT*>( *itFp );
215
216 CheckFpText( expectedText, text );
217 }
218 break;
219 case PCB_FP_SHAPE_T:
220 {
221 const FP_SHAPE* expectedShape = static_cast<const FP_SHAPE*>( *itExpected );
222 const FP_SHAPE* shape = static_cast<const FP_SHAPE*>( *itFp );
223
224 CheckFpShape( expectedShape, shape );
225 }
226 break;
227 /*case PCB_FP_DIM_ALIGNED_T: break;
228 case PCB_FP_DIM_LEADER_T: break;
229 case PCB_FP_DIM_CENTER_T: break;
230 case PCB_FP_DIM_RADIAL_T: break;
231 case PCB_FP_DIM_ORTHOGONAL_T: break;*/
232 default: BOOST_ERROR( "KICAD_T not known" ); break;
233 }
234 }
235
236 std::set<FP_ZONE*, FOOTPRINT::cmp_zones> expectedZones( expected->Zones().begin(),
237 expected->Zones().end() );
238 std::set<FP_ZONE*, FOOTPRINT::cmp_zones> fpZones( fp->Zones().begin(), fp->Zones().end() );
239 for( auto itExpected = expectedZones.begin(), itFp = fpZones.begin();
240 itExpected != expectedZones.end() && itFp != fpZones.end(); itExpected++, itFp++ )
241 {
242 CheckFpZone( *itExpected, *itFp );
243 }
244
245 // TODO: Groups
246}
247
248
249void CheckFpPad( const PAD* expected, const PAD* pad )
250{
251 BOOST_TEST_CONTEXT( "Assert PAD with KIID=" << expected->m_Uuid.AsString() )
252 {
253 CHECK_ENUM_CLASS_EQUAL( expected->Type(), pad->Type() );
254
255 BOOST_CHECK_EQUAL( expected->GetNumber(), pad->GetNumber() );
256 CHECK_ENUM_CLASS_EQUAL( expected->GetAttribute(), pad->GetAttribute() );
257 CHECK_ENUM_CLASS_EQUAL( expected->GetProperty(), pad->GetProperty() );
258 CHECK_ENUM_CLASS_EQUAL( expected->GetShape(), pad->GetShape() );
259
260 BOOST_CHECK_EQUAL( expected->IsLocked(), pad->IsLocked() );
261
262 BOOST_CHECK_EQUAL( expected->GetPosition(), pad->GetPosition() );
263 BOOST_CHECK_EQUAL( expected->GetSize(), pad->GetSize() );
264 BOOST_CHECK_EQUAL( expected->GetOrientation(), pad->GetOrientation() );
265 BOOST_CHECK_EQUAL( expected->GetDelta(), pad->GetDelta() );
266 BOOST_CHECK_EQUAL( expected->GetOffset(), pad->GetOffset() );
267 BOOST_CHECK_EQUAL( expected->GetDrillSize(), pad->GetDrillSize() );
268 CHECK_ENUM_CLASS_EQUAL( expected->GetDrillShape(), pad->GetDrillShape() );
269
270 BOOST_CHECK_EQUAL( expected->GetLayerSet(), pad->GetLayerSet() );
271
272 BOOST_CHECK_EQUAL( expected->GetNetCode(), pad->GetNetCode() );
273 BOOST_CHECK_EQUAL( expected->GetPinFunction(), pad->GetPinFunction() );
274 BOOST_CHECK_EQUAL( expected->GetPinType(), pad->GetPinType() );
275 BOOST_CHECK_EQUAL( expected->GetPadToDieLength(), pad->GetPadToDieLength() );
276 BOOST_CHECK_EQUAL( expected->GetLocalSolderMaskMargin(), pad->GetLocalSolderMaskMargin() );
277 BOOST_CHECK_EQUAL( expected->GetLocalSolderPasteMargin(),
278 pad->GetLocalSolderPasteMargin() );
279 BOOST_CHECK_EQUAL( expected->GetLocalSolderPasteMarginRatio(),
280 pad->GetLocalSolderPasteMarginRatio() );
281 BOOST_CHECK_EQUAL( expected->GetLocalClearance(), pad->GetLocalClearance() );
282 CHECK_ENUM_CLASS_EQUAL( expected->GetZoneConnection(), pad->GetZoneConnection() );
283 BOOST_CHECK_EQUAL( expected->GetThermalSpokeWidth(), pad->GetThermalSpokeWidth() );
284 BOOST_CHECK_EQUAL( expected->GetThermalSpokeAngle(), pad->GetThermalSpokeAngle() );
285 BOOST_CHECK_EQUAL( expected->GetThermalGap(), pad->GetThermalGap() );
286 BOOST_CHECK_EQUAL( expected->GetRoundRectRadiusRatio(), pad->GetRoundRectRadiusRatio() );
287 BOOST_CHECK_EQUAL( expected->GetChamferRectRatio(), pad->GetChamferRectRatio() );
288 BOOST_CHECK_EQUAL( expected->GetChamferPositions(), pad->GetChamferPositions() );
289 BOOST_CHECK_EQUAL( expected->GetRemoveUnconnected(), pad->GetRemoveUnconnected() );
290 BOOST_CHECK_EQUAL( expected->GetKeepTopBottom(), pad->GetKeepTopBottom() );
291
292 // TODO: check complex pad shapes
293 CHECK_ENUM_CLASS_EQUAL( expected->GetAnchorPadShape(), pad->GetAnchorPadShape() );
294 CHECK_ENUM_CLASS_EQUAL( expected->GetCustomShapeInZoneOpt(),
295 pad->GetCustomShapeInZoneOpt() );
296 }
297}
298
299
300void CheckFpText( const FP_TEXT* expected, const FP_TEXT* text )
301{
302 BOOST_TEST_CONTEXT( "Assert FP_TEXT with KIID=" << expected->m_Uuid.AsString() )
303 {
304 CHECK_ENUM_CLASS_EQUAL( expected->Type(), text->Type() );
305
306 CHECK_ENUM_CLASS_EQUAL( expected->GetType(), text->GetType() );
307
308 BOOST_CHECK_EQUAL( expected->IsLocked(), text->IsLocked() );
309
310 BOOST_CHECK_EQUAL( expected->GetText(), text->GetText() );
311 BOOST_CHECK_EQUAL( expected->GetPosition(), text->GetPosition() );
312 BOOST_CHECK_EQUAL( expected->GetTextAngle(), text->GetTextAngle() );
313 BOOST_CHECK_EQUAL( expected->IsKeepUpright(), text->IsKeepUpright() );
314
315 BOOST_CHECK_EQUAL( expected->GetLayerSet(), text->GetLayerSet() );
316 BOOST_CHECK_EQUAL( expected->IsVisible(), text->IsVisible() );
317
318 BOOST_CHECK_EQUAL( expected->GetTextSize(), text->GetTextSize() );
319 BOOST_CHECK_EQUAL( expected->GetLineSpacing(), text->GetLineSpacing() );
320 BOOST_CHECK_EQUAL( expected->GetTextThickness(), text->GetTextThickness() );
321 BOOST_CHECK_EQUAL( expected->IsBold(), text->IsBold() );
322 BOOST_CHECK_EQUAL( expected->IsItalic(), text->IsItalic() );
323 BOOST_CHECK_EQUAL( expected->GetHorizJustify(), text->GetHorizJustify() );
324 BOOST_CHECK_EQUAL( expected->GetVertJustify(), text->GetVertJustify() );
325 BOOST_CHECK_EQUAL( expected->IsMirrored(), text->IsMirrored() );
326 BOOST_CHECK_EQUAL( expected->GetFontName(),
327 text->GetFontName() ); // TODO: bold/italic setting?
328
329 // TODO: render cache?
330 }
331}
332
333
334void CheckFpShape( const FP_SHAPE* expected, const FP_SHAPE* shape )
335{
336 BOOST_TEST_CONTEXT( "Assert FP_SHAPE with KIID=" << expected->m_Uuid.AsString() )
337 {
338 CHECK_ENUM_CLASS_EQUAL( expected->Type(), shape->Type() );
339
340 CHECK_ENUM_CLASS_EQUAL( expected->GetShape(), shape->GetShape() );
341
342 BOOST_CHECK_EQUAL( expected->IsLocked(), shape->IsLocked() );
343
344 BOOST_CHECK_EQUAL( expected->GetStart(), shape->GetStart() );
345 BOOST_CHECK_EQUAL( expected->GetEnd(), shape->GetEnd() );
346 if( expected->GetShape() == SHAPE_T::ARC )
347 {
348 // center and position might differ as they are calculated from start/mid/end -> compare mid instead
349 BOOST_CHECK_EQUAL( expected->GetArcMid(), shape->GetArcMid() );
350 }
351 else
352 {
353 BOOST_CHECK_EQUAL( expected->GetCenter(), shape->GetCenter() );
354 BOOST_CHECK_EQUAL( expected->GetPosition(), shape->GetPosition() );
355 }
356 BOOST_CHECK_EQUAL( expected->GetBezierC1(), shape->GetBezierC1() );
357 BOOST_CHECK_EQUAL( expected->GetBezierC2(), shape->GetBezierC2() );
358
359 CheckShapePolySet( &expected->GetPolyShape(), &shape->GetPolyShape() );
360
361 BOOST_CHECK_EQUAL( expected->GetLayerSet(), shape->GetLayerSet() );
362
363 BOOST_CHECK_EQUAL( expected->GetStroke().GetWidth(), shape->GetStroke().GetWidth() );
364 CHECK_ENUM_CLASS_EQUAL( expected->GetStroke().GetPlotStyle(),
365 shape->GetStroke().GetPlotStyle() );
366 CHECK_ENUM_CLASS_EQUAL( expected->GetFillMode(), shape->GetFillMode() );
367 }
368}
369
370
371void CheckFpZone( const FP_ZONE* expected, const FP_ZONE* zone )
372{
373 BOOST_TEST_CONTEXT( "Assert FP_ZONE with KIID=" << expected->m_Uuid.AsString() )
374 {
375 CHECK_ENUM_CLASS_EQUAL( expected->Type(), zone->Type() );
376
377 BOOST_CHECK_EQUAL( expected->IsLocked(), zone->IsLocked() );
378
379 BOOST_CHECK_EQUAL( expected->GetNetCode(), zone->GetNetCode() );
380 BOOST_CHECK_EQUAL( expected->GetAssignedPriority(), zone->GetAssignedPriority() );
381 CHECK_ENUM_CLASS_EQUAL( expected->GetPadConnection(), zone->GetPadConnection() );
382 BOOST_CHECK_EQUAL( expected->GetLocalClearance(), zone->GetLocalClearance() );
383 BOOST_CHECK_EQUAL( expected->GetMinThickness(), zone->GetMinThickness() );
384
385 BOOST_CHECK_EQUAL( expected->GetLayerSet(), zone->GetLayerSet() );
386
387 BOOST_CHECK_EQUAL( expected->IsFilled(), zone->IsFilled() );
388 CHECK_ENUM_CLASS_EQUAL( expected->GetFillMode(), zone->GetFillMode() );
389 BOOST_CHECK_EQUAL( expected->GetHatchThickness(), zone->GetHatchThickness() );
390 BOOST_CHECK_EQUAL( expected->GetHatchGap(), zone->GetHatchGap() );
391 BOOST_CHECK_EQUAL( expected->GetHatchOrientation(), zone->GetHatchOrientation() );
392 BOOST_CHECK_EQUAL( expected->GetHatchSmoothingLevel(), zone->GetHatchSmoothingLevel() );
393 BOOST_CHECK_EQUAL( expected->GetHatchSmoothingValue(), zone->GetHatchSmoothingValue() );
394 BOOST_CHECK_EQUAL( expected->GetHatchBorderAlgorithm(), zone->GetHatchBorderAlgorithm() );
395 BOOST_CHECK_EQUAL( expected->GetHatchHoleMinArea(), zone->GetHatchHoleMinArea() );
396 BOOST_CHECK_EQUAL( expected->GetThermalReliefGap(), zone->GetThermalReliefGap() );
397 BOOST_CHECK_EQUAL( expected->GetThermalReliefSpokeWidth(),
399 BOOST_CHECK_EQUAL( expected->GetCornerSmoothingType(), zone->GetCornerSmoothingType() );
400 BOOST_CHECK_EQUAL( expected->GetCornerRadius(), zone->GetCornerRadius() );
401 CHECK_ENUM_CLASS_EQUAL( expected->GetIslandRemovalMode(), zone->GetIslandRemovalMode() );
402 BOOST_CHECK_EQUAL( expected->GetMinIslandArea(), zone->GetMinIslandArea() );
403
404 BOOST_CHECK_EQUAL( expected->GetIsRuleArea(), zone->GetIsRuleArea() );
405 BOOST_CHECK_EQUAL( expected->GetDoNotAllowCopperPour(), zone->GetDoNotAllowCopperPour() );
406 BOOST_CHECK_EQUAL( expected->GetDoNotAllowVias(), zone->GetDoNotAllowVias() );
407 BOOST_CHECK_EQUAL( expected->GetDoNotAllowTracks(), zone->GetDoNotAllowTracks() );
408 BOOST_CHECK_EQUAL( expected->GetDoNotAllowPads(), zone->GetDoNotAllowPads() );
409 BOOST_CHECK_EQUAL( expected->GetDoNotAllowFootprints(), zone->GetDoNotAllowFootprints() );
410
411 BOOST_CHECK_EQUAL( expected->GetZoneName(), zone->GetZoneName() );
412 CHECK_ENUM_CLASS_EQUAL( expected->GetTeardropAreaType(), zone->GetTeardropAreaType() );
413 BOOST_CHECK_EQUAL( expected->GetZoneName(), zone->GetZoneName() );
414
415 CheckShapePolySet( expected->Outline(), zone->Outline() );
416 // TODO: filled zones
417 }
418}
419
420
422{
423 BOOST_TEST_CONTEXT( "Assert SHAPE_POLY_SET" )
424 {
425 BOOST_CHECK_EQUAL( expected->OutlineCount(), polyset->OutlineCount() );
426 BOOST_CHECK_EQUAL( expected->TotalVertices(), polyset->TotalVertices() );
427
428 // TODO: check all outlines and holes
429 }
430}
431
432} // namespace KI_TEST
#define SKIP_CONNECTIVITY
Definition: board_commit.h:42
#define SKIP_SET_DIRTY
Definition: board_commit.h:41
#define SKIP_UNDO
Definition: board_commit.h:39
#define ZONE_FILL_OP
Definition: board_commit.h:43
General utilities for PCB file IO for QA programs.
#define CHECK_ENUM_CLASS_EQUAL(L, R)
#define TEST_PT(a, b)
#define TEST(a, b)
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:70
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:197
virtual bool IsLocked() const
Definition: board_item.cpp:71
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:269
ZONES & Zones()
Definition: board.h:317
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
Definition: board.cpp:166
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
const VECTOR2I & GetBezierC2() const
Definition: eda_shape.h:179
FILL_T GetFillMode() const
Definition: eda_shape.h:101
SHAPE_POLY_SET & GetPolyShape()
Definition: eda_shape.h:247
SHAPE_T GetShape() const
Definition: eda_shape.h:113
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:145
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:120
const VECTOR2I & GetBezierC1() const
Definition: eda_shape.h:176
VECTOR2I GetArcMid() const
Definition: eda_shape.cpp:488
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:120
EDA_ANGLE GetOrientation() const
Definition: footprint.h:191
wxString GetDescription() const
Definition: footprint.h:218
FP_GROUPS & Groups()
Definition: footprint.h:179
int GetAttributes() const
Definition: footprint.h:250
PADS & Pads()
Definition: footprint.h:170
wxString GetTypeName() const
Get the type of footprint.
Definition: footprint.cpp:771
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:184
const wxString & GetValue() const
Definition: footprint.h:547
const wxString & GetReference() const
Definition: footprint.h:519
int GetFlag() const
Definition: footprint.h:255
FP_ZONES & Zones()
Definition: footprint.h:176
wxString GetKeywords() const
Definition: footprint.h:221
VECTOR2I GetPosition() const override
Definition: footprint.h:188
DRAWINGS & GraphicalItems()
Definition: footprint.h:173
virtual VECTOR2I GetPosition() const override
Definition: fp_text.h:87
TEXT_TYPE GetType() const
Definition: fp_text.h:120
A specialization of ZONE for use in footprints.
Definition: zone.h:916
void DumpBoardToFile(BOARD &aBoard, const std::string &aName) const
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
Definition: pad.h:60
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_shape.h:67
STROKE_PARAMS GetStroke() const override
Definition: pcb_shape.h:71
VECTOR2I GetPosition() const override
Definition: pcb_shape.h:65
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Loads a project or sets up a new project with a specified path.
PROJECT & Prj() const
A helper while we are not MDI-capable – return the one and only project.
Represent a set of closed polygons.
int TotalVertices() const
Delete aIdx-th polygon from the set.
int OutlineCount() const
Return the number of vertices in a given outline/hole.
int GetWidth() const
Definition: stroke_params.h:98
PLOT_DASH_TYPE GetPlotStyle() const
Master controller class:
Definition: tool_manager.h:55
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
bool Fill(std::vector< ZONE * > &aZones, bool aCheck=false, wxWindow *aParent=nullptr)
Fills the given list of zones.
Definition: zone_filler.cpp:89
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
int GetHatchBorderAlgorithm() const
Definition: zone.h:284
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:703
bool GetDoNotAllowVias() const
Definition: zone.h:705
const ISLAND_REMOVAL_MODE GetIslandRemovalMode() const
Definition: zone.h:717
bool GetDoNotAllowPads() const
Definition: zone.h:707
bool GetDoNotAllowTracks() const
Definition: zone.h:706
bool IsFilled() const
Definition: zone.h:242
SHAPE_POLY_SET * Outline()
Definition: zone.h:318
long long int GetMinIslandArea() const
Definition: zone.h:720
wxString GetZoneName() const
Definition: zone.h:124
int GetLocalClearance(wxString *aSource) const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
Definition: zone.cpp:476
int GetMinThickness() const
Definition: zone.h:251
ZONE_CONNECTION GetPadConnection() const
Definition: zone.h:248
int GetHatchThickness() const
Definition: zone.h:266
double GetHatchHoleMinArea() const
Definition: zone.h:281
int GetThermalReliefSpokeWidth() const
Definition: zone.h:195
EDA_ANGLE GetHatchOrientation() const
Definition: zone.h:272
bool GetDoNotAllowFootprints() const
Definition: zone.h:708
ZONE_FILL_MODE GetFillMode() const
Definition: zone.h:174
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.h:122
bool GetDoNotAllowCopperPour() const
Definition: zone.h:704
int GetHatchGap() const
Definition: zone.h:269
TEARDROP_TYPE GetTeardropAreaType() const
Definition: zone.h:698
double GetHatchSmoothingValue() const
Definition: zone.h:278
int GetHatchSmoothingLevel() const
Definition: zone.h:275
unsigned int GetCornerRadius() const
Definition: zone.h:658
int GetCornerSmoothingType() const
Definition: zone.h:654
int GetThermalReliefGap() const
Definition: zone.h:184
unsigned GetAssignedPriority() const
Definition: zone.h:112
#define _(s)
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
void LoadBoard(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard)
void CheckFootprint(const FOOTPRINT *expected, const FOOTPRINT *fp)
Helper method to check if two footprints are semantically the same.
void FillZones(BOARD *m_board)
void CheckFpZone(const FP_ZONE *expected, const FP_ZONE *zone)
std::unique_ptr< BOARD > ReadBoardFromFileOrStream(const std::string &aFilename, std::istream &aFallback)
Read a board from a file, or another stream, as appropriate.
void DumpBoardToFile(BOARD &board, const std::string &aFilename)
Utility function to simply write a Board out to a file.
void CheckFpPad(const PAD *expected, const PAD *pad)
void CheckFpShape(const FP_SHAPE *expected, const FP_SHAPE *shape)
void CheckFpText(const FP_TEXT *expected, const FP_TEXT *text)
void CheckShapePolySet(const SHAPE_POLY_SET *expected, const SHAPE_POLY_SET *polyset)
Definition: bitmap.cpp:65
FOOTPRINT::cmp_drawings fp_comp
bool operator()(const BOARD_ITEM *itemA, const BOARD_ITEM *itemB) const
VECTOR3I expected(15, 30, 45)
@ PCB_FP_SHAPE_T
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:94
@ PCB_FP_TEXT_T
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
#define BOOST_TEST_CONTEXT(A)