KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_odbpp_attributes.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
22
23#include <algorithm>
24#include <cmath>
25#include <cctype>
26#include <memory>
27#include <map>
28#include <sstream>
29#include <string>
30#include <vector>
31
32#include <board.h>
33#include <base_units.h>
36#include <footprint.h>
37#include <netinfo.h>
38#include <pad.h>
39#include <pcb_track.h>
40
46
47#include "odb_test_utils.h"
48
49namespace fs = std::filesystem;
50
51
53{
58
60
61 // When there is no w/h
64
65 // When there is no drill, there is w/h before epoint and exp
70};
71
72
73BOOST_AUTO_TEST_SUITE( OdbAttributesTests )
74
75BOOST_AUTO_TEST_CASE( FabComponentRowUsesSavedVariantFields )
76{
77 std::unique_ptr<BOARD> board = KI_TEST::RequireBoardFromPcbnewQAData( "variant_test/variant_test.kicad_pcb" );
78
79 const FOOTPRINT* resistor = nullptr;
80
81 for( const FOOTPRINT* footprint : board->Footprints() )
82 {
83 if( footprint->GetReference() == wxS( "R1" ) )
84 resistor = footprint;
85 }
86
87 BOOST_REQUIRE( resistor );
88 FAB_COMPONENT_ROW normal = MakeFabComponentRow( *resistor, wxString() );
89 FAB_COMPONENT_ROW variant = MakeFabComponentRow( *resistor, wxS( "Variant A" ) );
90 BOOST_CHECK( normal.Field( wxS( "Datasheet" ) ).IsEmpty() );
91 BOOST_CHECK_EQUAL( variant.Field( wxS( "Datasheet" ) ), wxString( wxS( "test" ) ) );
93}
94
95
96BOOST_AUTO_TEST_CASE( FabTestPointsKeepSavedBoardViaOrder )
97{
98 std::unique_ptr<BOARD> board = KI_TEST::RequireBoardFromPcbnewQAData( "connect/connect.kicad_pcb" );
99
100 BOOST_REQUIRE( board->BuildConnectivity() );
101 std::vector<FAB_TEST_POINT> points = FabTestPoints( *board );
102 BOOST_REQUIRE( !points.empty() );
103 bool sawPad = false;
104 size_t vias = 0;
105
106 for( const FAB_TEST_POINT& point : points )
107 {
108 if( point.m_pad )
109 {
110 sawPad = true;
111 BOOST_CHECK( !point.m_via );
112 }
113 else
114 {
115 BOOST_CHECK( !sawPad );
116 BOOST_REQUIRE( point.m_via );
117 BOOST_CHECK( point.m_position == point.m_via->GetPosition() );
118 ++vias;
119 }
120 }
121
122 BOOST_CHECK_GT( vias, 0u );
123 BOOST_CHECK( sawPad );
124}
125
126
127BOOST_AUTO_TEST_CASE( FabAnonymousNetNamesFollowSavedNetCodes )
128{
129 std::unique_ptr<BOARD> board = KI_TEST::RequireBoardFromPcbnewQAData( "odbpp/net_name_collision.kicad_pcb" );
130
131 std::map<int, wxString> names = FabAnonymousNetNames( *board );
132 BOOST_REQUIRE_GT( names.size(), 1u );
133 size_t ordinal = 0;
134
135 for( const auto& [code, name] : names )
136 {
137 BOOST_CHECK_GT( code, 0 );
138 BOOST_CHECK_EQUAL( name, wxString::Format( wxS( "NET_%zu" ), ++ordinal ) );
139 }
140
141 const NETINFO_ITEM* supply = board->FindNet( wxS( "+12V" ) );
142 const NETINFO_ITEM* q2 = board->FindNet( wxS( "Net-(Q2-C)" ) );
143 const NETINFO_ITEM* q1 = board->FindNet( wxS( "Net-(Q1-C)" ) );
144 BOOST_REQUIRE( supply );
145 BOOST_REQUIRE( q2 );
146 BOOST_REQUIRE( q1 );
147 BOOST_REQUIRE_LT( q2->GetNetCode(), q1->GetNetCode() );
148 BOOST_CHECK_EQUAL( names.at( supply->GetNetCode() ), wxString( wxS( "NET_1" ) ) );
149 BOOST_CHECK_EQUAL( names.at( q2->GetNetCode() ), wxString( wxS( "NET_2" ) ) );
150 BOOST_CHECK_EQUAL( names.at( q1->GetNetCode() ), wxString( wxS( "NET_3" ) ) );
151}
152
153
154BOOST_AUTO_TEST_CASE( OdbPadUsageOptionOrderMatchesSpec )
155{
156 BOOST_CHECK_EQUAL( static_cast<int>( ODB_ATTR::PAD_USAGE::TOEPRINT ), 0 );
157 BOOST_CHECK_EQUAL( static_cast<int>( ODB_ATTR::PAD_USAGE::VIA ), 1 );
158 BOOST_CHECK_EQUAL( static_cast<int>( ODB_ATTR::PAD_USAGE::G_FIDUCIAL ), 2 );
159 BOOST_CHECK_EQUAL( static_cast<int>( ODB_ATTR::PAD_USAGE::L_FIDUCIAL ), 3 );
161 BOOST_CHECK_EQUAL( static_cast<int>( ODB_ATTR::PAD_USAGE::BOND_FINGER ), 5 );
162}
163
164
165BOOST_AUTO_TEST_CASE( OdbFiducialPadUsage )
166{
167 std::unique_ptr<BOARD> board = KI_TEST::RequireBoardFromPcbnewQAData( "odbpp/pad_roles.kicad_pcb" );
168
169 size_t globals = CountPads( *board, PAD_PROP::FIDUCIAL_GLBL, F_Cu );
170 size_t locals = CountPads( *board, PAD_PROP::FIDUCIAL_LOCAL, F_Cu );
171 BOOST_REQUIRE_GT( globals, 0 );
172 BOOST_REQUIRE_EQUAL( locals, 1 );
173
174 ODB_PRODUCT product( ExportOdb( *board, TempDir().Path() ) );
175 OdbFeatureFile top( fs::path( product.LayerFile( ODB::GenLegalEntityName( board->GetLayerName( F_Cu ) ),
176 wxS( "features" ) ).ToStdWstring() ) );
177
178 BOOST_CHECK_EQUAL( top.CountRecordsWithOption( ".pad_usage", "g_fiducial" ), globals );
179 BOOST_CHECK_EQUAL( top.CountRecordsWithOption( ".pad_usage", "l_fiducial" ), locals );
180}
181
182
183BOOST_AUTO_TEST_CASE( OdbTestPointFeatureAndCadnetFlag )
184{
185 std::unique_ptr<BOARD> board = KI_TEST::RequireBoardFromPcbnewQAData( "odbpp/pad_roles.kicad_pcb" );
186
188
189 const PAD* testPoint = nullptr;
190
191 for( const FOOTPRINT* footprint : board->Footprints() )
192 {
193 for( const PAD* pad : footprint->Pads() )
194 {
195 if( pad->GetProperty() == PAD_PROP::TESTPOINT )
196 testPoint = pad;
197 }
198 }
199
200 BOOST_REQUIRE( testPoint );
201
202 fs::path root = ExportOdb( *board, TempDir().Path() );
203 ODB_PRODUCT product( root );
204 OdbFeatureFile top( fs::path( product.LayerFile( ODB::GenLegalEntityName( board->GetLayerName( F_Cu ) ),
205 wxS( "features" ) ).ToStdWstring() ) );
206 BOOST_CHECK_EQUAL( top.CountRecordsWithFlag( ".test_point" ), 1 );
207
208 size_t taggedPoints = 0;
209
210 for( const std::string& line : ReadLines( root / "steps" / "pcb" / "netlists" / "cadnet" / "netlist" ) )
211 {
212 const std::vector<std::string> fields = ReadLineFields( line );
213
214 if( fields.size() <= NP_IDX_NODRILL_EXP )
215 continue;
216
217 const std::string& netNum = fields[NP_IDX_NET_NUM];
218
219 if( netNum.empty() || !std::isdigit( static_cast<unsigned char>( netNum[0] ) ) )
220 continue;
221
222 const double x = std::stod( fields[NP_IDX_X_COORD] );
223 const double y = std::stod( fields[NP_IDX_Y_COORD] );
224 const double padX = pcbIUScale.IUTomm( testPoint->GetPosition().x );
225 const double padY = -pcbIUScale.IUTomm( testPoint->GetPosition().y );
226
227 // Find the matching pad in the netlist by comparing coordinates
228 if( std::abs( x - padX ) < 0.00001 && std::abs( y - padY ) < 0.00001 )
229 {
230 BOOST_TEST_MESSAGE( "Cadnet net number " << netNum << " found at coordinates (" << x << ", " << y << ")" );
231
232 const bool isTestPoint = std::find( fields.begin(), fields.end(), "t" ) != fields.end();
233
234 // Non-drilled cadnet points carry the fixed 0.002 placeholder radius
235 // (netlist would be 0)
236 // (The spec isn't that clear here, but if w/h don't exist we don't know the
237 // index for epoint)
238 BOOST_CHECK_EQUAL( fields[NP_IDX_RADIUS], "0.002" );
239
241 BOOST_CHECK( isTestPoint );
242 ++taggedPoints;
243 }
244 }
245
246 BOOST_CHECK_EQUAL( taggedPoints, 1 );
247}
248
249
250BOOST_AUTO_TEST_CASE( OdbConnectedViaIsCadnetMidpoint )
251{
252 std::unique_ptr<BOARD> board = KI_TEST::RequireBoardFromPcbnewQAData( "connect/connect.kicad_pcb" );
253
254 BOOST_REQUIRE( board->BuildConnectivity() );
255 const FAB_TEST_POINT* midpoint = nullptr;
256 std::vector<FAB_TEST_POINT> points = FabTestPoints( *board );
257
258 for( const FAB_TEST_POINT& point : points )
259 {
260 if( point.m_via && point.m_netCode > 0 && ( point.m_front || point.m_back ) && !point.m_netEnd )
261 {
262 midpoint = &point;
263 break;
264 }
265 }
266
267 BOOST_REQUIRE_MESSAGE( midpoint, "connect board has no exposed midpoint via" );
268 fs::path root = ExportOdb( *board, TempDir().Path() );
269 bool found = false;
270
271 for( const std::string& line : ReadLines( root / "steps" / "pcb" / "netlists" / "cadnet" / "netlist" ) )
272 {
273 const std::vector<std::string> fields = ReadLineFields( line );
274
275 const bool isVia = std::find( fields.begin(), fields.end(), "v" ) != fields.end();
276
277 if( fields.size() <= NP_IDX_DRILL_EXP || !isVia || fields[NP_IDX_NET_NUM] != std::to_string( midpoint->m_netCode ) )
278 continue;
279
280 double x = pcbIUScale.IUTomm( midpoint->m_position.x );
281 double y = -pcbIUScale.IUTomm( midpoint->m_position.y );
282
283 if( std::abs( std::stod( fields[NP_IDX_X_COORD] ) - x ) < 0.00001
284 && std::abs( std::stod( fields[NP_IDX_Y_COORD] ) - y ) < 0.00001 )
285 {
286 const double radius = std::stod( fields[NP_IDX_RADIUS] );
287
288 // must have non-zero radius for drilled via fields
289 BOOST_CHECK( radius > 0 );
290
292 found = true;
293 }
294 }
295
296 BOOST_CHECK( found );
297}
298
299
300BOOST_AUTO_TEST_CASE( OdbPressFitUsesDrillToolComponentAndPinRoles )
301{
302 std::unique_ptr<BOARD> board = KI_TEST::RequireBoardFromPcbnewQAData( "odbpp/pad_roles.kicad_pcb" );
303
305
306 fs::path root = ExportOdb( *board, TempDir().Path() );
307 ODB_PRODUCT product( root );
308 wxString drillLayer;
309
310 for( const ODB_MATRIX_ROW& row : product.Matrix() )
311 {
312 if( row.m_name.StartsWith( wxS( "drill_plated_" ) ) )
313 drillLayer = row.m_name;
314 }
315
316 BOOST_REQUIRE( !drillLayer.IsEmpty() );
317 OdbFeatureFile drill( fs::path( product.LayerFile( drillLayer, wxS( "features" ) ).ToStdWstring() ) );
318 BOOST_CHECK_EQUAL( drill.CountRecordsWithOption( ".plated_type", "press_fit" ), 1 );
319
320 size_t pressFitTools = 0;
321
322 for( const std::string& line : ReadLines( fs::path( product.LayerFile( drillLayer,
323 wxS( "tools" ) ).ToStdWstring() ) ) )
324 {
325 if( line.find( "TYPE2=PRESS_FIT" ) != std::string::npos )
326 ++pressFitTools;
327 }
328
329 BOOST_CHECK_GT( pressFitTools, 0 );
330
331 size_t pressFitPins = 0;
332
333 for( const std::string& line : ReadLines( root / "steps" / "pcb" / "eda" / "data" ) )
334 {
335 if( line.rfind( "PIN ", 0 ) == 0 && line.size() >= 2
336 && line.compare( line.size() - 2, 2, " P" ) == 0 )
337 ++pressFitPins;
338 }
339
340 BOOST_CHECK_EQUAL( pressFitPins, 1 );
341
342 size_t pressFitComponents = 0;
343
344 for( const ODB_MATRIX_ROW& row : product.Matrix() )
345 {
346 if( row.m_type != wxS( "COMPONENT" ) )
347 continue;
348
349 OdbFeatureFile components( fs::path( product.LayerFile( row.m_name, wxS( "components" ) ).ToStdWstring() ) );
350 pressFitComponents += components.CountRecordsWithOption( ".comp_mount_type", "pressfit" );
351 }
352
353 BOOST_CHECK_EQUAL( pressFitComponents, 1 );
354}
355
356
357BOOST_AUTO_TEST_CASE( OdbUnnumberedNpthUsesToolingHoleRole )
358{
359 std::unique_ptr<BOARD> board = KI_TEST::RequireBoardFromPcbnewQAData( "odbpp/pad_roles.kicad_pcb" );
360
361 ODB_PRODUCT product( ExportOdb( *board, TempDir().Path() ) );
362 wxString drillLayer;
363
364 for( const ODB_MATRIX_ROW& row : product.Matrix() )
365 {
366 if( row.m_name.StartsWith( wxS( "drill_non-plated_" ) ) )
367 drillLayer = row.m_name;
368 }
369
370 BOOST_REQUIRE( !drillLayer.IsEmpty() );
371 OdbFeatureFile drill( fs::path( product.LayerFile( drillLayer, wxS( "features" ) ).ToStdWstring() ) );
372 size_t nonPlated = drill.CountRecordsWithOption( ".drill", "non_plated" );
373 BOOST_REQUIRE_GT( nonPlated, 0 );
374 BOOST_CHECK_EQUAL( drill.CountRecordsWithOption( ".pad_usage", "tooling_hole" ), nonPlated );
375}
376
377
378BOOST_AUTO_TEST_CASE( OdbMicroviasUseLaserAttributesAndTools )
379{
380 std::unique_ptr<BOARD> board = KI_TEST::RequireBoardFromPcbnewQAData( "padstacks.kicad_pcb" );
381
382 size_t microvias = 0;
383
384 for( PCB_TRACK* track : board->Tracks() )
385 {
386 if( track->Type() == PCB_VIA_T && static_cast<PCB_VIA*>( track )->GetViaType() == VIATYPE::MICROVIA )
387 ++microvias;
388 }
389
390 BOOST_REQUIRE_GT( microvias, 0 );
391 ODB_PRODUCT product( ExportOdb( *board, TempDir().Path() ) );
392 size_t laserFeatures = 0;
393 size_t laserTools = 0;
394
395 for( const ODB_MATRIX_ROW& row : product.Matrix() )
396 {
397 if( row.m_type != wxS( "DRILL" ) )
398 continue;
399
400 OdbFeatureFile features( fs::path( product.LayerFile( row.m_name, wxS( "features" ) ).ToStdWstring() ) );
401 laserFeatures += features.CountRecordsWithOption( ".via_type", "laser" );
402
403 for( const std::string& line : ReadLines( fs::path( product.LayerFile( row.m_name,
404 wxS( "tools" ) ).ToStdWstring() ) ) )
405 {
406 if( line.find( "TYPE2=LASER" ) != std::string::npos )
407 ++laserTools;
408 }
409 }
410
411 BOOST_CHECK_EQUAL( laserFeatures, microvias );
412 BOOST_CHECK_GT( laserTools, 0 );
413}
414
415
416BOOST_AUTO_TEST_CASE( OdbNpthPressFitNeverUsesPressFitTool )
417{
418 const std::vector<std::pair<std::string, bool>> fixtures = {
419 { "odbpp/npth_pressfit.kicad_pcb", false }, { "odbpp/npth_pressfit_slot.kicad_pcb", true }
420 };
421
422 for( const auto& [name, isSlot] : fixtures )
423 {
424 std::unique_ptr<BOARD> board = KI_TEST::RequireBoardFromPcbnewQAData( name );
425
426 size_t invalidPads = 0;
427
428 for( const FOOTPRINT* footprint : board->Footprints() )
429 {
430 for( const PAD* pad : footprint->Pads() )
431 {
432 if( pad->GetAttribute() == PAD_ATTRIB::NPTH && pad->GetProperty() == PAD_PROP::PRESSFIT )
433 {
434 ++invalidPads;
435 BOOST_CHECK_EQUAL( pad->GetDrillSize().x != pad->GetDrillSize().y, isSlot );
436 }
437 }
438 }
439
440 BOOST_REQUIRE_EQUAL( invalidPads, 1 );
441 ODB_PRODUCT product( ExportOdb( *board, TempDir().Path() ) );
442 size_t nonPlatedTools = 0;
443 size_t pressFitTools = 0;
444
445 for( const ODB_MATRIX_ROW& row : product.Matrix() )
446 {
447 if( row.m_type != wxS( "DRILL" ) )
448 continue;
449
450 fs::path toolsPath( product.LayerFile( row.m_name, wxS( "tools" ) ).ToStdWstring() );
451
452 for( const std::string& line : ReadLines( toolsPath ) )
453 {
454 if( line.find( "TYPE=NON_PLATED" ) != std::string::npos )
455 ++nonPlatedTools;
456
457 if( line.find( "TYPE2=PRESS_FIT" ) != std::string::npos )
458 ++pressFitTools;
459 }
460 }
461
462 BOOST_CHECK_GT( nonPlatedTools, 0 );
463 BOOST_CHECK_EQUAL( pressFitTools, 0 );
464 }
465}
466
467
468BOOST_AUTO_TEST_CASE( OdbStepBoardThicknessMatchesDefaultStackup )
469{
470 std::unique_ptr<BOARD> board = KI_TEST::RequireBoardFromPcbnewQAData( "custom_pads.kicad_pcb" );
471
472 BOOST_REQUIRE( !board->GetDesignSettings().m_HasStackup );
473
474 fs::path root = ExportOdb( *board, TempDir().Path() );
475 std::vector<std::string> lines = ReadLines( root / "steps" / "pcb" / "attrlist" );
476 BOOST_REQUIRE( !lines.empty() );
477 BOOST_CHECK_EQUAL( lines.front(), "UNITS=MM" );
478 BOOST_CHECK( std::find( lines.begin(), lines.end(), ".board_thickness=1600.0" ) != lines.end() );
479
480 fs::path inchRoot = ExportOdb( *board, TempDir().Path(), "inch" );
481 std::vector<std::string> inchLines = ReadLines( inchRoot / "steps" / "pcb" / "attrlist" );
482 BOOST_REQUIRE( inchLines.size() >= 2 );
483 BOOST_CHECK_EQUAL( inchLines.front(), "UNITS=INCH" );
484 BOOST_CHECK_EQUAL( inchLines[1].substr( 0, 17 ), ".board_thickness=" );
485 BOOST_CHECK_CLOSE( std::stod( inchLines[1].substr( 17 ) ), 62.992126, 0.01 );
486}
487
488
489BOOST_AUTO_TEST_CASE( OdbCopperWeightFollowsOutputUnits )
490{
491 std::unique_ptr<BOARD> board = KI_TEST::RequireBoardFromPcbnewQAData( "custom_pads.kicad_pcb" );
492
493 // Produce an ODB++ export and check that the copper weight follows the output units.
494 const auto checkCopperWeight =
495 [&]( const fs::path& aRootDir, const std::string& aLayer, const std::string& aExpectedUnits,
496 const std::string& aExpectedValue )
497 {
498 ODB_PRODUCT product( aRootDir );
499
500 const fs::path attrlistPath( product.LayerFile( aLayer, wxS( "attrlist" ) ).ToStdWstring() );
501 const std::vector<std::string> attrlist = ReadLines( attrlistPath );
502
503 const std::string expectedUnitsLine = "UNITS=" + aExpectedUnits;
504 const std::string expectedValueLine = ".copper_weight=" + aExpectedValue;
505
506 BOOST_REQUIRE( !attrlist.empty() );
507 BOOST_CHECK_EQUAL( attrlist.front(), expectedUnitsLine );
508 BOOST_CHECK( std::find( attrlist.begin(), attrlist.end(), expectedValueLine ) != attrlist.end() );
509 };
510
511 fs::path metricRoot = ExportOdb( *board, TempDir().Path(), "mm" );
512 checkCopperWeight( metricRoot, "f.cu", "MM", "35.0" );
513
514 fs::path inchRoot = ExportOdb( *board, TempDir().Path(), "inch" );
515 checkCopperWeight( inchRoot, "f.cu", "INCH", "1.0" );
516}
517
518
519BOOST_AUTO_TEST_CASE( OdbLayerMaterialHasUserAttributeDeclaration )
520{
521 std::unique_ptr<BOARD> board = KI_TEST::RequireBoardFromPcbnewQAData( "ipc2581/dielectric-sublayer.kicad_pcb" );
522
523 fs::path root = ExportOdb( *board, TempDir().Path() );
524 ODB_PRODUCT product( root );
525 size_t materials = 0;
526
527 for( const ODB_MATRIX_ROW& row : product.Matrix() )
528 {
529 if( row.m_type != wxS( "DIELECTRIC" ) )
530 continue;
531
532 fs::path attrlistPath( product.LayerFile( row.m_name, wxS( "attrlist" ) ).ToStdWstring() );
533 std::vector<std::string> attrlist = ReadLines( attrlistPath );
534 BOOST_REQUIRE( !attrlist.empty() );
535 BOOST_CHECK_EQUAL( attrlist.front(), "UNITS=MM" );
536
537 for( const std::string& line : attrlist )
538 {
539 if( line.rfind( "material=", 0 ) == 0 )
540 ++materials;
541
542 BOOST_CHECK( line.rfind( ".material=", 0 ) != 0 );
543 }
544 }
545
546 BOOST_CHECK_GT( materials, 0 );
547 std::vector<std::string> declaration = ReadLines( root / "misc" / "userattr" );
548
549 for( const std::string& field : { "UNITS=MM", "TEXT {", "NAME=material", "ENTITY=LAYER", "MAX_LEN=64" } )
550 BOOST_CHECK( std::find( declaration.begin(), declaration.end(), field ) != declaration.end() );
551}
552
553
554BOOST_AUTO_TEST_CASE( OdbBackdrillStopLayerFollowsMustCutCopper )
555{
556 std::unique_ptr<BOARD> board = KI_TEST::RequireBoardFromPcbnewQAData( "issue25021/backdrill.kicad_pcb" );
557
558 ODB_PRODUCT product( ExportOdb( *board, TempDir().Path() ) );
559 const std::map<std::pair<wxString, wxString>, wxString> stopLayers = {
560 { { wxS( "f.cu" ), wxS( "in3.cu" ) }, wxS( "in4.cu" ) },
561 { { wxS( "in6.cu" ), wxS( "b.cu" ) }, wxS( "in5.cu" ) },
562 { { wxS( "in3.cu" ), wxS( "b.cu" ) }, wxS( "in2.cu" ) }
563 };
564 size_t checked = 0;
565
566 for( const ODB_MATRIX_ROW& row : product.Matrix() )
567 {
568 if( row.m_addType != wxS( "BACKDRILL" ) )
569 continue;
570
571 auto it = stopLayers.find( { row.m_startName, row.m_endName } );
572 BOOST_REQUIRE( it != stopLayers.end() );
573 ++checked;
574 std::string expected = ".backdrill_penetrate_stop_layer=" + it->second.ToStdString();
575 fs::path attrlistPath( product.LayerFile( row.m_name, wxS( "attrlist" ) ).ToStdWstring() );
576 std::vector<std::string> lines = ReadLines( attrlistPath );
577 BOOST_CHECK( std::find( lines.begin(), lines.end(), expected ) != lines.end() );
578 }
579
580 BOOST_CHECK_EQUAL( checked, stopLayers.size() );
581}
582
const char * name
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:128
General utilities for PCB file IO for QA programs.
Handle the data for a net.
Definition netinfo.h:50
int GetNetCode() const
Definition netinfo.h:104
The matrix and layer directories of an exported ODB++ product model tree.
wxString LayerFile(const wxString &aLayer, const wxString &aFile) const
Path of a file in a layer directory, matched to the directory name without regard to case.
const std::vector< ODB_MATRIX_ROW > & Matrix() const
size_t CountRecordsWithOption(const std::string &aName, const std::string &aOption) const
Definition pad.h:61
VECTOR2I GetPosition() const override
Definition pad.cpp:255
VIATYPE GetViaType() const
Definition pcb_track.h:426
FAB_COMPONENT_ROW MakeFabComponentRow(const FOOTPRINT &aFootprint, const wxString &aVariant)
std::map< int, wxString > FabAnonymousNetNames(const BOARD &aBoard)
Anonymous names NET_1 through NET_n keyed and numbered by net code.
std::vector< FAB_TEST_POINT > FabTestPoints(const BOARD &aBoard)
The caller must build board connectivity before enumerating net endpoints.
@ F_Cu
Definition layer_ids.h:60
std::unique_ptr< BOARD > RequireBoardFromPcbnewQAData(const std::filesystem::path &aFilename)
Require a board from the path relative to the pcbnew QA data directory.
wxString GenLegalEntityName(const wxString &aStr)
Definition odb_util.cpp:212
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition eda_angle.h:461
size_t CountPads(const BOARD &aBoard, PAD_PROP aProperty, PCB_LAYER_ID aLayer)
fs::path ExportOdb(const BOARD &aBoard, const fs::path &aDir, const std::string &aUnits, const std::string &aSigfig, REPORTER *aReporter)
std::vector< std::string > ReadLineFields(const std::string &aLine)
Return the tokenised fields of a line, split by whitespace.
std::vector< std::string > ReadLines(const fs::path &aFile)
const KI_TEST::SCOPED_TEMP_DIR & TempDir()
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
Definition padstack.h:104
@ FIDUCIAL_LOCAL
a fiducial (usually a smd) local to the parent footprint
Definition padstack.h:122
@ FIDUCIAL_GLBL
a fiducial (usually a smd) for the full board
Definition padstack.h:121
@ PRESSFIT
a PTH with a hole diameter with tight tolerances for press fit pin
Definition padstack.h:127
@ TESTPOINT
a test point pad
Definition padstack.h:123
Footprint facts resolved for one assembly variant.
wxString Field(const wxString &aName) const
Variant-resolved shown text, empty when the field is missing.
One LAYER block of matrix/matrix.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_CHECK(res.column_datatype(0)==SQL_NUMERIC||res.column_datatype(0)==SQL_DECIMAL)
BOOST_REQUIRE_EQUAL(rows.size(), 1)
BOOST_CHECK_EQUAL(std::any_cast< std::string >(rows[0].at("val")), "12345678901234567.89")
BOOST_REQUIRE_MESSAGE(dc.CacheTableInfo(table, { "part_id", "val" }), dc.GetLastError())
BOOST_REQUIRE(res.columns()==1)
BOOST_AUTO_TEST_SUITE_END()
KIBIS top(path, &reporter)
VECTOR3I expected(15, 30, 45)
@ NP_IDX_DRILL_EPOINT
@ NP_IDX_NODRILL_EXP
@ NP_IDX_NODRILL_EPOINT
BOOST_AUTO_TEST_CASE(FabComponentRowUsesSavedVariantFields)
int radius
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition typeinfo.h:89