41 auto board = std::make_unique<BOARD>();
42 auto shape = std::make_unique<PCB_SHAPE>( board.get() );
44 shape->SetEllipseCenter(
VECTOR2I( 100000, 200000 ) );
45 shape->SetEllipseMajorRadius( 50000 );
46 shape->SetEllipseMinorRadius( 30000 );
49 shape->SetWidth( 150 );
54 std::filesystem::path boardFile = tmp.
Path() /
"board.kicad_pcb";
77 BOOST_REQUIRE_MESSAGE( found,
"Ellipse not found in reloaded board" );
90 auto board = std::make_unique<BOARD>();
91 auto shape = std::make_unique<PCB_SHAPE>( board.get() );
93 shape->SetEllipseCenter(
VECTOR2I( 0, 0 ) );
94 shape->SetEllipseMajorRadius( 40000 );
95 shape->SetEllipseMinorRadius( 25000 );
100 shape->SetWidth( 200 );
104 std::filesystem::path boardFile = tmp.
Path() /
"board.kicad_pcb";
113 for(
BOARD_ITEM* item : reloaded->Drawings() )
125 BOOST_REQUIRE_MESSAGE( found,
"Elliptical arc not found in reloaded board" );
139 auto board = std::make_unique<BOARD>();
140 auto shape = std::make_unique<PCB_SHAPE>( board.get() );
142 shape->SetEllipseCenter(
VECTOR2I( 50000, 50000 ) );
143 shape->SetEllipseMajorRadius( 30000 );
144 shape->SetEllipseMinorRadius( 20000 );
145 shape->SetEllipseRotation(
ANGLE_0 );
152 std::filesystem::path boardFile = tmp.
Path() /
"board.kicad_pcb";
161 for(
BOARD_ITEM* item : reloaded->Drawings() )
173 BOOST_REQUIRE_MESSAGE( found,
"Ellipse not found in reloaded board" );
182 auto board = std::make_unique<BOARD>();
183 auto shape = std::make_unique<PCB_SHAPE>( board.get() );
185 shape->SetEllipseCenter(
VECTOR2I( 0, 0 ) );
186 shape->SetEllipseMajorRadius( 10000 );
187 shape->SetEllipseMinorRadius( 5000 );
188 shape->SetEllipseRotation(
ANGLE_0 );
190 shape->SetWidth( 150 );
191 shape->SetLocked(
true );
195 std::filesystem::path boardFile = tmp.
Path() /
"board.kicad_pcb";
204 for(
BOARD_ITEM* item : reloaded->Drawings() )
216 BOOST_REQUIRE_MESSAGE( found,
"Ellipse not found in reloaded board" );
223 auto board = std::make_unique<BOARD>();
224 auto shape = std::make_unique<PCB_SHAPE>( board.get() );
226 shape->SetEllipseCenter(
VECTOR2I( 0, 0 ) );
227 shape->SetEllipseMajorRadius( 40000 );
228 shape->SetEllipseMinorRadius( 20000 );
231 shape->SetWidth( 150 );
235 std::filesystem::path boardFile = tmp.
Path() /
"board.kicad_pcb";
244 for(
BOARD_ITEM* item : reloaded->Drawings() )
256 BOOST_REQUIRE_MESSAGE( found,
"Ellipse not found in reloaded board" );
263 auto board = std::make_unique<BOARD>();
264 auto shape = std::make_unique<PCB_SHAPE>( board.get() );
266 shape->SetEllipseCenter(
VECTOR2I( 0, 0 ) );
267 shape->SetEllipseMajorRadius( 30000 );
268 shape->SetEllipseMinorRadius( 15000 );
269 shape->SetEllipseRotation(
ANGLE_0 );
273 shape->SetWidth( 150 );
277 std::filesystem::path boardFile = tmp.
Path() /
"board.kicad_pcb";
286 for(
BOARD_ITEM* item : reloaded->Drawings() )
298 BOOST_REQUIRE_MESSAGE( found,
"Elliptical arc not found in reloaded board" );
306 auto board = std::make_unique<BOARD>();
307 auto shape = std::make_unique<PCB_SHAPE>( board.get() );
309 shape->SetEllipseCenter(
VECTOR2I( 0, 0 ) );
310 shape->SetEllipseMajorRadius( 1 );
311 shape->SetEllipseMinorRadius( 1 );
312 shape->SetEllipseRotation(
ANGLE_0 );
314 shape->SetWidth( 150 );
318 std::filesystem::path boardFile = tmp.
Path() /
"board.kicad_pcb";
327 for(
BOARD_ITEM* item : reloaded->Drawings() )
339 BOOST_REQUIRE_MESSAGE( found,
"Ellipse not found in reloaded board" );
347 auto board = std::make_unique<BOARD>();
348 auto shape = std::make_unique<PCB_SHAPE>( board.get() );
350 shape->SetEllipseCenter(
VECTOR2I( 0, 0 ) );
351 shape->SetEllipseMajorRadius( 500000000 );
352 shape->SetEllipseMinorRadius( 250000000 );
355 shape->SetWidth( 150 );
359 std::filesystem::path boardFile = tmp.
Path() /
"board.kicad_pcb";
368 for(
BOARD_ITEM* item : reloaded->Drawings() )
380 BOOST_REQUIRE_MESSAGE( found,
"Ellipse not found in reloaded board" );
388 auto board = std::make_unique<BOARD>();
389 auto fp = std::make_unique<FOOTPRINT>( board.get() );
390 fp->SetReference(
"U1" );
391 fp->SetPosition(
VECTOR2I( 100000, 100000 ) );
393 auto shape = std::make_unique<PCB_SHAPE>( fp.get() );
395 shape->SetEllipseCenter(
VECTOR2I( 0, 0 ) );
396 shape->SetEllipseMajorRadius( 20000 );
397 shape->SetEllipseMinorRadius( 10000 );
400 shape->SetWidth( 150 );
406 std::filesystem::path boardFile = tmp.
Path() /
"board.kicad_pcb";
413 FOOTPRINT* fpFound = reloaded->Footprints().empty() ? nullptr : reloaded->Footprints().front();
414 BOOST_REQUIRE_MESSAGE( fpFound,
"Footprint not found in reloaded board" );
430 BOOST_REQUIRE_MESSAGE( found,
"fp_ellipse not found in reloaded footprint" );
439 auto board = std::make_unique<BOARD>();
440 auto fp = std::make_unique<FOOTPRINT>( board.get() );
441 fp->SetReference(
"U2" );
442 fp->SetPosition(
VECTOR2I( 0, 0 ) );
444 auto shape = std::make_unique<PCB_SHAPE>( fp.get() );
446 shape->SetEllipseCenter(
VECTOR2I( 0, 0 ) );
447 shape->SetEllipseMajorRadius( 15000 );
448 shape->SetEllipseMinorRadius( 8000 );
452 shape->SetLayer(
F_Fab );
453 shape->SetWidth( 100 );
459 std::filesystem::path boardFile = tmp.
Path() /
"board.kicad_pcb";
466 FOOTPRINT* fpFound = reloaded->Footprints().empty() ? nullptr : reloaded->Footprints().front();
467 BOOST_REQUIRE_MESSAGE( fpFound,
"Footprint not found in reloaded board" );
483 BOOST_REQUIRE_MESSAGE( found,
"fp_ellipse_arc not found in reloaded footprint" );
494 auto board = std::make_unique<BOARD>();
495 auto shape = std::make_unique<PCB_SHAPE>( board.get() );
497 shape->SetEllipseCenter(
VECTOR2I( 0, 0 ) );
498 shape->SetEllipseMajorRadius( 30000 );
499 shape->SetEllipseMinorRadius( 15000 );
500 shape->SetEllipseRotation(
ANGLE_0 );
504 shape->SetWidth( 150 );
508 std::filesystem::path boardFile = tmp.
Path() /
"board.kicad_pcb";
517 for(
BOARD_ITEM* item : reloaded->Drawings() )
529 BOOST_REQUIRE_MESSAGE( found,
"Elliptical arc not found in reloaded board" );
537 auto board = std::make_unique<BOARD>();
538 auto shape = std::make_unique<PCB_SHAPE>( board.get() );
540 shape->SetEllipseCenter(
VECTOR2I( 0, 0 ) );
541 shape->SetEllipseMajorRadius( 20000 );
542 shape->SetEllipseMinorRadius( 10000 );
543 shape->SetEllipseRotation(
ANGLE_0 );
547 shape->SetWidth( 150 );
551 std::filesystem::path boardFile = tmp.
Path() /
"board.kicad_pcb";
560 for(
BOARD_ITEM* item : reloaded->Drawings() )
572 BOOST_REQUIRE_MESSAGE( found,
"Elliptical arc not found in reloaded board" );
580 auto board = std::make_unique<BOARD>();
581 auto shape = std::make_unique<PCB_SHAPE>( board.get() );
583 shape->SetEllipseCenter(
VECTOR2I( 100000, 100000 ) );
584 shape->SetEllipseMajorRadius( 50000 );
585 shape->SetEllipseMinorRadius( 30000 );
588 shape->SetWidth( 150 );
592 std::filesystem::path boardFile = tmp.
Path() /
"board.kicad_pcb";
601 for(
BOARD_ITEM* item : reloaded->Drawings() )
613 BOOST_REQUIRE_MESSAGE( found,
"Ellipse not found in reloaded board" );
620 auto board = std::make_unique<BOARD>();
621 auto shape = std::make_unique<PCB_SHAPE>( board.get() );
623 shape->SetEllipseCenter(
VECTOR2I( 0, 0 ) );
624 shape->SetEllipseMajorRadius( 25000 );
625 shape->SetEllipseMinorRadius( 15000 );
626 shape->SetEllipseRotation(
ANGLE_0 );
627 shape->SetLayer(
B_Cu );
628 shape->SetWidth( 200 );
632 std::filesystem::path boardFile = tmp.
Path() /
"board.kicad_pcb";
641 for(
BOARD_ITEM* item : reloaded->Drawings() )
653 BOOST_REQUIRE_MESSAGE( found,
"Ellipse not found in reloaded board" );
General utilities for PCB file IO for QA programs.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
bool IsLocked() const override
int GetEllipseMinorRadius() const
const VECTOR2I & GetEllipseCenter() const
EDA_ANGLE GetEllipseEndAngle() const
FILL_T GetFillMode() const
int GetEllipseMajorRadius() const
EDA_ANGLE GetEllipseRotation() const
EDA_ANGLE GetEllipseStartAngle() const
const std::filesystem::path & Path() const
Get the path to the temporary directory as a std::filesystem::path.
STROKE_PARAMS GetStroke() const override
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Simple container to manage line stroke parameters.
LINE_STYLE GetLineStyle() const
static constexpr EDA_ANGLE ANGLE_0
@ FILLED_SHAPE
Fill with object color.
std::unique_ptr< BOARD > ReadBoardFromFile(const std::filesystem::path &aFilename)
std::unique_ptr< BOARD > ReadBoardFromFileOrStream(const std::string &aFilename, std::istream &aFallback)
Read a board from a file, or another stream, as appropriate.
void DumpBoardToFile(BOARD &board, const std::filesystem::path &aFilename)
Utility function to simply write a Board out to a file.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(ClosedEllipseRoundTrip)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I