mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Fix QA.
QA was built with pin names outside but this was a bug. For now, we only want to test outside pin names. The test can be expanded in the future
This commit is contained in:
parent
2c102a62e0
commit
32ee4ebdfa
@ -1697,7 +1697,25 @@ int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags, REPORTER* aR
|
||||
if( !aReporter )
|
||||
return retv;
|
||||
}
|
||||
else if( int tmp = aField->SCH_ITEM::compare( *bField, aCompareFlags ) )
|
||||
else
|
||||
{
|
||||
int tmp = 0;
|
||||
|
||||
// For EQUALITY comparison, we need to compare field content directly
|
||||
// since SCH_ITEM::compare() returns 0 for EQUALITY flag
|
||||
if( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::EQUALITY )
|
||||
{
|
||||
// Compare field text content
|
||||
tmp = aField->GetText().CmpNoCase( bField->GetText() );
|
||||
}
|
||||
|
||||
if( tmp == 0 )
|
||||
{
|
||||
// Fall back to base class comparison for other properties
|
||||
tmp = aField->SCH_ITEM::compare( *bField, aCompareFlags );
|
||||
}
|
||||
|
||||
if( tmp != 0 )
|
||||
{
|
||||
retv = tmp;
|
||||
REPORT( wxString::Format( _( "Field '%s' differs: %s; %s." ),
|
||||
@ -1709,6 +1727,7 @@ int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags, REPORTER* aR
|
||||
return retv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( const SCH_FIELD* bField : bFields )
|
||||
{
|
||||
|
@ -750,7 +750,9 @@ std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> PIN_LAYOUT_CACHE::GetPinNameInfo( int
|
||||
info->m_Thickness = m_nameThickness;
|
||||
info->m_Angle = ANGLE_HORIZONTAL;
|
||||
|
||||
if( m_pin.GetParentSymbol()->GetPinNameOffset() > 0 )
|
||||
bool nameInside = m_pin.GetParentSymbol()->GetPinNameOffset() > 0;
|
||||
|
||||
if( nameInside )
|
||||
{
|
||||
// This means name inside the pin
|
||||
VECTOR2I pos = { m_pin.GetLength() + m_pin.GetParentSymbol()->GetPinNameOffset(), 0 };
|
||||
@ -760,6 +762,7 @@ std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> PIN_LAYOUT_CACHE::GetPinNameInfo( int
|
||||
info->m_TextPosition = pos + VECTOR2I{ thickOffset, 0 };
|
||||
info->m_HAlign = GR_TEXT_H_ALIGN_LEFT;
|
||||
info->m_VAlign = GR_TEXT_V_ALIGN_CENTER;
|
||||
transformTextForPin( *info );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -769,9 +772,10 @@ std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> PIN_LAYOUT_CACHE::GetPinNameInfo( int
|
||||
info->m_TextPosition = pos;
|
||||
info->m_HAlign = GR_TEXT_H_ALIGN_CENTER;
|
||||
info->m_VAlign = GR_TEXT_V_ALIGN_BOTTOM;
|
||||
}
|
||||
|
||||
// New policy: names follow same positioning semantics as numbers.
|
||||
// New policy: names follow same positioning semantics as numbers except when
|
||||
// specified as inside. When names are inside, they should not overlap with the
|
||||
// number position.
|
||||
const SYMBOL* parentSym = m_pin.GetParentSymbol();
|
||||
if( parentSym )
|
||||
{
|
||||
@ -807,6 +811,7 @@ std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> PIN_LAYOUT_CACHE::GetPinNameInfo( int
|
||||
info->m_VAlign = GR_TEXT_V_ALIGN_CENTER;
|
||||
}
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,9 @@ static std::unique_ptr<LIB_SYMBOL> createTestResistorSymbol()
|
||||
{
|
||||
auto symbol = std::make_unique<LIB_SYMBOL>( wxT( "TestResistor" ) );
|
||||
|
||||
// Set pin name offset to 0 so names are positioned outside (like numbers)
|
||||
symbol->SetPinNameOffset( 0 );
|
||||
|
||||
// Create first pin with stacked numbers [1-5]
|
||||
auto pin1 = std::make_unique<SCH_PIN>( symbol.get() );
|
||||
pin1->SetPosition( VECTOR2I( 0, schIUScale.MilsToIU( 250 ) ) ); // top pin
|
||||
|
Loading…
x
Reference in New Issue
Block a user