20#include <boost/test/unit_test.hpp>
64 BOOST_CHECK(
copy != &shape );
93 text->SetText( wxT(
"${REFERENCE}" ) );
180 VECTOR2I origin( 10000000, 10000000 );
191 std::map<BOARD_ITEM*, VECTOR2I> before;
194 before[item] = item->GetPosition();
196 BOOST_REQUIRE_EQUAL( before.size(), 2u );
200 stack->
EditStart(
nullptr, &board, &commit );
206 stack->
Update(
nullptr, &board, &commit );
209 stack->
EditFinish(
nullptr, &board, &commit );
215 for(
const auto& [item, pos] : before )
217 BOOST_CHECK_MESSAGE( item->GetPosition() == pos,
218 "hop left behind at " + item->GetPosition().Format() +
" instead of " + pos.Format() );
247 BOOST_REQUIRE_EQUAL( original.size(), 2u );
251 stack->
EditStart(
nullptr, &board, &commit );
255 stack->
Update(
nullptr, &board, &commit );
256 stack->
EditFinish(
nullptr, &board, &commit );
261 "replaced hop is staged as " << commit.
GetStatus( item ) <<
", expected CHT_REMOVE only" );
292 BOOST_REQUIRE_EQUAL( before.size(), 2u );
297 BOOST_CHECK( !stack->
Update(
nullptr, &board, &commit ) );
301 BOOST_REQUIRE_EQUAL( after.size(), before.size() );
302 BOOST_CHECK_MESSAGE( std::set<BOARD_ITEM*>( before.begin(), before.end() )
303 == std::set<BOARD_ITEM*>( after.begin(), after.end() ),
304 "the hops were rebuilt outside an edit" );
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE) override
Add a change of the item aItem of type aChangeType to the change list.
virtual void Revert() override
Revert the commit by restoring the modified items state.
static EDA_ITEM * MakeImage(EDA_ITEM *aItem)
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 SetCopperLayerCount(int aCount)
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
int GetStatus(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Returns status of an item.
A base class for most all the KiCad significant classes used in schematics and boards.
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.
void SetPosition(const VECTOR2I &aPos) override
VECTOR2I GetPosition() const override
A set of BOARD_ITEMs (i.e., without duplicates).
std::unordered_set< BOARD_ITEM * > GetBoardItems() const
A microvia stack: several single hop microvias, plus connecting traces for staggered stacks,...
bool Update(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
void EditStart(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
void EditFinish(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
void Regenerate(BOARD *aBoard, BOARD_COMMIT *aCommit)
Rebuild the member vias (and, for a staggered stack, the connecting traces) from the current stack se...
void SetStartLayer(PCB_LAYER_ID aLayer)
void SetViaSize(int aSize)
void SetViaDrill(int aDrill)
void Move(const VECTOR2I &aMoveVector) override
Move this object.
void SetEndLayer(PCB_LAYER_ID aLayer)
bool Contains(EDA_ITEM *aItem) const
#define UR_TRANSIENT
indicates the item is owned by the undo/redo stack
Class to handle a set of BOARD_ITEMs.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(RecursesThroughGroups)
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")
VECTOR2< int32_t > VECTOR2I