KiCad PCB EDA Suite
eda_item_test_utils.h File Reference

Go to the source code of this file.

Functions

template<typename T >
static void IterateOverPositionsAndReferences (T *aItem, void(*aCallback)(T *, wxPoint))
 

Function Documentation

◆ IterateOverPositionsAndReferences()

template<typename T >
static void IterateOverPositionsAndReferences ( T *  aItem,
void(*)(T *, wxPoint)  aCallback 
)
static

Definition at line 33 of file eda_item_test_utils.h.

34{
35 constexpr int XSTEP = static_cast<int>( Millimeter2iu( 100 ) );
36 constexpr int YSTEP = static_cast<int>( Millimeter2iu( 50 ) );
37 constexpr int XMIN = -1 * XSTEP;
38 constexpr int XMAX = 1 * XSTEP;
39 constexpr int YMIN = -1 * YSTEP;
40 constexpr int YMAX = 1 * YSTEP;
41
42 for( int posX = XMIN; posX <= XMAX; posX += XSTEP )
43 {
44 for( int posY = YMIN; posY <= YMAX; posY += YSTEP )
45 {
46 for( int refX = XMIN; refX <= XMAX; refX += XSTEP )
47 {
48 for( int refY = YMIN; refY <= YMAX; refY += YSTEP )
49 {
50 BOOST_TEST_CONTEXT( wxString::Format( "Position: %d %d, Reference: %d %d",
51 posX, posY, refX, refY ) )
52 {
53 aItem->SetPosition( wxPoint( posX, posY ) );
54 aCallback( aItem, wxPoint( refX, refY ) );
55 }
56 }
57 }
58 }
59 }
60}
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
static constexpr int Millimeter2iu(double mm)
#define BOOST_TEST_CONTEXT(A)

References BOOST_TEST_CONTEXT, Format(), and Millimeter2iu().