25#include <boost/test/data/test_case.hpp>
64 for(
PAD*
pad : m_board->Footprints()[0]->Pads() )
66 if(
pad->GetNumber() ==
"2" ||
pad->GetNumber() ==
"4" ||
pad->GetNumber() ==
"6" )
77 for(
PCB_TRACK* track : m_board->Tracks() )
86 track->SetWidth( track->GetWidth() +
delta +
delta );
90 arc12 = track->m_Uuid;
96 bool foundPad2Error =
false;
97 bool foundPad4Error =
false;
98 bool foundPad6Error =
false;
99 bool foundArc8Error =
false;
100 bool foundArc12Error =
false;
101 bool foundOtherError =
false;
106 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
VECTOR2I aPos,
int aLayer,
111 BOARD_ITEM* item_a = m_board->GetItem( aItem->GetMainItemID() );
112 PAD* pad_a = dynamic_cast<PAD*>( item_a );
113 PCB_TRACK* trk_a = dynamic_cast<PCB_TRACK*>( item_a );
115 BOARD_ITEM* item_b = m_board->GetItem( aItem->GetAuxItemID() );
116 PAD* pad_b = dynamic_cast<PAD*>( item_b );
117 PCB_TRACK* trk_b = dynamic_cast<PCB_TRACK*>( item_b );
119 if( pad_a && pad_a->GetNumber() ==
"2" ) foundPad2Error = true;
120 else if( pad_a && pad_a->GetNumber() ==
"4" ) foundPad4Error = true;
121 else if( pad_a && pad_a->GetNumber() ==
"6" ) foundPad6Error = true;
122 else if( pad_b && pad_b->GetNumber() ==
"2" ) foundPad2Error = true;
123 else if( pad_b && pad_b->GetNumber() ==
"4" ) foundPad4Error = true;
124 else if( pad_b && pad_b->GetNumber() ==
"6" ) foundPad6Error = true;
125 else if( trk_a && trk_a->m_Uuid == arc8 ) foundArc8Error = true;
126 else if( trk_a && trk_a->m_Uuid == arc12 ) foundArc12Error = true;
127 else if( trk_b && trk_b->m_Uuid == arc8 ) foundArc8Error = true;
128 else if( trk_b && trk_b->m_Uuid == arc12 ) foundArc12Error = true;
129 else foundOtherError = true;
159 for(
ZONE* zone : m_board->Zones() )
161 if( zone->GetLayerSet().Contains(
F_Cu ) )
198 std::vector<DRC_ITEM> violations;
201 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
VECTOR2I aPos,
int aLayer,
205 violations.push_back( *aItem );
210 if( violations.empty() )
213 BOOST_TEST_MESSAGE( (
const char*)(wxString::Format(
"Zone fill regression: %s passed", relPath ).utf8_str()) );
219 std::map<KIID, EDA_ITEM*> itemMap;
220 m_board->FillItemMap( itemMap );
222 for(
const DRC_ITEM& item : violations )
228 BOOST_ERROR( (
const char*)(wxString::Format(
"Zone fill regression: %s failed", relPath ).utf8_str()) );
247 std::vector<DRC_ITEM> violations;
250 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
VECTOR2I aPos,
int aLayer,
254 violations.push_back( *aItem );
259 if( violations.empty() )
262 BOOST_TEST_MESSAGE( (
const char*)(wxString::Format(
"Zone fill copper sliver regression: %s passed", relPath ).utf8_str()) );
268 std::map<KIID, EDA_ITEM*> itemMap;
269 m_board->FillItemMap( itemMap );
271 for(
const DRC_ITEM& item : violations )
277 BOOST_ERROR( (
const char*)(wxString::Format(
"Zone fill copper sliver regression: %s failed", relPath ).utf8_str()) );
283 {
"teardrop_issue_JPC2", 5 },
290 const wxString& relPath =
test.first;
291 const int count =
test.second;
301 for(
ZONE* zone : m_board->Zones() )
303 if( zone->IsTeardropArea() )
307 BOOST_CHECK_MESSAGE( zoneCount == count,
"Expected " << count <<
" teardrop zones in "
308 << relPath <<
", found "
316 std::vector<wxString> tests = { {
"issue19956/issue19956" }
319 for(
const wxString& relPath : tests )
325 for(
ZONE* zone : m_board->Zones() )
329 std::shared_ptr<SHAPE> a_shape( zone->GetEffectiveShape( layer ) );
331 for(
PAD*
pad : m_board->GetPads() )
333 std::shared_ptr<SHAPE> pad_shape(
pad->GetEffectiveShape( layer ) );
334 int clearance = pad_shape->GetClearance( a_shape.get() );
335 BOOST_CHECK_MESSAGE(
pad->GetNetCode() == zone->GetNetCode() ||
clearance != 0,
336 "Pad " <<
pad->GetNumber() <<
" from Footprint "
337 <<
pad->GetParentFootprint()
338 ->GetReferenceAsString()
341 <<
pad->GetNetname().ToStdString()
342 <<
" and is connected to zone with net code "
343 << zone->GetNetname().ToStdString() );
constexpr EDA_IU_SCALE pcbIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Container for design settings for a BOARD object.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
Represent a set of closed polygons.
void BooleanAdd(const SHAPE_POLY_SET &b)
Perform boolean polyset union.
int OutlineCount() const
Return the number of outlines in the set.
Handle a list of polygons defining a copper zone.
std::function< void(PCB_MARKER *aMarker)> DRC_CUSTOM_MARKER_HANDLER
PCB_LAYER_ID
A quick note on layer IDs:
void LoadBoard(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard)
void FillZones(BOARD *m_board)
std::unique_ptr< BOARD > m_board
SETTINGS_MANAGER m_settingsManager
BOOST_CHECK_EQUAL(ret, c.m_exp_result)
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
static const std::vector< wxString > RegressionZoneFillTests_tests
static const std::vector< std::pair< wxString, int > > RegressionTeardropFill_tests
BOOST_DATA_TEST_CASE_F(ZONE_FILL_TEST_FIXTURE, RegressionZoneFillTests, boost::unit_test::data::make(RegressionZoneFillTests_tests), relPath)
static const std::vector< wxString > RegressionSliverZoneFillTests_tests
BOOST_FIXTURE_TEST_CASE(BasicZoneFills, ZONE_FILL_TEST_FIXTURE)
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
VECTOR2< int32_t > VECTOR2I