From b4229d9a3e4ab342b0d196afda8086291f6a29b9 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 15 Sep 2020 21:49:51 +0100 Subject: [PATCH] Fix testcase crash when progressReporter was null. (And it helps if the DRC tester you're trying to test is actually in the make file.) --- pcbnew/CMakeLists.txt | 1 + pcbnew/drc/drc_engine.cpp | 12 +++++++----- qa/pcbnew/drc/test_drc_courtyard_invalid.cpp | 1 + qa/pcbnew/drc/test_drc_courtyard_overlap.cpp | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index d4f38d71ca..44fcfdfc30 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -238,6 +238,7 @@ set( PCBNEW_DRC_SRCS drc/drc_test_provider_disallow.cpp drc/drc_test_provider_connectivity.cpp drc/drc_test_provider_copper_clearance.cpp + drc/drc_test_provider_courtyard_clearance.cpp drc/drc_test_provider_edge_clearance.cpp drc/drc_test_provider_hole_clearance.cpp drc/drc_test_provider_hole_size.cpp diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index 7f40396446..ca52eb3f96 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/pcbnew/drc/drc_engine.cpp @@ -405,13 +405,15 @@ void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aTestTracksAgainstZones, m_reportAllTrackErrors = aReportAllTrackErrors; m_testFootprints = aTestFootprints; - int phases = 0; - - for( DRC_TEST_PROVIDER* provider : m_testProviders ) - phases += provider->GetNumPhases(); - if( m_progressReporter ) + { + int phases = 0; + + for( DRC_TEST_PROVIDER* provider : m_testProviders ) + phases += provider->GetNumPhases(); + m_progressReporter->AddPhases( phases ); + } for( int ii = DRCE_FIRST; ii < DRCE_LAST; ++ii ) { diff --git a/qa/pcbnew/drc/test_drc_courtyard_invalid.cpp b/qa/pcbnew/drc/test_drc_courtyard_invalid.cpp index 44e958d3cd..290c215ce0 100644 --- a/qa/pcbnew/drc/test_drc_courtyard_invalid.cpp +++ b/qa/pcbnew/drc/test_drc_courtyard_invalid.cpp @@ -302,6 +302,7 @@ void DoCourtyardInvalidTest( const COURTYARD_INVALID_CASE& aCase, [&]( const std::shared_ptr& aItem, wxPoint aPos ) { if( aItem->GetErrorCode() == DRCE_OVERLAPPING_FOOTPRINTS + || aItem->GetErrorCode() == DRCE_MALFORMED_COURTYARD || aItem->GetErrorCode() == DRCE_MISSING_COURTYARD ) { markers.push_back( std::make_unique( aItem, aPos ) ); diff --git a/qa/pcbnew/drc/test_drc_courtyard_overlap.cpp b/qa/pcbnew/drc/test_drc_courtyard_overlap.cpp index 5baaf3406c..5c721149da 100644 --- a/qa/pcbnew/drc/test_drc_courtyard_overlap.cpp +++ b/qa/pcbnew/drc/test_drc_courtyard_overlap.cpp @@ -471,6 +471,7 @@ static void DoCourtyardOverlapTest( const COURTYARD_OVERLAP_TEST_CASE& aCase, [&]( const std::shared_ptr& aItem, wxPoint aPos ) { if( aItem->GetErrorCode() == DRCE_OVERLAPPING_FOOTPRINTS + || aItem->GetErrorCode() == DRCE_MALFORMED_COURTYARD || aItem->GetErrorCode() == DRCE_MISSING_COURTYARD ) { markers.push_back( std::make_unique( aItem, aPos ) );