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

Test pin number layout for stacked multi-line numbers across all rotations. More...

#include <qa_utils/wx_utils/unit_test_utils.h>
#include <sch_pin.h>
#include <lib_symbol.h>
#include <pin_layout_cache.h>
#include <transform.h>
#include <sch_io/sch_io_mgr.h>
#include <wx/log.h>
#include <boost/test/unit_test.hpp>

Go to the source code of this file.

Functions

static std::unique_ptr< LIB_SYMBOLcreateTestResistorSymbol ()
 Create a test symbol with stacked pin numbers for rotation testing.
 
static VECTOR2I getPinLineEnd (const SCH_PIN *pin, const TRANSFORM &transform)
 Get pin geometry (line segment from connection point to pin end)
 
static bool boxIntersectsLine (const BOX2I &box, const VECTOR2I &lineStart, const VECTOR2I &lineEnd)
 Check if a box intersects with a line segment.
 
 BOOST_AUTO_TEST_CASE (PinNumbersNoOverlapAllRotations)
 Test that pin numbers don't overlap with pin geometry across all rotations.
 
 BOOST_AUTO_TEST_CASE (PinTextConsistentSidePlacement)
 Test that multiline and non-multiline pin numbers/names are positioned consistently on the same side of the pin for each rotation.
 
 BOOST_AUTO_TEST_CASE (PinTextSameBottomCoordinate)
 Test that multiline and non-multiline pin numbers/names have the same bottom coordinate (distance from pin along the axis connecting pin and text)
 

Detailed Description

Test pin number layout for stacked multi-line numbers across all rotations.

Definition in file test_pin_stacked_layout.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/3]

◆ BOOST_AUTO_TEST_CASE() [2/3]

BOOST_AUTO_TEST_CASE ( PinTextConsistentSidePlacement )

Test that multiline and non-multiline pin numbers/names are positioned consistently on the same side of the pin for each rotation.

Definition at line 277 of file test_pin_stacked_layout.cpp.

References BOOST_REQUIRE(), createTestResistorSymbol(), DefaultTransform, PIN_LAYOUT_CACHE::GetPinNameInfo(), PIN_LAYOUT_CACHE::GetPinNumberInfo(), info, PIN_LAYOUT_CACHE::TEXT_INFO::m_Text, PIN_LAYOUT_CACHE::TEXT_INFO::m_TextPosition, pin, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, and SCH_PIN_T.

◆ BOOST_AUTO_TEST_CASE() [3/3]

BOOST_AUTO_TEST_CASE ( PinTextSameBottomCoordinate )

Test that multiline and non-multiline pin numbers/names have the same bottom coordinate (distance from pin along the axis connecting pin and text)

Definition at line 399 of file test_pin_stacked_layout.cpp.

References BOOST_REQUIRE(), createTestResistorSymbol(), DefaultTransform, PIN_LAYOUT_CACHE::GetPinNameInfo(), PIN_LAYOUT_CACHE::GetPinNumberInfo(), PIN_LAYOUT_CACHE::TEXT_INFO::m_Text, PIN_LAYOUT_CACHE::TEXT_INFO::m_TextPosition, PIN_LAYOUT_CACHE::TEXT_INFO::m_TextSize, pin, PIN_DOWN, PIN_UP, SCH_PIN_T, and wxStringSplit().

◆ boxIntersectsLine()

static bool boxIntersectsLine ( const BOX2I & box,
const VECTOR2I & lineStart,
const VECTOR2I & lineEnd )
static

◆ createTestResistorSymbol()

static std::unique_ptr< LIB_SYMBOL > createTestResistorSymbol ( )
static

Create a test symbol with stacked pin numbers for rotation testing.

Definition at line 45 of file test_pin_stacked_layout.cpp.

References createTestResistorSymbol(), PIN_DOWN, PIN_UP, PT_PASSIVE, and schIUScale.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and createTestResistorSymbol().

◆ getPinLineEnd()

static VECTOR2I getPinLineEnd ( const SCH_PIN * pin,
const TRANSFORM & transform )
static

Get pin geometry (line segment from connection point to pin end)

Definition at line 82 of file test_pin_stacked_layout.cpp.

References end, INHERIT, pin, PIN_DOWN, PIN_LEFT, PIN_RIGHT, and PIN_UP.

Referenced by BOOST_AUTO_TEST_CASE().