53LIB_SYMBOL* MakeTestLibSymbol(
const wxString& aName,
const wxString& aPin1Num,
54 const wxString& aPin2Num )
60 pin1->SetNumber( aPin1Num );
61 pin1->SetName(
"pin_a" );
79 std::set<wxString> nums;
82 nums.insert(
pin->GetNumber() );
98 std::unique_ptr<LIB_SYMBOL> modifiedLib( MakeTestLibSymbol(
"TestPart",
"A1",
"A2" ) );
104 BOOST_REQUIRE_EQUAL( symbol.
GetPins( &
path ).size(), 2 );
105 BOOST_CHECK( PinNumbers( symbol,
path ) == ( std::set<wxString>{
"A1",
"A2" } ) );
108 symbol.
SetLibSymbol( MakeTestLibSymbol(
"TestPart",
"1",
"2" ) );
110 BOOST_CHECK( PinNumbers( symbol,
path ) == ( std::set<wxString>{
"1",
"2" } ) );
121 destScreen.
AddLibSymbol( MakeTestLibSymbol(
"TestPart",
"1",
"2" ) );
124 clipScreen.
AddLibSymbol( MakeTestLibSymbol(
"TestPart",
"A1",
"A2" ) );
126 std::unique_ptr<LIB_SYMBOL> clipLib( MakeTestLibSymbol(
"TestPart",
"A1",
"A2" ) );
139 BOOST_CHECK_MESSAGE( PinNumbers( symbol,
path ) == ( std::set<wxString>{
"A1",
"A2" } ),
140 "Paste must keep the clipboard's modified pin numbers" );
150 LIB_SYMBOL* destPower = MakeTestLibSymbol(
"PWR",
"1",
"1" );
156 LIB_SYMBOL* clipPower = MakeTestLibSymbol(
"PWR",
"1",
"1" );
168 "Paste must keep the clipboard symbol's local power type" );
179 LIB_SYMBOL* destLib = MakeTestLibSymbol(
"TestPart",
"1",
"2" );
constexpr EDA_IU_SCALE schIUScale
A logical library item identifier and consists of various portions much like a URI.
Define a library symbol object.
const LIB_ID & GetLibId() const override
bool IsLocalPower() const override
void SetLibId(const LIB_ID &aLibId)
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
static const LIB_SYMBOL * ChoosePasteLibSymbol(const SCH_SCREEN *aClipboardScreen, const SCH_SCREEN *aDestScreen, const wxString &aLibSymbolName)
Choose which cached library symbol a pasted instance should adopt.
void SetNumber(const wxString &aNumber)
void SetName(const wxString &aName)
void SetPosition(const VECTOR2I &aPos) override
void SetType(ELECTRICAL_PINTYPE aType)
void AddLibSymbol(LIB_SYMBOL *aLibSymbol)
Add aLibSymbol to the library symbol map.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
wxString GetSchSymbolLibraryName() const
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
@ PT_INPUT
usual pin input: must be connected
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_CASE(Issue21401_WrongLibSymbolRevertsPinNumbers)
The core bug mechanism: SetLibSymbol()/UpdatePins() drives pin numbers from the chosen lib symbol.
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I