20#include <boost/test/unit_test.hpp>
37 BOOST_CHECK( keepout.
outline.empty() );
38 BOOST_CHECK( keepout.
layers.empty() );
87 BOOST_CHECK( !keepout.
no_vias );
103 BOOST_CHECK( !keepout.
no_vias );
112 keepout.
outline.emplace_back( 0, 0 );
113 keepout.
outline.emplace_back( 100, 0 );
114 keepout.
outline.emplace_back( 100, 100 );
115 keepout.
outline.emplace_back( 0, 100 );
117 BOOST_REQUIRE_EQUAL( keepout.
outline.size(), 4 );
128 keepout.
layers.push_back( 1 );
130 BOOST_REQUIRE_EQUAL( keepout.
layers.size(), 1 );
138 keepout.
layers.push_back( 1 );
139 keepout.
layers.push_back( 2 );
140 keepout.
layers.push_back( 4 );
142 BOOST_REQUIRE_EQUAL( keepout.
layers.size(), 3 );
154 BOOST_CHECK( keepout.
layers.empty() );
163 parser.
Parse( filename );
167 BOOST_REQUIRE_EQUAL( keepouts.size(), 5 );
170 bool found_keepout =
false;
172 for(
const auto& ko : keepouts )
176 found_keepout =
true;
177 BOOST_CHECK( ko.no_traces );
178 BOOST_CHECK( ko.no_vias );
179 BOOST_CHECK( ko.no_copper );
184 BOOST_CHECK( found_keepout );
187 bool found_via_restrict =
false;
189 for(
const auto& ko : keepouts )
193 found_via_restrict =
true;
194 BOOST_CHECK( !ko.no_traces );
195 BOOST_CHECK( ko.no_vias );
196 BOOST_CHECK( !ko.no_copper );
201 BOOST_CHECK( found_via_restrict );
204 bool found_route_restrict =
false;
206 for(
const auto& ko : keepouts )
210 found_route_restrict =
true;
211 BOOST_CHECK( ko.no_traces );
212 BOOST_CHECK( !ko.no_vias );
213 BOOST_CHECK( !ko.no_copper );
218 BOOST_CHECK( found_route_restrict );
221 bool found_area_restrict =
false;
223 for(
const auto& ko : keepouts )
229 found_area_restrict =
true;
233 BOOST_CHECK( found_area_restrict );
236 bool found_placement =
false;
238 for(
const auto& ko : keepouts )
242 found_placement =
true;
243 BOOST_CHECK( !ko.no_traces );
244 BOOST_CHECK( !ko.no_vias );
245 BOOST_CHECK( !ko.no_copper );
246 BOOST_CHECK( ko.no_components );
251 BOOST_CHECK( found_placement );
260 parser.
Parse( filename );
265 const KEEPOUT* rect_keepout =
nullptr;
267 for(
const auto& ko : keepouts )
281 BOOST_REQUIRE_EQUAL( rect_keepout->
outline.size(), 4 );
284 BOOST_CHECK_CLOSE( rect_keepout->
outline[0].x, 100.0, 0.1 );
285 BOOST_CHECK_CLOSE( rect_keepout->
outline[0].y, 100.0, 0.1 );
288 BOOST_CHECK_CLOSE( rect_keepout->
outline[2].x, 300.0, 0.1 );
289 BOOST_CHECK_CLOSE( rect_keepout->
outline[2].y, 300.0, 0.1 );
298 std::unique_ptr<BOARD> board( plugin.
LoadBoard( filename,
nullptr,
nullptr,
nullptr ) );
302 int ruleAreaCount = 0;
303 int allKeepoutCount = 0;
304 int viaKeepoutCount = 0;
305 int routeKeepoutCount = 0;
306 int placementKeepoutCount = 0;
308 for(
ZONE* zone : board->Zones() )
310 if( zone->GetIsRuleArea() )
314 if( zone->GetZoneName().StartsWith( wxT(
"Keepout_" ) ) )
316 else if( zone->GetZoneName().StartsWith( wxT(
"ViaKeepout_" ) ) )
318 else if( zone->GetZoneName().StartsWith( wxT(
"RouteKeepout_" ) ) )
320 else if( zone->GetZoneName().StartsWith( wxT(
"PlacementKeepout_" ) ) )
321 placementKeepoutCount++;
339 std::unique_ptr<BOARD> board( plugin.
LoadBoard( filename,
nullptr,
nullptr,
nullptr ) );
343 ZONE* viaKeepout =
nullptr;
345 for(
ZONE* zone : board->Zones() )
347 if( zone->GetZoneName().StartsWith( wxT(
"ViaKeepout_" ) ) )
361 ZONE* routeKeepout =
nullptr;
363 for(
ZONE* zone : board->Zones() )
365 if( zone->GetZoneName().StartsWith( wxT(
"RouteKeepout_" ) ) )
379 ZONE* placementKeepout =
nullptr;
381 for(
ZONE* zone : board->Zones() )
383 if( zone->GetZoneName().StartsWith( wxT(
"PlacementKeepout_" ) ) )
385 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")