From c41b1e2f06580c131a7116fe0a2f967ab54b52dd Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 17 Mar 2023 13:35:23 +0000 Subject: [PATCH] Manual cherry-pick of bug fix part of ee1d9c561c55c45c04082c5e66d2855a4739fa58. --- .../drc/drc_test_provider_library_parity.cpp | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/pcbnew/drc/drc_test_provider_library_parity.cpp b/pcbnew/drc/drc_test_provider_library_parity.cpp index 2f8f1adaa8..636039c36e 100644 --- a/pcbnew/drc/drc_test_provider_library_parity.cpp +++ b/pcbnew/drc/drc_test_provider_library_parity.cpp @@ -314,17 +314,8 @@ bool zonesNeedUpdate( const FP_ZONE* a, const FP_ZONE* b ) TEST( a->Outline()->TotalVertices(), b->Outline()->TotalVertices() ); - // The footprint's zone will be in board position, so we must translate & rotate the library - // footprint's zone to match. - FOOTPRINT* parentFootprint = static_cast( a->GetParentFootprint() ); - const SHAPE_POLY_SET& aPoly = *a->Outline(); - SHAPE_POLY_SET bPoly = b->Outline()->CloneDropTriangulation(); - - bPoly.Rotate( parentFootprint->GetOrientation() ); - bPoly.Move( parentFootprint->GetPosition() ); - for( int ii = 0; ii < a->Outline()->TotalVertices(); ++ii ) - TEST( aPoly.CVertex( ii ), bPoly.CVertex( ii ) ); + TEST( a->Outline()->CVertex( ii ), b->Outline()->CVertex( ii ) ); return false; } @@ -424,25 +415,33 @@ bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint ) return item->Type() == PCB_FP_SHAPE_T; } ); - std::set aPads( Pads().begin(), Pads().end() ); - std::set bPads( aLibFootprint->Pads().begin(), aLibFootprint->Pads().end() ); - - std::set aZones( Zones().begin(), Zones().end() ); - std::set bZones( aLibFootprint->Zones().begin(), aLibFootprint->Zones().end() ); - - TEST( aPads.size(), bPads.size() ); - TEST( aZones.size(), bZones.size() ); TEST( aShapes.size(), bShapes.size() ); - for( auto aIt = aPads.begin(), bIt = bPads.begin(); aIt != aPads.end(); aIt++, bIt++ ) - TEST_PADS( *aIt, *bIt ); - for( auto aIt = aShapes.begin(), bIt = bShapes.begin(); aIt != aShapes.end(); aIt++, bIt++ ) { if( ( *aIt )->Type() == PCB_FP_SHAPE_T ) TEST_SHAPES( static_cast( *aIt ), static_cast( *bIt ) ); } + std::set aPads( Pads().begin(), Pads().end() ); + std::set bPads( aLibFootprint->Pads().begin(), aLibFootprint->Pads().end() ); + + TEST( aPads.size(), bPads.size() ); + + for( auto aIt = aPads.begin(), bIt = bPads.begin(); aIt != aPads.end(); aIt++, bIt++ ) + TEST_PADS( *aIt, *bIt ); + + // Rotate/position a copy of libFootprint so that zones sort the same + std::unique_ptr libCopy( static_cast( aLibFootprint->Clone() ) ); + + libCopy->SetOrientation( GetOrientation() ); + libCopy->Move( GetPosition() ); + + std::set aZones( Zones().begin(), Zones().end() ); + std::set bZones( libCopy->Zones().begin(), libCopy->Zones().end() ); + + TEST( aZones.size(), bZones.size() ); + for( auto aIt = aZones.begin(), bIt = bZones.begin(); aIt != aZones.end(); aIt++, bIt++ ) TEST_ZONES( *aIt, *bIt );