60 PAD* padWithFootprintMargin =
nullptr;
61 PAD* padWithNoMargin =
nullptr;
62 PAD* padWithOwnMargin =
nullptr;
64 for(
FOOTPRINT* fp : m_board->Footprints() )
66 if( fp->GetFPIDAsString() ==
"TestFootprint_WithSolderMaskMargin" )
69 BOOST_CHECK( fp->GetLocalSolderMaskMargin().has_value() );
72 for(
PAD*
pad : fp->Pads() )
74 if(
pad->GetNumber() ==
"1" )
76 padWithFootprintMargin =
pad;
79 BOOST_CHECK( !
pad->GetLocalSolderMaskMargin().has_value() );
83 else if( fp->GetFPIDAsString() ==
"TestFootprint_NoSolderMaskMargin" )
86 BOOST_CHECK( !fp->GetLocalSolderMaskMargin().has_value() );
88 for(
PAD*
pad : fp->Pads() )
90 if(
pad->GetNumber() ==
"1" )
91 padWithNoMargin =
pad;
94 else if( fp->GetFPIDAsString() ==
"TestFootprint_PadOverridesSolderMaskMargin" )
97 BOOST_CHECK( fp->GetLocalSolderMaskMargin().has_value() );
100 for(
PAD*
pad : fp->Pads() )
102 if(
pad->GetNumber() ==
"1" )
104 padWithOwnMargin =
pad;
107 BOOST_CHECK(
pad->GetLocalSolderMaskMargin().has_value() );
151 std::vector<PAD*> pads;
152 std::vector<PCB_TRACK*> tracks;
153 std::vector<PCB_SHAPE*> shapes;
155 for(
FOOTPRINT* fp : m_board->Footprints() )
157 for(
PAD*
pad : fp->Pads() )
158 pads.push_back(
pad );
160 for(
BOARD_ITEM* item : fp->GraphicalItems() )
163 shapes.push_back(
static_cast<PCB_SHAPE*
>( item ) );
167 for(
PCB_TRACK* track : m_board->Tracks() )
168 tracks.push_back( track );
173 shapes.push_back(
static_cast<PCB_SHAPE*
>( item ) );
178 const int iterations = 1000;
182 for(
int i = 0; i < iterations; ++i )
188 track->GetSolderMaskExpansion();
191 shape->GetSolderMaskExpansion();
196 int totalCalls = iterations * ( pads.size() + tracks.size() + shapes.size() );
198 BOOST_TEST_MESSAGE( wxString::Format(
"%d calls to GetSolderMaskExpansion took %0.1f ms "
200 totalCalls, timer.
msecs(),
201 timer.
msecs() * 1e6 / totalCalls ) );
204#if !defined( KICAD_SANITIZE_THREADS ) && !defined( KICAD_SANITIZE_ADDRESS )
208 BOOST_CHECK_MESSAGE( timer.
msecs() < 500.0,
209 wxString::Format(
"GetSolderMaskExpansion too slow: %0.1f ms for %d calls",
210 timer.
msecs(), totalCalls ) );
248 std::shared_ptr<DRC_ENGINE> engine = std::make_shared<DRC_ENGINE>(
m_board.get(), &bds );
249 engine->InitEngine( wxFileName() );
253 void AddSilkLine(
double aFromMM,
double aToMM,
double aOffsetMM )
270 for(
int code = 0; code <
DRCE_LAST; ++code )
276 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I&,
int,
295 AddSilkLine( 8.0, 12.0, -0.525 );
297 BOOST_CHECK_MESSAGE( CountMaskViolations() == 1,
"silk clear of the via copper but inside its mask opening was not "
304 AddSilkLine( -2.0, 2.0, -0.625 );
306 BOOST_CHECK_MESSAGE( CountMaskViolations() == 1,
"silk clear of the pad copper but inside its mask opening was not "
313 AddSilkLine( -2.0, 2.0, 0.75 );
315 BOOST_CHECK_MESSAGE( CountMaskViolations() == 0,
"silk clear of the pad mask opening was reported" );
constexpr EDA_IU_SCALE pcbIUScale
Container for design settings for a BOARD object.
std::map< int, SEVERITY > m_DRCSeverities
std::shared_ptr< DRC_ENGINE > m_DRCEngine
int m_SolderMaskExpansion
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
void RunTests(EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aTestFootprints, BOARD_COMMIT *aCommit=nullptr)
Run the DRC tests.
void SetViolationHandler(DRC_VIOLATION_HANDLER aHandler)
Set an optional DRC violation handler (receives DRC_ITEMs and positions).
bool HasRulesForConstraintType(DRC_CONSTRAINT_T constraintID)
void ClearViolationHandler()
void InitEngine(const wxFileName &aRulePath)
Initialize the DRC engine.
LSET is a set of PCB_LAYER_IDs.
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
int GetSolderMaskExpansion(PCB_LAYER_ID aLayer) const
void SetWidth(int aWidth) override
void SetEnd(const VECTOR2I &aEnd) override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetStart(const VECTOR2I &aStart) override
A small class to help profiling.
void Stop()
Save the time when this function was called, and set the counter stane to stop.
double msecs(bool aSinceLast=false)
@ SOLDER_MASK_EXPANSION_CONSTRAINT
@ DRCE_SILK_MASK_CLEARANCE
void LoadBoard(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard)
@ PTH
Plated through hole pad.
std::unique_ptr< BOARD > m_board
SETTINGS_MANAGER m_settingsManager
DRC_SOLDER_MASK_EXPANSION_TEST_FIXTURE()
SILK_MASK_EXPANSION_FIXTURE()
void AddSilkLine(double aFromMM, double aToMM, double aOffsetMM)
std::unique_ptr< BOARD > m_board
int CountMaskViolations()
BOOST_FIXTURE_TEST_CASE(FootprintLevelSolderMaskExpansion, DRC_SOLDER_MASK_EXPANSION_TEST_FIXTURE)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
BOOST_CHECK_EQUAL(result, "25.4")
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
VECTOR2< int32_t > VECTOR2I