62 for(
RULE_AREA& ra : aTool->GetData()->m_areas )
64 if( ra.m_ruleName.Contains( ( aName ) ) )
75 if( ra.m_zone && ra.m_zone->GetPlacementAreaSource() == aGroupName )
88 if( zone == aRuleArea.
m_zone )
91 if( zone->GetZoneName() != aZoneName )
106 std::vector<wxString> tests = {
"vme-wren" };
108 for(
const wxString& relPath : tests )
115 toolMgr.
SetEnvironment( m_board.get(),
nullptr,
nullptr,
nullptr, toolsHolder );
124 auto ruleData = mtTool->
GetData();
127 static_cast<int>( ruleData->m_areas.size() ) ) );
133 ruleData->m_replaceExisting =
true;
138 || ra.
m_sheetName == wxT(
"pp_driver_2x.kicad_sch" ) )
152 int n_areas_io = 0, n_areas_pp = 0, n_areas_other = 0;
155 static_cast<int>(ruleData->m_areas.size() ) ) );
157 for(
const RULE_AREA& ra : ruleData->m_areas )
161 if( ra.
m_ruleName.Contains( wxT(
"io_drivers_fp" ) ) )
166 else if( ra.
m_ruleName.Contains( wxT(
"io_drivers_pp" ) ) )
178 n_areas_io, n_areas_pp, n_areas_other ) );
184 const std::vector<wxString> rulesToTest = { wxT(
"io_drivers_fp" ),
185 wxT(
"io_drivers_pp" ) };
187 for(
const wxString& ruleName : rulesToTest )
189 for(
const RULE_AREA& refArea : ruleData->m_areas )
191 if( !refArea.
m_ruleName.Contains( ruleName ) )
196 for(
const RULE_AREA& targetArea : ruleData->m_areas )
201 if( !targetArea.
m_ruleName.Contains( ruleName ) )
204 auto cgRef = CONNECTION_GRAPH::BuildFromFootprintSet( refArea.
m_components );
206 CONNECTION_GRAPH::BuildFromFootprintSet( targetArea.
m_components );
210 std::vector<TMATCH::TOPOLOGY_MISMATCH_REASON> details;
211 bool status = cgRef->FindIsomorphism( cgTarget.get(),
result, details );
214 "topo match: '%s' [%d] -> '%s' [%d] result %d", refArea.
m_ruleName.c_str().AsChar(),
216 static_cast<int>( targetArea.
m_components.size() ), status ? 1 : 0 ) );
218 for(
const auto& iter :
result )
221 iter.second->GetReference(),
222 iter.first->GetReference() ) );
225 BOOST_CHECK( status );
226 BOOST_CHECK( details.empty() );
233 BOOST_ASSERT( refArea );
235 const std::vector<wxString> targetAreaNames( { wxT(
"io_drivers_fp/bank2/io78/" ),
236 wxT(
"io_drivers_fp/bank1/io78/" ),
237 wxT(
"io_drivers_fp/bank0/io01/" ) } );
239 for(
const wxString& targetRaName : targetAreaNames )
243 BOOST_ASSERT( targetRA !=
nullptr );
247 ruleData->m_compatMap[targetRA].m_doCopy =
true;
252 BOOST_ASSERT(
result >= 0 );
268 toolMgr.
SetEnvironment( m_board.get(),
nullptr,
nullptr,
nullptr, toolsHolder );
275 auto ruleData = mtTool->
GetData();
278 static_cast<int>( ruleData->m_areas.size() ) ) );
280 BOOST_CHECK( ruleData->m_areas.size() >= 2 );
282 if( ruleData->m_areas.size() < 2 )
290 if( ra.
m_ruleName.Contains( wxT(
"Untitled Sheet/" ) ) )
292 else if( ra.
m_ruleName.Contains( wxT(
"Untitled Sheet1/" ) ) )
296 if( !refArea || !targetArea )
298 BOOST_TEST_MESSAGE(
"Could not find Untitled Sheet and Untitled Sheet1 rule areas, skipping test" );
326 if( !refFP || !targetFP )
328 BOOST_TEST_MESSAGE(
"Could not find matching footprints in the rule areas, skipping test" );
333 bool refValueVisible = refValueField ? refValueField->
IsVisible() :
true;
335 std::vector<FP_3DMODEL> refModels = refFP->
Models();
339 ruleData->m_compatMap[targetArea].m_doCopy =
true;
340 ruleData->m_options.m_copyPlacement =
true;
344 BOOST_CHECK(
result >= 0 );
348 if( targetValueField && refValueField )
352 refValueVisible, targetValueField->
IsVisible() ) );
357 if( !refModels.empty() )
360 static_cast<int>( refModels.size() ),
361 static_cast<int>( targetFP->
Models().size() ) ) );
380 toolMgr.
SetEnvironment( m_board.get(),
nullptr,
nullptr,
nullptr, toolsHolder );
387 auto ruleData = mtTool->
GetData();
390 static_cast<int>( ruleData->m_areas.size() ) ) );
394 if( ruleData->m_areas.size() < 2 )
411 int refViaCountBefore = 0;
413 for(
PCB_TRACK* track : m_board->Tracks() )
425 BOOST_TEST_MESSAGE( wxString::Format(
"Reference area vias before repeat: %d", refViaCountBefore ) );
426 BOOST_CHECK( refViaCountBefore > 0 );
430 ruleData->m_compatMap[targetArea].m_doCopy =
true;
431 ruleData->m_options.m_copyPlacement =
true;
432 ruleData->m_options.m_copyRouting =
true;
436 BOOST_CHECK(
result >= 0 );
438 int refViaCountAfter = 0;
440 for(
PCB_TRACK* track : m_board->Tracks() )
452 BOOST_TEST_MESSAGE( wxString::Format(
"Reference area vias after repeat: %d", refViaCountAfter ) );
469 toolMgr.
SetEnvironment( m_board.get(),
nullptr,
nullptr,
nullptr, toolsHolder );
532 auto cgRef = std::make_unique<CONNECTION_GRAPH>();
533 auto cgTarget = std::make_unique<CONNECTION_GRAPH>();
536 LIB_ID fpid( wxT(
"Package_SO" ), wxT(
"SOIC-8_3.9x4.9mm_P1.27mm" ) );
548 PAD padRef1( &fpRef );
551 fpRef.
Add( &padRef1 );
553 PAD padRef2( &fpRef );
556 fpRef.
Add( &padRef2 );
558 PAD padTarget1( &fpTarget );
561 fpTarget.
Add( &padTarget1 );
563 PAD padTarget2( &fpTarget );
566 fpTarget.
Add( &padTarget2 );
569 cgRef->AddFootprint( &fpRef,
VECTOR2I( 0, 0 ) );
570 cgTarget->AddFootprint( &fpTarget,
VECTOR2I( 0, 0 ) );
572 cgRef->BuildConnectivity();
573 cgTarget->BuildConnectivity();
579 COMPONENT* cmpRef = cgRef->Components()[0];
580 COMPONENT* cmpTarget = cgTarget->Components()[0];
582 bool sameKind = cmpRef->IsSameKind( *cmpTarget );
584 BOOST_TEST_MESSAGE( wxString::Format(
"TRIM_1.1 and TRIM_2.1 IsSameKind: %d", sameKind ? 1 : 0 ) );
585 BOOST_CHECK( sameKind );
589 std::vector<TMATCH::TOPOLOGY_MISMATCH_REASON> details;
590 bool status = cgRef->FindIsomorphism( cgTarget.get(),
result, details );
592 BOOST_TEST_MESSAGE( wxString::Format(
"Topology match result: %d", status ? 1 : 0 ) );
594 if( !status && !details.empty() )
596 for(
const auto& reason : details )
599 reason.m_reference, reason.m_candidate, reason.m_reason ) );
603 BOOST_CHECK( status );
604 BOOST_CHECK( details.empty() );
607 fpRef.
Pads().clear();
608 fpTarget.
Pads().clear();
627 toolMgr.
SetEnvironment( m_board.get(),
nullptr,
nullptr,
nullptr, toolsHolder );
634 auto ruleData = mtTool->
GetData();
642 if( ra.
m_sheetPath == wxT(
"/io_drivers_fp/bank0/io01/" ) )
644 else if( ra.
m_sheetPath == wxT(
"/io_drivers_fp/bank0/" ) )
646 else if( ra.
m_sheetPath == wxT(
"/io_drivers_fp/" ) )
654 BOOST_TEST_MESSAGE( wxString::Format(
"Leaf /io_drivers_fp/bank0/io01/ components: %d",
693 toolMgr.
SetEnvironment( m_board.get(),
nullptr,
nullptr,
nullptr, toolsHolder );
700 auto ruleData = mtTool->
GetData();
706 if( ra.
m_sheetName == wxT(
"io_driver.kicad_sch" ) )
720 auto cgRef = CONNECTION_GRAPH::BuildFromFootprintSet( refArea->
m_components );
721 auto cgTarget = CONNECTION_GRAPH::BuildFromFootprintSet( targetArea->
m_components );
725 std::atomic<bool> cancelled(
true );
726 std::atomic<int> matched( 0 );
727 std::atomic<int> total( 0 );
735 std::vector<TMATCH::TOPOLOGY_MISMATCH_REASON> details;
737 bool status = cgRef->FindIsomorphism( cgTarget.get(),
result, details, params );
739 BOOST_CHECK( !status );
740 BOOST_CHECK(
result.empty() );
747 std::atomic<bool> cancelled(
false );
748 std::atomic<int> matched( 0 );
749 std::atomic<int> total( 0 );
757 std::vector<TMATCH::TOPOLOGY_MISMATCH_REASON> details;
759 bool status = cgRef->FindIsomorphism( cgTarget.get(),
result, details, params );
761 BOOST_CHECK( status );
763 int finalMatched = matched.load();
764 int finalTotal = total.load();
766 BOOST_TEST_MESSAGE( wxString::Format(
"Progress: matched=%d, total=%d", finalMatched, finalTotal ) );
768 BOOST_CHECK( finalTotal > 0 );
775 std::vector<TMATCH::TOPOLOGY_MISMATCH_REASON> details;
777 bool status = cgRef->FindIsomorphism( cgTarget.get(),
result, details );
779 BOOST_CHECK( status );
780 BOOST_CHECK( !
result.empty() );
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
Information pertinent to a Pcbnew printed circuit board.
const ZONES & Zones() const
Store all of the related component information found in a netlist.
virtual bool IsVisible() const
A logical library item identifier and consists of various portions much like a URI.
void SetNumber(const wxString &aNumber)
Set the pad number (note that it can be alphanumeric, such as the array reference "AA12").
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Return true if a given subpolygon contains the point aP.
Handle a list of polygons defining a copper zone.
SHAPE_POLY_SET * Outline()
void LoadBoard(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard)
std::map< FOOTPRINT *, FOOTPRINT * > COMPONENT_MATCHES
MULTICHANNEL_TEST_FIXTURE()
SETTINGS_MANAGER m_settingsManager
std::unique_ptr< BOARD > m_board
bool m_includeLockedItems
std::vector< RULE_AREA > m_areas
std::set< FOOTPRINT * > m_components
std::atomic< bool > * m_cancelled
std::atomic< int > * m_matchedComponents
std::atomic< int > * m_totalComponents
@ VALUE
Field Value of part, i.e. "3.3K".
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
RULE_AREA * findRuleAreaByPartialName(MULTICHANNEL_TOOL *aTool, const wxString &aName)
BOOST_FIXTURE_TEST_CASE(MultichannelToolRegressions, MULTICHANNEL_TEST_FIXTURE)
int countZonesByNameInRuleArea(BOARD *aBoard, const wxString &aZoneName, const RULE_AREA &aRuleArea)
RULE_AREA * findRuleAreaByPlacementGroup(MULTICHANNEL_TOOL *aTool, const wxString &aGroupName)
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
wxString result
Test unit parsing edge cases and error handling.
BOOST_CHECK_EQUAL(result, "25.4")
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
VECTOR2< int32_t > VECTOR2I