24#include <boost/test/unit_test.hpp>
41 auto footprint = std::make_unique<FOOTPRINT>( board );
42 auto pad =
new PAD( footprint.get() );
43 pad->SetNumber(
"1" );
48 footprint->Add(
pad );
50 FOOTPRINT* liveFootprint = footprint.get();
51 board->
Add( footprint.release() );
53 auto image = std::unique_ptr<FOOTPRINT>(
static_cast<FOOTPRINT*
>( liveFootprint->
Clone() ) );
62 BOOST_CHECK( resolved != originalPad );
72 auto shape = std::make_unique<PCB_SHAPE>( board );
77 board->
Add( shape.release() );
79 const_cast<KIID&
>( liveShape->
m_Uuid ) = newId;
81 BOOST_CHECK( board->
ResolveItem( oldId,
true ) ==
nullptr );
92 auto shape = std::make_unique<PCB_SHAPE>( board );
97 board->
Add( shape.release() );
98 const_cast<KIID&
>( liveShape->
m_Uuid ) = newId;
112 auto shape = std::make_unique<PCB_SHAPE>( board );
117 board->
Add( shape.release() );
120 BOOST_CHECK( liveShape->
m_Uuid == newId );
133 auto footprint = std::make_unique<FOOTPRINT>( board );
134 auto pad =
new PAD( footprint.get() );
139 footprint->Add(
pad );
140 board->
Add( footprint.release() );
144 BOOST_CHECK( livePad->
m_Uuid == newId );
157 auto shape = std::make_unique<PCB_SHAPE>( board );
162 board->
Add( shape.release() );
164 const_cast<KIID&
>( liveShape->
m_Uuid ) = newId;
179 auto footprint = std::make_unique<FOOTPRINT>( board );
180 FOOTPRINT* liveFootprint = footprint.get();
183 auto shape = std::make_unique<PCB_SHAPE>( board );
185 const KIID originalShapeId = liveShape->
m_Uuid;
187 board->
Add( footprint.release() );
188 board->
Add( shape.release() );
190 const_cast<KIID&
>( liveShape->
m_Uuid ) = claimedId;
193 BOOST_CHECK( liveFootprint->
m_Uuid == claimedId );
194 BOOST_CHECK( liveShape->
m_Uuid != claimedId );
195 BOOST_CHECK( liveShape->
m_Uuid != originalShapeId );
197 BOOST_CHECK( board->
ResolveItem( originalShapeId,
true ) ==
nullptr );
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SwapItemData(BOARD_ITEM *aImage)
Swap data between aItem and aImage.
void SetUuid(const KIID &aUuid)
Information pertinent to a Pcbnew printed circuit board.
void CacheItemById(BOARD_ITEM *aItem) const
Add an item to the item-by-id cache.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
void RebindItemUuid(BOARD_ITEM *aItem, const KIID &aNewId)
Rebind the UUID of an attached item and keep the item-by-id cache coherent.
int RepairDuplicateItemUuids()
Rebind duplicate attached-item UUIDs so each live board item has a unique ID.
const std::unordered_map< KIID, BOARD_ITEM * > & GetItemByIdCache() const
BOARD_ITEM * ResolveItem(const KIID &aID, bool aAllowNullptrReturn=false) const
KICAD_T Type() const
Returns the type of object.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(SwapItemDataReindexesFootprintChildren)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")
@ PCB_PAD_T
class PAD, a pad in a footprint