42 auto symbol = std::make_unique<LIB_SYMBOL>( wxT(
"TestIC" ) );
45 symbol->SetPinNameOffset( 0 );
46 symbol->SetShowPinNames(
true );
47 symbol->SetShowPinNumbers(
true );
49 auto pinOwner = std::make_unique<SCH_PIN>( symbol.get() );
50 pinOwner->SetPosition(
VECTOR2I( 0, 0 ) );
52 pinOwner->SetLength(
schIUScale.MilsToIU( 200 ) );
53 pinOwner->SetName( wxT(
"SDI" ) );
54 pinOwner->SetNumber( wxT(
"14" ) );
56 pinOwner->SetUnit( 1 );
59 symbol->AddDrawItem( pinOwner.release() );
63 std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> nameInfo = cache.
GetPinNameInfo( 0 );
64 std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> numberInfo = cache.
GetPinNumberInfo( 0 );
69 int pinY =
pin->GetPosition().y;
70 int nameClearance =
std::abs( nameInfo->m_TextPosition.y - pinY );
71 int numberClearance =
std::abs( numberInfo->m_TextPosition.y - pinY );
75 const int tolerance = 2;
77 BOOST_CHECK_MESSAGE(
std::abs( nameClearance - numberClearance ) <= tolerance,
78 "Pin number clearance (" << numberClearance
79 <<
" IU) does not match pin name clearance (" << nameClearance
80 <<
" IU) even though both use the default 50 mil text size" );