KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_sch_pin.cpp File Reference
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <qa_utils/wx_utils/wx_assert.h>
#include <lib_symbol.h>
#include <pin_type.h>
#include <sch_pin.h>
#include <sch_symbol.h>

Go to the source code of this file.

Classes

class  TEST_SCH_PIN_FIXTURE
 

Functions

 BOOST_AUTO_TEST_CASE (DefaultProperties)
 Declare the test suite.
 
 BOOST_AUTO_TEST_CASE (Assign)
 Check the assignment operator.
 
 BOOST_AUTO_TEST_CASE (Copy)
 Check the copy ctor.
 
 BOOST_AUTO_TEST_CASE (PinDangling)
 Check the pin dangling flag.
 
 BOOST_AUTO_TEST_CASE (PinNumbering)
 Check the pin labelling.
 
 BOOST_AUTO_TEST_CASE (PinNumberingPower)
 Check the pin labelling when it's a power pin.
 
 BOOST_AUTO_TEST_CASE (AlternatePinRenameUpdates)
 
 BOOST_AUTO_TEST_CASE (AlternatePinTypeReturnsCorrectType)
 Test for issue #22286 - GetType() should return the alternate's type when alternate is selected.
 
 BOOST_AUTO_TEST_CASE (AlternatePinTypePersistsThroughSymbolUpdate)
 Test for issue #22286 - simulate schematic loading scenario When a schematic is loaded, the pin's alternate is set BEFORE SetLibSymbol is called.
 
 BOOST_AUTO_TEST_CASE (ParserCreatedPinWithAlternate)
 Test for issue #22286 - simulate parser-created pins with alternates The parser creates pins with m_alt set but m_libPin=nullptr.
 
 BOOST_AUTO_TEST_CASE (LibraryPinAlternatesPreservedThroughCopy)
 Test for issue #22286 - detailed trace of SetLibSymbol flow Verifies that library pin alternates are preserved through the copy and that SetAlt succeeds in UpdatePins().
 
 BOOST_AUTO_TEST_CASE (GetTypeBeforeLibPinSet)
 Test for issue #22286 - verify behavior when GetType() is called before m_libPin is set.
 
 BOOST_AUTO_TEST_CASE (ChangeSymbolFewerPinsNoCrash)
 Test for issue #22566 - changing to a symbol with fewer pins should not crash.
 
 BOOST_AUTO_TEST_CASE (HasConnectivityChangesForPowerPinVisibility)
 Test for issue #21159 - HasConnectivityChanges should detect visibility changes for power input pins because visibility affects IsGlobalPower() which changes connectivity semantics.
 
 BOOST_AUTO_TEST_CASE (HasConnectivityChangesForPinTypeChange)
 Test for issue #21159 - HasConnectivityChanges should detect pin type changes when changing to/from PT_POWER_IN.
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/15]

BOOST_AUTO_TEST_CASE ( AlternatePinRenameUpdates )

◆ BOOST_AUTO_TEST_CASE() [2/15]

BOOST_AUTO_TEST_CASE ( AlternatePinTypePersistsThroughSymbolUpdate )

Test for issue #22286 - simulate schematic loading scenario When a schematic is loaded, the pin's alternate is set BEFORE SetLibSymbol is called.

The alternate must persist through UpdatePins().

Definition at line 257 of file test_sch_pin.cpp.

References BOOST_CHECK_EQUAL(), LINE, SCH_PIN::ALT::m_Name, SCH_PIN::ALT::m_Shape, SCH_PIN::ALT::m_Type, PT_NC, and PT_POWER_IN.

◆ BOOST_AUTO_TEST_CASE() [3/15]

BOOST_AUTO_TEST_CASE ( AlternatePinTypeReturnsCorrectType )

Test for issue #22286 - GetType() should return the alternate's type when alternate is selected.

Definition at line 221 of file test_sch_pin.cpp.

References BOOST_CHECK_EQUAL(), LINE, SCH_PIN::ALT::m_Name, SCH_PIN::ALT::m_Shape, SCH_PIN::ALT::m_Type, PT_NC, and PT_POWER_IN.

◆ BOOST_AUTO_TEST_CASE() [4/15]

BOOST_AUTO_TEST_CASE ( Assign )

Check the assignment operator.

Definition at line 101 of file test_sch_pin.cpp.

References BOOST_CHECK_EQUAL(), SCH_PIN::GetNumber(), and SCH_ITEM::GetParentSymbol().

◆ BOOST_AUTO_TEST_CASE() [5/15]

◆ BOOST_AUTO_TEST_CASE() [6/15]

BOOST_AUTO_TEST_CASE ( Copy )

◆ BOOST_AUTO_TEST_CASE() [7/15]

BOOST_AUTO_TEST_CASE ( DefaultProperties )

Declare the test suite.

Check basic properties of an un-modified SCH_PIN object

Definition at line 81 of file test_sch_pin.cpp.

References BOOST_AUTO_TEST_CASE(), and BOOST_CHECK_EQUAL().

◆ BOOST_AUTO_TEST_CASE() [8/15]

BOOST_AUTO_TEST_CASE ( GetTypeBeforeLibPinSet )

◆ BOOST_AUTO_TEST_CASE() [9/15]

BOOST_AUTO_TEST_CASE ( HasConnectivityChangesForPinTypeChange )

Test for issue #21159 - HasConnectivityChanges should detect pin type changes when changing to/from PT_POWER_IN.

Definition at line 703 of file test_sch_pin.cpp.

References LIB_SYMBOL::AddDrawItem(), LIB_SYMBOL::GetLibId(), SCH_SYMBOL::GetPins(), SCH_PIN::HasConnectivityChanges(), path, PT_INPUT, PT_POWER_IN, SCH_PIN::SetName(), SCH_PIN::SetNumber(), SCH_PIN::SetPosition(), SCH_SYMBOL::SetRef(), SCH_PIN::SetType(), and SCH_SYMBOL::UpdatePins().

◆ BOOST_AUTO_TEST_CASE() [10/15]

BOOST_AUTO_TEST_CASE ( HasConnectivityChangesForPowerPinVisibility )

Test for issue #21159 - HasConnectivityChanges should detect visibility changes for power input pins because visibility affects IsGlobalPower() which changes connectivity semantics.

Definition at line 621 of file test_sch_pin.cpp.

References LIB_SYMBOL::AddDrawItem(), LIB_SYMBOL::GetLibId(), SCH_SYMBOL::GetPins(), SCH_PIN::GetType(), SCH_PIN::HasConnectivityChanges(), SCH_PIN::IsGlobalPower(), SCH_PIN::IsVisible(), path, PT_INPUT, PT_POWER_IN, SCH_PIN::SetName(), SCH_PIN::SetNumber(), SCH_PIN::SetPosition(), SCH_SYMBOL::SetRef(), SCH_PIN::SetType(), SCH_PIN::SetVisible(), and SCH_SYMBOL::UpdatePins().

◆ BOOST_AUTO_TEST_CASE() [11/15]

BOOST_AUTO_TEST_CASE ( LibraryPinAlternatesPreservedThroughCopy )

◆ BOOST_AUTO_TEST_CASE() [12/15]

BOOST_AUTO_TEST_CASE ( ParserCreatedPinWithAlternate )

◆ BOOST_AUTO_TEST_CASE() [13/15]

BOOST_AUTO_TEST_CASE ( PinDangling )

Check the pin dangling flag.

Definition at line 136 of file test_sch_pin.cpp.

References BOOST_CHECK_EQUAL().

◆ BOOST_AUTO_TEST_CASE() [14/15]

BOOST_AUTO_TEST_CASE ( PinNumbering )

Check the pin labelling.

Definition at line 153 of file test_sch_pin.cpp.

References BOOST_CHECK_EQUAL(), name, and path.

◆ BOOST_AUTO_TEST_CASE() [15/15]

BOOST_AUTO_TEST_CASE ( PinNumberingPower )

Check the pin labelling when it's a power pin.

Definition at line 169 of file test_sch_pin.cpp.

References BOOST_CHECK_EQUAL(), path, and PT_POWER_IN.