38constexpr int MM = 1000000;
58 io.
SetWriter( [&](
const wxString& aData ) { data = aData; } );
66 return std::unique_ptr<BOARD>(
static_cast<BOARD*
>( parsed ) );
75 auto board = std::make_unique<BOARD>();
90 std::unique_ptr<BOARD> pasted =
roundTrip( board.get(), selection );
92 BOOST_REQUIRE_EQUAL( pasted->Constraints().size(), 1 );
96 BOOST_REQUIRE_EQUAL( pastedConstraint->
GetMembers().size(), 2 );
100 BOOST_CHECK( pasted->ResolveItem( member.m_item,
true ) !=
nullptr );
108 auto board = std::make_unique<BOARD>();
119 std::map<KIID, KIID> idMap;
123 KIID oldUuid = shape->m_Uuid;
125 idMap[oldUuid] = shape->m_Uuid;
129 BOOST_CHECK( board->ResolveItem( c->GetMembers()[0].m_item,
true ) ==
nullptr );
131 c->RemapKIIDs( idMap );
133 BOOST_CHECK( c->GetMembers()[0].m_item == a->
m_Uuid );
134 BOOST_CHECK( c->GetMembers()[1].m_item == b->m_Uuid );
135 BOOST_CHECK( board->ResolveItem( c->GetMembers()[0].m_item,
true ) == a );
136 BOOST_CHECK( board->ResolveItem( c->GetMembers()[1].m_item,
true ) == b );
143 BOOST_CHECK( d->
GetMembers()[0].m_item == stranger );
151 auto board = std::make_unique<BOARD>();
165 std::unique_ptr<BOARD> pasted =
roundTrip( board.get(), selection );
167 BOOST_CHECK( pasted->Constraints().empty() );
175 auto board = std::make_unique<BOARD>();
193 PCB_SHAPE* a = addFpSegment( { 0, 0 }, { 10 *
MM, 0 } );
203 [&](
const PCB_SELECTION& aSelection ) -> std::unique_ptr<FOOTPRINT>
208 io.
SetWriter( [&](
const wxString& aData ) { data = aData; } );
217 return std::unique_ptr<FOOTPRINT>(
static_cast<FOOTPRINT*
>( parsed ) );
224 std::unique_ptr<FOOTPRINT> clip = fpRoundTrip( selection );
226 BOOST_REQUIRE_EQUAL( clip->Constraints().size(), 1 );
233 BOOST_CHECK( fpRoundTrip( partial )->Constraints().
empty() );
constexpr EDA_IU_SCALE pcbIUScale
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
void SaveSelection(const PCB_SELECTION &selected, bool isFootprintEditor)
void SetWriter(std::function< void(const wxString &)> aWriter)
void SetReader(std::function< wxString()> aReader)
void SetBoard(BOARD *aBoard)
KICAD_T Type() const
Returns the type of object.
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
A geometric constraint between board items (issue #2329).
const std::vector< CONSTRAINT_MEMBER > & GetMembers() const
PCB_CONSTRAINT_TYPE GetConstraintType() const
void AddMember(const KIID &aItem, CONSTRAINT_ANCHOR aAnchor=CONSTRAINT_ANCHOR::WHOLE, int aIndex=-1)
void RemapKIIDs(const std::map< KIID, KIID > &aIdMap) override
Remap KIIDs this item stores to reference other items (e.g.
void SetEnd(const VECTOR2I &aEnd) override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetStart(const VECTOR2I &aStart) override
void SetStroke(const STROKE_PARAMS &aStroke) override
virtual void Add(EDA_ITEM *aItem)
Simple container to manage line stroke parameters.
static bool empty(const wxTextEntryBase *aCtrl)
@ WHOLE
The item as a whole (a segment as a line, a circle).
@ PARALLEL
Two segments are parallel.
static bool addSegment(VRML_LAYER &model, IDF_SEGMENT *seg, int icont, int iseg)
One participant in a constraint: a referenced board item plus the feature of that item that participa...
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(ConstraintCopiedWhenAllMembersSelected)
static void roundTrip(const DIFF_VALUE &aValue)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
static const long long MM
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
VECTOR2< int32_t > VECTOR2I