KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_clipboard_group.cpp File Reference

Regression tests for clipboard copy/paste of PCB_GROUPs. More...

#include <qa_utils/wx_utils/unit_test_utils.h>
#include <board.h>
#include <kicad_clipboard.h>
#include <lset.h>
#include <pcb_group.h>
#include <pcb_shape.h>
#include <tools/pcb_selection.h>

Go to the source code of this file.

Functions

 BOOST_AUTO_TEST_CASE (CopyPasteGroupPreservesMembership)
 Copy a group containing two PCB_SHAPE objects to the clipboard, parse it back, and verify the round-tripped board still contains the group with both members associated.
 
 BOOST_AUTO_TEST_CASE (CopyPasteNestedGroupPreservesMembership)
 Copy a nested group structure (group containing a group) and verify both levels survive the clipboard round-trip with intact membership.
 

Detailed Description

Regression tests for clipboard copy/paste of PCB_GROUPs.

Specifically guards against https://gitlab.com/kicad/code/kicad/-/issues/24000 where groups appeared ungrouped after paste because PCB_IO_KICAD_SEXPR::format(PCB_GROUP*) validated cloned member pointers against the source board's pointer cache and dropped every member as "invalid", causing the (group ...) sexpr to be omitted entirely.

Definition in file test_clipboard_group.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

BOOST_AUTO_TEST_CASE ( CopyPasteGroupPreservesMembership )

Copy a group containing two PCB_SHAPE objects to the clipboard, parse it back, and verify the round-tripped board still contains the group with both members associated.

Definition at line 80 of file test_clipboard_group.cpp.

References SELECTION::Add(), LSET::AllCuMask(), LSET::AllTechMask(), BOOST_AUTO_TEST_CASE(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), F_SilkS, EDA_GROUP::GetItems(), EDA_GROUP::GetName(), EDA_ITEM::GetParentGroup(), group, pcbIUScale, RECTANGLE, SEGMENT, EDA_SHAPE::SetEnd(), PCB_SHAPE::SetLayer(), EDA_SHAPE::SetStart(), PCB_SHAPE::SetStroke(), and SOLID.

◆ BOOST_AUTO_TEST_CASE() [2/2]

BOOST_AUTO_TEST_CASE ( CopyPasteNestedGroupPreservesMembership )

Copy a nested group structure (group containing a group) and verify both levels survive the clipboard round-trip with intact membership.

Definition at line 131 of file test_clipboard_group.cpp.

References SELECTION::Add(), EDA_GROUP::AddItem(), LSET::AllCuMask(), LSET::AllTechMask(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), F_SilkS, EDA_GROUP::GetItems(), EDA_ITEM::GetParentGroup(), pcbIUScale, SEGMENT, EDA_SHAPE::SetEnd(), PCB_SHAPE::SetLayer(), EDA_GROUP::SetName(), EDA_SHAPE::SetStart(), PCB_SHAPE::SetStroke(), and SOLID.