|
21 | 21 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
22 | 22 | */
|
23 | 23 |
|
| 24 | +#include <layer_range.h> |
24 | 25 | #include <kiway.h>
|
25 | 26 | #include <macros.h>
|
26 | 27 | #include <netlist_reader/pcb_netlist.h>
|
@@ -126,6 +127,17 @@ class DRC_TEST_PROVIDER_LIBRARY_PARITY : public DRC_TEST_PROVIDER
|
126 | 127 | UNITS_PROVIDER g_unitsProvider( pcbIUScale, EDA_UNITS::MM );
|
127 | 128 |
|
128 | 129 |
|
| 130 | +LSET getBoardNormalizedLayerSet( const BOARD_ITEM* aLibItem, const BOARD* aBoard ) |
| 131 | +{ |
| 132 | + LSET lset = aLibItem->GetLayerSet(); |
| 133 | + |
| 134 | + if( aBoard ) |
| 135 | + lset &= aBoard->GetEnabledLayers(); |
| 136 | + |
| 137 | + return lset; |
| 138 | +} |
| 139 | + |
| 140 | + |
129 | 141 | bool primitiveNeedsUpdate( const std::shared_ptr<PCB_SHAPE>& a,
|
130 | 142 | const std::shared_ptr<PCB_SHAPE>& b )
|
131 | 143 | {
|
@@ -285,12 +297,7 @@ bool padNeedsUpdate( const PAD* a, const PAD* b, REPORTER* aReporter )
|
285 | 297 | if( a->GetRemoveUnconnected() )
|
286 | 298 | layerSettingsDiffer |= a->GetKeepTopBottom() != b->GetKeepTopBottom();
|
287 | 299 |
|
288 |
| - // Trim layersets to the current board before comparing |
289 |
| - LSET enabledLayers = a->GetBoard() ? a->GetBoard()->GetEnabledLayers() : LSET::AllLayersMask(); |
290 |
| - LSET aLayers = a->GetLayerSet() & enabledLayers; |
291 |
| - LSET bLayers = b->GetLayerSet() & enabledLayers; |
292 |
| - |
293 |
| - if( layerSettingsDiffer || aLayers != bLayers ) |
| 300 | + if( layerSettingsDiffer || a->GetLayerSet() != getBoardNormalizedLayerSet( b, a->GetBoard() ) ) |
294 | 301 | {
|
295 | 302 | diff = true;
|
296 | 303 |
|
@@ -319,34 +326,42 @@ bool padNeedsUpdate( const PAD* a, const PAD* b, REPORTER* aReporter )
|
319 | 326 | layerName = board ? board->GetLayerName( layer ) : LayerName( layer );
|
320 | 327 |
|
321 | 328 | TEST( a->GetShape( layer ), b->GetShape( layer ),
|
322 |
| - wxString::Format( _( "%s pad shape type differs on layer %s." ), PAD_DESC( a ), |
323 |
| - layerName ) ); |
| 329 | + wxString::Format( _( "%s pad shape type differs on layer %s." ), |
| 330 | + PAD_DESC( a ), |
| 331 | + layerName ) ); |
324 | 332 |
|
325 | 333 | TEST( a->GetSize( layer ), b->GetSize( layer ),
|
326 |
| - wxString::Format( _( "%s size differs on layer %s." ), PAD_DESC( a ), layerName ) ); |
| 334 | + wxString::Format( _( "%s size differs on layer %s." ), |
| 335 | + PAD_DESC( a ), |
| 336 | + layerName ) ); |
327 | 337 |
|
328 | 338 | TEST( a->GetDelta( layer ), b->GetDelta( layer ),
|
329 |
| - wxString::Format( _( "%s trapezoid delta differs on layer %s." ), PAD_DESC( a ), |
| 339 | + wxString::Format( _( "%s trapezoid delta differs on layer %s." ), |
| 340 | + PAD_DESC( a ), |
330 | 341 | layerName ) );
|
331 | 342 |
|
332 | 343 | TEST_D( a->GetRoundRectRadiusRatio( layer ),
|
333 | 344 | b->GetRoundRectRadiusRatio( layer ),
|
334 |
| - wxString::Format( _( "%s rounded corners differ on layer %s." ), PAD_DESC( a ), |
| 345 | + wxString::Format( _( "%s rounded corners differ on layer %s." ), |
| 346 | + PAD_DESC( a ), |
335 | 347 | layerName ) );
|
336 | 348 |
|
337 | 349 | TEST_D( a->GetChamferRectRatio( layer ),
|
338 | 350 | b->GetChamferRectRatio( layer ),
|
339 | 351 | wxString::Format( _( "%s chamfered corner sizes differ on layer %s." ),
|
340 |
| - PAD_DESC( a ), layerName ) ); |
| 352 | + PAD_DESC( a ), |
| 353 | + layerName ) ); |
341 | 354 |
|
342 | 355 | TEST( a->GetChamferPositions( layer ),
|
343 | 356 | b->GetChamferPositions( layer ),
|
344 |
| - wxString::Format( _( "%s chamfered corners differ on layer %s." ), PAD_DESC( a ), |
| 357 | + wxString::Format( _( "%s chamfered corners differ on layer %s." ), |
| 358 | + PAD_DESC( a ), |
345 | 359 | layerName ) );
|
346 | 360 |
|
347 | 361 | TEST_PT( a->GetOffset( layer ), b->GetOffset( layer ),
|
348 | 362 | wxString::Format( _( "%s shape offset from hole differs on layer %s." ),
|
349 |
| - PAD_DESC( a ), layerName ) ); |
| 363 | + PAD_DESC( a ), |
| 364 | + layerName ) ); |
350 | 365 | }
|
351 | 366 |
|
352 | 367 | TEST( a->GetDrillShape(), b->GetDrillShape(),
|
@@ -509,7 +524,7 @@ bool zoneNeedsUpdate( const ZONE* a, const ZONE* b, REPORTER* aReporter )
|
509 | 524 | TEST( a->GetDoNotAllowVias(), b->GetDoNotAllowVias(),
|
510 | 525 | wxString::Format( _( "%s keep out vias setting differs." ), ITEM_DESC( a ) ) );
|
511 | 526 |
|
512 |
| - TEST( a->GetLayerSet(), b->GetLayerSet(), |
| 527 | + TEST( a->GetLayerSet(), getBoardNormalizedLayerSet( b, a->GetBoard() ), |
513 | 528 | wxString::Format( _( "%s layers differ." ), ITEM_DESC( a ) ) );
|
514 | 529 |
|
515 | 530 | TEST( a->GetPadConnection(), b->GetPadConnection(),
|
|
0 commit comments