52std::unique_ptr<BOARD> roundTripSelection(
BOARD* aSourceBoard,
const PCB_SELECTION& aSelection )
54 wxString clipboardData;
58 io.
SetWriter( [&](
const wxString& aData ) { clipboardData = aData; } );
59 io.
SetReader( [&]() {
return clipboardData; } );
65 BOOST_REQUIRE_EQUAL( parsed->
Type(),
PCB_T );
67 return std::unique_ptr<BOARD>(
static_cast<BOARD*
>( parsed ) );
82 auto board = std::make_unique<BOARD>();
100 group->SetName( wxT(
"TestGroup" ) );
101 group->AddItem( line1 );
102 group->AddItem( rect );
108 std::unique_ptr<BOARD> clipBoard = roundTripSelection( board.get(), selection );
110 BOOST_REQUIRE_EQUAL( clipBoard->Groups().size(), 1u );
112 PCB_GROUP* pastedGroup = clipBoard->Groups().front();
133 auto board = std::make_unique<BOARD>();
141 board->Add( innerShape1 );
148 board->Add( innerShape2 );
151 innerGroup->
SetName( wxT(
"InnerGroup" ) );
152 innerGroup->
AddItem( innerShape1 );
153 innerGroup->
AddItem( innerShape2 );
154 board->Add( innerGroup );
161 board->Add( outerShape );
164 outerGroup->
SetName( wxT(
"OuterGroup" ) );
165 outerGroup->
AddItem( innerGroup );
166 outerGroup->
AddItem( outerShape );
167 board->Add( outerGroup );
170 selection.
Add( outerGroup );
172 std::unique_ptr<BOARD> clipBoard = roundTripSelection( board.get(), selection );
174 BOOST_REQUIRE_EQUAL( clipBoard->Groups().size(), 2u );
180 for(
PCB_GROUP* g : clipBoard->Groups() )
182 if( g->GetName() == wxT(
"OuterGroup" ) )
184 else if( g->GetName() == wxT(
"InnerGroup" ) )
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 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)
std::unordered_set< EDA_ITEM * > & GetItems()
void AddItem(EDA_ITEM *aItem)
Add item to group.
void SetName(const wxString &aName)
A base class for most all the KiCad significant classes used in schematics and boards.
virtual EDA_GROUP * GetParentGroup() const
KICAD_T Type() const
Returns the type of object.
void SetStart(const VECTOR2I &aStart)
void SetEnd(const VECTOR2I &aEnd)
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 set of BOARD_ITEMs (i.e., without duplicates).
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetStroke(const STROKE_PARAMS &aStroke) override
virtual void Add(EDA_ITEM *aItem)
Simple container to manage line stroke parameters.
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
Class to handle a set of BOARD_ITEMs.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(CopyPasteGroupPreservesMembership)
Copy a group containing two PCB_SHAPE objects to the clipboard, parse it back, and verify the round-t...
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I