24#include <boost/test/unit_test.hpp>
41 BOOST_CHECK( keepout.
outline.empty() );
42 BOOST_CHECK( keepout.
layers.empty() );
91 BOOST_CHECK( !keepout.
no_vias );
107 BOOST_CHECK( !keepout.
no_vias );
116 keepout.
outline.emplace_back( 0, 0 );
117 keepout.
outline.emplace_back( 100, 0 );
118 keepout.
outline.emplace_back( 100, 100 );
119 keepout.
outline.emplace_back( 0, 100 );
121 BOOST_REQUIRE_EQUAL( keepout.
outline.size(), 4 );
132 keepout.
layers.push_back( 1 );
134 BOOST_REQUIRE_EQUAL( keepout.
layers.size(), 1 );
142 keepout.
layers.push_back( 1 );
143 keepout.
layers.push_back( 2 );
144 keepout.
layers.push_back( 4 );
146 BOOST_REQUIRE_EQUAL( keepout.
layers.size(), 3 );
158 BOOST_CHECK( keepout.
layers.empty() );
167 parser.
Parse( filename );
171 BOOST_REQUIRE_EQUAL( keepouts.size(), 5 );
174 bool found_keepout =
false;
176 for(
const auto& ko : keepouts )
180 found_keepout =
true;
181 BOOST_CHECK( ko.no_traces );
182 BOOST_CHECK( ko.no_vias );
183 BOOST_CHECK( ko.no_copper );
188 BOOST_CHECK( found_keepout );
191 bool found_via_restrict =
false;
193 for(
const auto& ko : keepouts )
197 found_via_restrict =
true;
198 BOOST_CHECK( !ko.no_traces );
199 BOOST_CHECK( ko.no_vias );
200 BOOST_CHECK( !ko.no_copper );
205 BOOST_CHECK( found_via_restrict );
208 bool found_route_restrict =
false;
210 for(
const auto& ko : keepouts )
214 found_route_restrict =
true;
215 BOOST_CHECK( ko.no_traces );
216 BOOST_CHECK( !ko.no_vias );
217 BOOST_CHECK( !ko.no_copper );
222 BOOST_CHECK( found_route_restrict );
225 bool found_area_restrict =
false;
227 for(
const auto& ko : keepouts )
233 found_area_restrict =
true;
237 BOOST_CHECK( found_area_restrict );
240 bool found_placement =
false;
242 for(
const auto& ko : keepouts )
246 found_placement =
true;
247 BOOST_CHECK( !ko.no_traces );
248 BOOST_CHECK( !ko.no_vias );
249 BOOST_CHECK( !ko.no_copper );
250 BOOST_CHECK( ko.no_components );
255 BOOST_CHECK( found_placement );
264 parser.
Parse( filename );
269 const KEEPOUT* rect_keepout =
nullptr;
271 for(
const auto& ko : keepouts )
285 BOOST_REQUIRE_EQUAL( rect_keepout->
outline.size(), 4 );
288 BOOST_CHECK_CLOSE( rect_keepout->
outline[0].x, 100.0, 0.1 );
289 BOOST_CHECK_CLOSE( rect_keepout->
outline[0].y, 100.0, 0.1 );
292 BOOST_CHECK_CLOSE( rect_keepout->
outline[2].x, 300.0, 0.1 );
293 BOOST_CHECK_CLOSE( rect_keepout->
outline[2].y, 300.0, 0.1 );
302 std::unique_ptr<BOARD> board( plugin.
LoadBoard( filename,
nullptr,
nullptr,
nullptr ) );
306 int ruleAreaCount = 0;
307 int allKeepoutCount = 0;
308 int viaKeepoutCount = 0;
309 int routeKeepoutCount = 0;
310 int placementKeepoutCount = 0;
312 for(
ZONE* zone : board->Zones() )
314 if( zone->GetIsRuleArea() )
318 if( zone->GetZoneName().StartsWith( wxT(
"Keepout_" ) ) )
320 else if( zone->GetZoneName().StartsWith( wxT(
"ViaKeepout_" ) ) )
322 else if( zone->GetZoneName().StartsWith( wxT(
"RouteKeepout_" ) ) )
324 else if( zone->GetZoneName().StartsWith( wxT(
"PlacementKeepout_" ) ) )
325 placementKeepoutCount++;
343 std::unique_ptr<BOARD> board( plugin.
LoadBoard( filename,
nullptr,
nullptr,
nullptr ) );
347 ZONE* viaKeepout =
nullptr;
349 for(
ZONE* zone : board->Zones() )
351 if( zone->GetZoneName().StartsWith( wxT(
"ViaKeepout_" ) ) )
365 ZONE* routeKeepout =
nullptr;
367 for(
ZONE* zone : board->Zones() )
369 if( zone->GetZoneName().StartsWith( wxT(
"RouteKeepout_" ) ) )
383 ZONE* placementKeepout =
nullptr;
385 for(
ZONE* zone : board->Zones() )
387 if( zone->GetZoneName().StartsWith( wxT(
"PlacementKeepout_" ) ) )
389 placementKeepout = zone;
General utilities for PCB file IO for QA programs.
const std::vector< KEEPOUT > & GetKeepouts() const
void Parse(const wxString &aFileName)
BOARD * LoadBoard(const wxString &aFileName, BOARD *aAppendToMe, const std::map< std::string, UTF8 > *aProperties, PROJECT *aProject) override
Load information from some input file format that this PCB_IO implementation knows about into either ...
Handle a list of polygons defining a copper zone.
bool GetDoNotAllowVias() const
bool GetDoNotAllowTracks() const
bool GetDoNotAllowFootprints() const
bool GetDoNotAllowZoneFills() const
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
@ ROUTE
Routing keepout (traces)
@ PLACEMENT
Component placement keepout.
A keepout area definition.
std::vector< ARC_POINT > outline
Keepout boundary.
bool no_vias
Prohibit vias (V restriction)
bool no_components
Prohibit component placement (P restriction)
bool no_copper
Prohibit copper pours (C restriction)
KEEPOUT_TYPE type
Type of keepout.
bool no_traces
Prohibit traces (R restriction)
std::vector< int > layers
Affected layers (empty = all)
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(KeepoutStruct_DefaultConstruction)
BOOST_CHECK_EQUAL(result, "25.4")