KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_pcb_grid_helper.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 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#define BOOST_TEST_NO_MAIN
19#include <boost/test/unit_test.hpp>
20
22#include <geometry/seg.h>
23#include <geometry/shape_arc.h>
24#include <footprint.h>
25#include <pad.h>
26#include <pcb_shape.h>
27#include <pcb_track.h>
28#include <zone.h>
29#include <pcb_text.h>
30
31// Mock EDA_ITEM class for testing GetItemGrid
33{
34public:
36 BOARD_ITEM( nullptr, aType )
37 {
38 }
39
40 // Required virtual functions
41 wxString GetClass() const override { return "MockEDAItem"; }
42 void Move( const VECTOR2I& aMoveVector ) override {}
43 VECTOR2I GetPosition() const override { return VECTOR2I( 0, 0 ); }
44 void SetPosition( const VECTOR2I& aPos ) override {}
45 BOARD_ITEM* Clone() const override { return new MOCK_BOARD_ITEM( Type() ); }
46
47 // Implement pure virtuals from BOARD_ITEM
48 double Similarity( const BOARD_ITEM& aItem ) const override { return this == &aItem ? 1.0 : 0.0; }
49 bool operator==( const BOARD_ITEM& aItem ) const override { return this == &aItem; }
50};
51
52// Test fixture for accessing protected members
54{
55public:
57 {
58 helper.SetGridSize( VECTOR2D( 100, 100 ) );
59 helper.SetOrigin( VECTOR2I( 0, 0 ) );
60 helper.SetGridSnapping( true );
61 helper.SetSnap( true );
62 }
63
64 static BOX2I LayoutBounds( const BOARD_ITEM& aItem ) { return PCB_GRID_HELPER::layoutBounds( aItem ); }
65
66 static SNAP_REFERENCE_PREFERENCE ClassifyReference( const VECTOR2I& aPoint, const BOX2I& aBounds, bool aPadCenter )
67 {
68 return PCB_GRID_HELPER::classifyReference( aPoint, aBounds, aPadCenter );
69 }
70
72};
73
74BOOST_AUTO_TEST_SUITE( PCBGridHelperTest )
75
76BOOST_AUTO_TEST_CASE( DefaultConstructor )
77{
78 PCB_GRID_HELPER helper;
79
80 // Test default state matches base class
81 BOOST_CHECK( helper.GetSnap() );
82 BOOST_CHECK( helper.GetUseGrid() );
83
84 // Test that GetSnapped returns nullptr initially
85 BOOST_CHECK( helper.GetSnapped() == nullptr );
86}
87
88
89BOOST_AUTO_TEST_CASE( FootprintLayoutBoundsExcludeText )
90{
91 FOOTPRINT footprint( nullptr );
92 footprint.SetPosition( { 0, 0 } );
93 footprint.Reference().SetVisible( false );
94 footprint.Value().SetVisible( false );
95
96 PCB_SHAPE* rectangle = new PCB_SHAPE( &footprint, SHAPE_T::RECTANGLE );
97 rectangle->SetStart( { -1000, -500 } );
98 rectangle->SetEnd( { 1000, 500 } );
99 rectangle->SetLayer( F_Fab );
100 footprint.Add( rectangle, ADD_MODE::APPEND );
101
102 PCB_TEXT* text = new PCB_TEXT( &footprint );
103 text->SetText( wxString( "far away" ) );
104 text->SetTextPos( { 100000, 100000 } );
105 text->SetLayer( F_SilkS );
106 footprint.Add( text, ADD_MODE::APPEND );
107
108 BOOST_CHECK( PCBGridHelperTestFixture::LayoutBounds( footprint ) == footprint.GetBoundingBox( false ) );
109 BOOST_CHECK( PCBGridHelperTestFixture::LayoutBounds( footprint ) != footprint.GetBoundingBox( true ) );
110}
111
112
113BOOST_AUTO_TEST_CASE( DragReferenceClassificationFollowsChosenPoint )
114{
115 BOX2I bounds( { 0, 0 }, { 100, 60 } );
116
118 BOOST_CHECK( center.kind == SNAP_REFERENCE_KIND::BOUNDS_FEATURE );
119 BOOST_CHECK_EQUAL( center.horizontalFeature, 1 );
120 BOOST_CHECK_EQUAL( center.verticalFeature, 1 );
121
125
127 BOOST_CHECK( pad.kind == SNAP_REFERENCE_KIND::ANCHOR_POINT );
128}
129
130
131BOOST_AUTO_TEST_CASE( AlignToSegmentBasic )
132{
133 PCB_GRID_HELPER helper;
134 helper.SetGridSize( VECTOR2D( 100, 100 ) );
135 helper.SetOrigin( VECTOR2I( 0, 0 ) );
136 helper.SetGridSnapping( true );
137
138 // Horizontal segment
139 SEG seg( VECTOR2I( 0, 0 ), VECTOR2I( 300, 0 ) );
140 VECTOR2I result = helper.AlignToSegment( VECTOR2I( 150, 50 ), seg );
141
142 // Should snap to grid point that intersects with segment
143 BOOST_CHECK_EQUAL( result.x, 200 );
145}
146
147BOOST_AUTO_TEST_CASE( AlignToSegmentVertical )
148{
149 PCB_GRID_HELPER helper;
150 helper.SetGridSize( VECTOR2D( 100, 100 ) );
151 helper.SetOrigin( VECTOR2I( 0, 0 ) );
152 helper.SetGridSnapping( true );
153
154 // Vertical segment
155 SEG seg( VECTOR2I( 200, 0 ), VECTOR2I( 200, 400 ) );
156 VECTOR2I result = helper.AlignToSegment( VECTOR2I( 150, 150 ), seg );
157
158 // Should snap to intersection with vertical line
159 BOOST_CHECK_EQUAL( result.x, 200 );
160 BOOST_CHECK_EQUAL( result.y, 200 );
161}
162
163BOOST_AUTO_TEST_CASE( AlignToSegmentDiagonal )
164{
165 PCB_GRID_HELPER helper;
166 helper.SetGridSize( VECTOR2D( 100, 100 ) );
167 helper.SetOrigin( VECTOR2I( 0, 0 ) );
168 helper.SetGridSnapping( true );
169
170 // Diagonal segment
171 SEG seg( VECTOR2I( 0, 0 ), VECTOR2I( 400, 400 ) );
172 VECTOR2I result = helper.AlignToSegment( VECTOR2I( 150, 250 ), seg );
173
174 // 250,250 is the closest point to the nearest grid point to the segment.
175 // First, it snaps to grid point (200, 300) and then finds the closest point on the segment.
176 // So the result should be (250, 250).
177 BOOST_CHECK_EQUAL( result.x, 250 );
178 BOOST_CHECK_EQUAL( result.y, 250 );
179}
180
181BOOST_AUTO_TEST_CASE( AlignToSegmentEndpoints )
182{
183 PCB_GRID_HELPER helper;
184 helper.SetGridSize( VECTOR2D( 100, 100 ) );
185 helper.SetOrigin( VECTOR2I( 0, 0 ) );
186 helper.SetGridSnapping( true );
187
188 SEG seg( VECTOR2I( 50, 50 ), VECTOR2I( 150, 50 ) );
189
190 // Point very close to start endpoint
191 VECTOR2I result = helper.AlignToSegment( VECTOR2I( 55, 55 ), seg );
192 BOOST_CHECK_EQUAL( result.x, 50 );
193 BOOST_CHECK_EQUAL( result.y, 50 );
194
195 // Point very close to end endpoint
196 result = helper.AlignToSegment( VECTOR2I( 145, 55 ), seg );
197 BOOST_CHECK_EQUAL( result.x, 150 );
198 BOOST_CHECK_EQUAL( result.y, 50 );
199}
200
201BOOST_AUTO_TEST_CASE( AlignToSegmentSnapDisabled )
202{
203 PCB_GRID_HELPER helper;
204 helper.SetGridSize( VECTOR2D( 100, 100 ) );
205 helper.SetOrigin( VECTOR2I( 0, 0 ) );
206 helper.SetGridSnapping( true );
207 helper.SetSnap( false ); // Disable snapping
208
209 SEG seg( VECTOR2I( 0, 0 ), VECTOR2I( 300, 0 ) );
210 VECTOR2I point( 150, 50 );
211 VECTOR2I result = helper.AlignToSegment( point, seg );
212
213 // Should return grid-aligned point when snap is disabled
214 VECTOR2I expected = helper.Align( point );
217}
218
219BOOST_AUTO_TEST_CASE( AlignToArcBasic )
220{
221 PCB_GRID_HELPER helper;
222 helper.SetGridSize( VECTOR2D( 100, 100 ) );
223 helper.SetOrigin( VECTOR2I( 0, 0 ) );
224 helper.SetGridSnapping( true );
225
226 // Create a simple arc (quarter circle)
227 SHAPE_ARC arc( VECTOR2I( 100, 0 ), VECTOR2I( 0, 100 ), ANGLE_90 );
228
229 VECTOR2I result = helper.AlignToArc( VECTOR2I( 50, 50 ), arc );
230
231 // Should snap to arc endpoints or intersections
232 BOOST_CHECK( result.x >= 0 );
233 BOOST_CHECK( result.y >= 0 );
234}
235
236// TODO: Fix broken AlignToArc Routine
237// BOOST_AUTO_TEST_CASE( AlignToArcEndpoints )
238// {
239// PCB_GRID_HELPER helper;
240// helper.SetGridSize( VECTOR2D( 100, 100 ) );
241// helper.SetOrigin( VECTOR2I( 0, 0 ) );
242// helper.SetGridSnapping( true );
243
244// SHAPE_ARC arc( VECTOR2I( 100, 0 ), VECTOR2I( 65, 65 ), VECTOR2I( 0, 100 ), 0 );
245
246// // Point close to start
247// VECTOR2I result = helper.AlignToArc( VECTOR2I( 95, 5 ), arc );
248// BOOST_CHECK_EQUAL( result.x, arc.GetP0().x );
249// BOOST_CHECK_EQUAL( result.y, arc.GetP0().y );
250
251// // Point close to end
252// result = helper.AlignToArc( VECTOR2I( 5, 95 ), arc );
253// BOOST_CHECK_EQUAL( result.x, arc.GetP1().x );
254// BOOST_CHECK_EQUAL( result.y, arc.GetP1().y );
255// }
256
257BOOST_AUTO_TEST_CASE( AlignToArcSnapDisabled )
258{
259 PCB_GRID_HELPER helper;
260 helper.SetGridSize( VECTOR2D( 100, 100 ) );
261 helper.SetOrigin( VECTOR2I( 0, 0 ) );
262 helper.SetGridSnapping( true );
263 helper.SetSnap( false ); // Disable snapping
264
265 SHAPE_ARC arc( VECTOR2I( 100, 0 ), VECTOR2I( 0, 100 ), ANGLE_90 );
266 VECTOR2I point( 50, 50 );
267 VECTOR2I result = helper.AlignToArc( point, arc );
268
269 // Should return grid-aligned point when snap is disabled
270 VECTOR2I expected = helper.Align( point );
273}
274
275BOOST_AUTO_TEST_CASE( GetItemGridFootprint )
276{
277 PCB_GRID_HELPER helper;
278
279 MOCK_BOARD_ITEM footprint( PCB_FOOTPRINT_T );
280 GRID_HELPER_GRIDS grid = helper.GetItemGrid( &footprint );
282}
283
292
293BOOST_AUTO_TEST_CASE( GetItemGridText )
294{
295 PCB_GRID_HELPER helper;
296
300
302 grid = helper.GetItemGrid( &field );
304}
305
306BOOST_AUTO_TEST_CASE( GetItemGridGraphics )
307{
308 PCB_GRID_HELPER helper;
309
311 GRID_HELPER_GRIDS grid = helper.GetItemGrid( &shape );
313
314 MOCK_BOARD_ITEM dimension( PCB_DIMENSION_T );
315 grid = helper.GetItemGrid( &dimension );
317
319 grid = helper.GetItemGrid( &refImage );
321
323 grid = helper.GetItemGrid( &textbox );
325}
326
327BOOST_AUTO_TEST_CASE( GetItemGridTracks )
328{
329 PCB_GRID_HELPER helper;
330
332 GRID_HELPER_GRIDS grid = helper.GetItemGrid( &trace );
334
336 grid = helper.GetItemGrid( &arc );
338}
339
340BOOST_AUTO_TEST_CASE( GetItemGridVias )
341{
342 PCB_GRID_HELPER helper;
343
347}
348
349BOOST_AUTO_TEST_CASE( GetItemGridDefault )
350{
351 PCB_GRID_HELPER helper;
352
353 // Test with unknown item type
357
358 // Test with nullptr
359 grid = helper.GetItemGrid( nullptr );
361}
362
363BOOST_AUTO_TEST_CASE( GetSnappedInitiallyNull )
364{
365 PCB_GRID_HELPER helper;
366
367 BOARD_ITEM* snapped = helper.GetSnapped();
368 BOOST_CHECK( snapped == nullptr );
369}
370
371BOOST_AUTO_TEST_CASE( OnBoardItemRemovedClearsSnap )
372{
373 PCB_GRID_HELPER helper;
374
375 // Create a mock board and item - this test verifies the interface exists
376 // In a real scenario, the snap item would be set by other operations
377 BOARD board;
379
380 // This should not crash even if no snap item is set
381 helper.OnBoardItemRemoved( board, static_cast<BOARD_ITEM*>( &item ) );
382
383 BOOST_CHECK( helper.GetSnapped() == nullptr );
384}
385
386
387BOOST_AUTO_TEST_CASE( GeometricSnapTolerance )
388{
389 PCB_GRID_HELPER helper;
390 helper.SetGridSize( VECTOR2D( 100, 100 ) );
391 helper.SetOrigin( VECTOR2I( 0, 0 ) );
392 helper.SetGridSnapping( true );
393
394 SEG seg( VECTOR2I( 0, 0 ), VECTOR2I( 200, 0 ) );
395
396 // Test that points very far from segment don't snap to unrealistic locations
397 VECTOR2I result = helper.AlignToSegment( VECTOR2I( 50, 100000 ), seg );
398
399 // Should snap to midpoint of segment
400 BOOST_CHECK( result == VECTOR2I( 100, 0 ) );
401}
402
403BOOST_AUTO_TEST_CASE( SegmentIntersectionPriority )
404{
405 PCB_GRID_HELPER helper;
406 helper.SetGridSize( VECTOR2D( 50, 50 ) );
407 helper.SetOrigin( VECTOR2I( 0, 0 ) );
408 helper.SetGridSnapping( true );
409
410 // Segment that passes through a grid point
411 SEG seg( VECTOR2I( 0, 25 ), VECTOR2I( 100, 25 ) );
412
413 // Point near a grid intersection with the segment
414 VECTOR2I result = helper.AlignToSegment( VECTOR2I( 48, 27 ), seg );
415
416 // Should snap to the intersection at (50, 25)
417 BOOST_CHECK_EQUAL( result.x, 50 );
418 BOOST_CHECK_EQUAL( result.y, 25 );
419}
420
421BOOST_AUTO_TEST_CASE( ArcIntersectionWithGrid )
422{
423 PCB_GRID_HELPER helper;
424 helper.SetGridSize( VECTOR2D( 50, 50 ) );
425 helper.SetOrigin( VECTOR2I( 0, 0 ) );
426 helper.SetGridSnapping( true );
427
428 // Arc that should intersect grid lines
429 SHAPE_ARC arc( VECTOR2I( 50, 0 ), VECTOR2I( 50, 50 ), VECTOR2I( 0, 50 ), 0 );
430
431 // Point that should snap to an intersection
432 VECTOR2I result = helper.AlignToArc( VECTOR2I( 25, 25 ), arc );
433
434 // Should snap to the mid point of the arc
435 BOOST_CHECK_EQUAL( result.x, 50 );
436 BOOST_CHECK_EQUAL( result.y, 50 );
437}
438
440{
441 // Test with larger grid to verify scaling behavior
442 helper.SetGridSize( VECTOR2D( 1000, 1000 ) );
443
444 SEG seg( VECTOR2I( 500, 0 ), VECTOR2I( 500, 2000 ) );
445 VECTOR2I result = helper.AlignToSegment( VECTOR2I( 400, 800 ), seg );
446
447 // Should snap to the segment at grid intersection
448 BOOST_CHECK_EQUAL( result.x, 500 );
449 BOOST_CHECK_EQUAL( result.y, 1000 );
450}
451
453{
454 // Edge case: zero-length segment (point)
455 SEG seg( VECTOR2I( 100, 100 ), VECTOR2I( 100, 100 ) );
456 VECTOR2I result = helper.AlignToSegment( VECTOR2I( 95, 95 ), seg );
457
458 // Should snap to the point itself
459 BOOST_CHECK_EQUAL( result.x, 100 );
460 BOOST_CHECK_EQUAL( result.y, 100 );
461}
462
471BOOST_AUTO_TEST_CASE( ArcDragOriginStaysOnGrid )
472{
473 const int grid = pcbIUScale.mmToIU( 1.0 );
474 VECTOR2I arcStart( grid * 30, grid * 50 );
475 VECTOR2I arcMid( grid * 35, grid * 47 );
476 VECTOR2I arcEnd( grid * 45, grid * 50 );
477
478 PCB_ARC arc( nullptr );
479 arc.SetStart( arcStart );
480 arc.SetMid( arcMid );
481 arc.SetEnd( arcEnd );
482
483 const VECTOR2I center = arc.GetCenter();
484
485 // Guard the fixture premise: the center must be off grid for this arc, otherwise the
486 // regression could not be exercised.
487 BOOST_REQUIRE( center.x % grid != 0 || center.y % grid != 0 );
488
489 auto onGrid = []( const VECTOR2I& aPt, int aGrid )
490 {
491 return aPt.x % aGrid == 0 && aPt.y % aGrid == 0;
492 };
493
494 // Drag-source path: no anchor may carry ORIGIN, so BestDragOrigin falls back to the
495 // grid-aligned start/end/mid corners instead of the off-grid center.
496 for( const PCB_GRID_HELPER::ANCHOR_SPEC& spec : PCB_GRID_HELPER::GetArcAnchors( arc, true ) )
497 {
498 BOOST_CHECK_MESSAGE( ( spec.flags & GRID_HELPER::ORIGIN ) == 0,
499 "Arc drag source must not offer an ORIGIN anchor at (" << spec.pos.x
500 << ", " << spec.pos.y << ")" );
501
502 if( spec.flags & GRID_HELPER::ORIGIN )
503 BOOST_CHECK_MESSAGE( onGrid( spec.pos, grid ), "ORIGIN anchor off grid" );
504 }
505
506 // The stored midpoint is exposed as a grid-aligned corner drag reference.
507 bool midOffered = false;
508
509 for( const PCB_GRID_HELPER::ANCHOR_SPEC& spec : PCB_GRID_HELPER::GetArcAnchors( arc, true ) )
510 {
511 if( spec.pos == arcMid && ( spec.flags & GRID_HELPER::CORNER ) )
512 midOffered = true;
513 }
514
515 BOOST_CHECK( midOffered );
516
517 // Snap-target path (aFrom=false): the center is still offered as a drag origin for other
518 // items, but must not be a magnetic snap target (would pull snaps to the off-grid center,
519 // unlike a straight track's midpoint).
520 bool centerAsOrigin = false;
521
522 for( const PCB_GRID_HELPER::ANCHOR_SPEC& spec : PCB_GRID_HELPER::GetArcAnchors( arc, false ) )
523 {
524 if( spec.pos == center )
525 {
526 centerAsOrigin = true;
527 BOOST_CHECK( spec.flags & GRID_HELPER::ORIGIN );
528 BOOST_CHECK_EQUAL( spec.flags & GRID_HELPER::SNAPPABLE, 0 );
529 }
530 }
531
532 BOOST_CHECK( centerAsOrigin );
533}
534
535
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:121
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:83
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:85
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:373
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:108
virtual void SetVisible(bool aVisible)
Definition eda_text.cpp:381
void SetPosition(const VECTOR2I &aPos) override
PCB_FIELD & Value()
read/write accessors:
Definition footprint.h:893
PCB_FIELD & Reference()
Definition footprint.h:894
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
bool GetSnap() const
void SetSnap(bool aSnap)
bool GetUseGrid() const
void SetOrigin(const VECTOR2I &aOrigin)
Definition grid_helper.h:96
void SetGridSnapping(bool aEnable)
Definition grid_helper.h:97
static SNAP_REFERENCE_PREFERENCE classifyReference(const VECTOR2I &aPoint, const BOX2I &aBounds, bool aAnchorPoint)
Classify the point a drag was started from against the moving object's bounds.
void SetGridSize(const VECTOR2D &aGrid)
Definition grid_helper.h:94
wxString GetClass() const override
Return the class name.
MOCK_BOARD_ITEM(KICAD_T aType)
VECTOR2I GetPosition() const override
void Move(const VECTOR2I &aMoveVector) override
Move this object.
BOARD_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
double Similarity(const BOARD_ITEM &aItem) const override
Return a measure of how likely the other object is to represent the same object.
void SetPosition(const VECTOR2I &aPos) override
bool operator==(const BOARD_ITEM &aItem) const override
static SNAP_REFERENCE_PREFERENCE ClassifyReference(const VECTOR2I &aPoint, const BOX2I &aBounds, bool aPadCenter)
static BOX2I LayoutBounds(const BOARD_ITEM &aItem)
void SetMid(const VECTOR2I &aMid)
Definition pcb_track.h:285
virtual VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition pcb_track.h:293
void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aRemovedItem) override
static std::vector< ANCHOR_SPEC > GetArcAnchors(const PCB_ARC &aArc, bool aFrom)
Return the snap/drag anchor points that a track arc contributes.
VECTOR2I AlignToArc(const VECTOR2I &aPoint, const SHAPE_ARC &aSeg)
BOARD_ITEM * GetSnapped() const
Function GetSnapped If the PCB_GRID_HELPER has highlighted a snap point (target shown),...
static BOX2I layoutBounds(const BOARD_ITEM &aItem)
GRID_HELPER_GRIDS GetItemGrid(const EDA_ITEM *aItem) const override
Get the coarsest grid that applies to an item.
VECTOR2I AlignToSegment(const VECTOR2I &aPoint, const SEG &aSeg)
virtual VECTOR2I Align(const VECTOR2I &aPoint, GRID_HELPER_GRIDS aGrid) const
void SetEnd(const VECTOR2I &aEnd) override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetStart(const VECTOR2I &aStart) override
void SetEnd(const VECTOR2I &aEnd)
Definition pcb_track.h:89
void SetStart(const VECTOR2I &aStart)
Definition pcb_track.h:92
Definition seg.h:38
static constexpr EDA_ANGLE ANGLE_90
Definition eda_angle.h:413
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
Definition eda_shape.h:47
GRID_HELPER_GRIDS
Definition grid_helper.h:55
@ GRID_VIAS
Definition grid_helper.h:61
@ GRID_TEXT
Definition grid_helper.h:62
@ GRID_CURRENT
Definition grid_helper.h:57
@ GRID_GRAPHICS
Definition grid_helper.h:63
@ GRID_CONNECTABLE
Definition grid_helper.h:59
@ GRID_WIRES
Definition grid_helper.h:60
@ F_Fab
Definition layer_ids.h:115
@ F_SilkS
Definition layer_ids.h:96
A single anchor point contributed by an item, before it is registered with the helper.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
VECTOR3I expected(15, 30, 45)
BOOST_FIXTURE_TEST_CASE(LargeGridSegmentSnap, PCBGridHelperTestFixture)
BOOST_AUTO_TEST_CASE(DefaultConstructor)
VECTOR2I center
wxString result
Test unit parsing edge cases and error handling.
BOOST_CHECK_EQUAL(result, "25.4")
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition typeinfo.h:71
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition typeinfo.h:81
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition typeinfo.h:90
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition typeinfo.h:86
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition typeinfo.h:101
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition typeinfo.h:85
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
Definition typeinfo.h:82
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition typeinfo.h:83
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:79
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition typeinfo.h:80
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition typeinfo.h:91
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
Definition typeinfo.h:93
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition typeinfo.h:89
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683
VECTOR2< double > VECTOR2D
Definition vector2d.h:682