21#include <boost/test/data/test_case.hpp>
42 std::vector<std::pair<std::string, VECTOR2I>>
m_pads;
48 os <<
"ALIGN_FP_DEF: " << fpDef.
m_name;
76 std::unique_ptr<FOOTPRINT> fp = std::make_unique<FOOTPRINT>( &aBoard );
78 for(
const auto& [number, pos] : padPositions.
m_pads )
81 pad->SetNumber( number );
82 pad->SetFPRelativePosition( pos );
92 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
97 if( originalFootprintIsFlipped )
145 "DIP4, pin 1 at origin",
148 {
"2", { 0, 1000 } },
149 {
"3", { 2000, 0 } },
150 {
"4", { 2000, 1000 } },
156 "DIP4, body center at origin",
158 {
"1", { -1000, -500 } },
159 {
"2", { -1000, 500 } },
160 {
"3", { 1000, -500 } },
161 {
"4", { 1000, 500 } },
169 "DIP4, rotated 90 deg CCW",
172 {
"2", { 1000, 0 } },
173 {
"3", { 1000, -2000 } },
174 {
"4", { 0, -2000 } },
180 "DIP4, body center at origin, rotated 90 deg CCW",
182 {
"1", { -500, 1000 } },
183 {
"2", { 500, 1000 } },
184 {
"3", { 500, -1000 } },
185 {
"4", { -500, -1000 } },
191 "DIP4, pin 4 deleted",
194 {
"2", { 0, 1000 } },
195 {
"3", { 2000, 0 } },
204 {
"2", { 0, 1000 } },
205 {
"3", { 2000, 0 } },
206 {
"4", { 2100, 1000 } },
215 {
"2", { 0, 1000 } },
216 {
"3", { 2400, 0 } },
217 {
"4", { 2400, 1000 } },
223 "DIP4, with mechanical pins",
226 {
"2", { 0, 1000 } },
227 {
"3", { 2000, 0 } },
228 {
"4", { 2000, 1000 } },
229 {
"MP", { -1000, 500 } },
230 {
"MP", { 3000, 500 } },
263 os <<
"SELF_ALIGNMENT_TEST_CASE: " << testCase.
m_FpDef.
m_name;
277 "Origin point change",
291 "Rotation and origin point change",
312 "Footprint widened (all pins moved)",
319 "Ignore same named pads",
335 std::optional<VECTOR2I> expectedPosShift;
336 std::optional<EDA_ANGLE> expectedAngleShift;
339 if( selfCase.m_ExpectSuccess )
341 expectedPosShift = VECTOR2I( 0, 0 );
342 expectedAngleShift = ANGLE_0;
346 selfCase.m_FpDef.m_name +
"-> " + selfCase.m_FpDef.m_name,
356 ExecuteTestCase( selfAlignTestCase,
false );
363 ExecuteTestCase( selfAlignTestCase,
true );
371 ExecuteTestCase( testCase,
false );
Information pertinent to a Pcbnew printed circuit board.
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_45
static constexpr EDA_ANGLE ANGLE_270
@ LEFT_RIGHT
Flip left to right (around the Y axis)
Information needed to make a footprint to use for alignment tests.
std::vector< std::pair< std::string, VECTOR2I > > m_pads
std::optional< EDA_ANGLE > m_ExpectedAngleShift
const ALIGN_FP_DEF & m_NewPadPositions
const ALIGN_FP_DEF & m_OrigPadPositions
std::optional< VECTOR2I > m_ExpectedPosShift
friend std::ostream & operator<<(std::ostream &os, const FP_ALIGNMENT_TEST_CASE &testCase)
std::unique_ptr< FOOTPRINT > CreateFootprint(BOARD &aBoard, const ALIGN_FP_DEF &padPositions)
void ExecuteTestCase(const FP_ALIGNMENT_TEST_CASE &testCase, bool originalFootprintIsFlipped)
Definition of a test case for self-to-self alignment.
const ALIGN_FP_DEF & m_FpDef
BOOST_DATA_TEST_CASE(ConvertToKicadUnit, boost::unit_test::data::make(altium_to_kicad_unit), input_value, expected_result)
Test conversation from Altium internal units into KiCad internal units.
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST(netlist.find("R_G1 ARM_OUT1 DIE_B R='0.001 / ((SW_STATE)") !=std::string::npos)
BOOST_TEST_CONTEXT("Test Clearance")
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I