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

Test suite for SCH_SYMBOL object. More...

Go to the source code of this file.

Classes

class  TEST_SCH_SYMBOL_FIXTURE
 

Functions

 BOOST_AUTO_TEST_CASE (DefaultProperties)
 Declare the test suite.
 
 BOOST_AUTO_TEST_CASE (Orientation)
 Test the orientation transform changes.
 
 BOOST_AUTO_TEST_CASE (SchSymbolVariantTest)
 Test symbol variant handling.
 
 BOOST_AUTO_TEST_CASE (FieldAdditionByName)
 Test field addition and retrieval by name.
 
 BOOST_AUTO_TEST_CASE (VariantDescription)
 Test variant description methods.
 
 BOOST_AUTO_TEST_CASE (TextVariableVARIANT)
 Test ${VARIANT} text variable resolution.
 
 BOOST_AUTO_TEST_CASE (TextVariableVARIANT_DESC)
 Test ${VARIANT_DESC} text variable resolution.
 
 BOOST_AUTO_TEST_CASE (RenameVariantPreservesData)
 Test RenameVariant preserves data.
 
 BOOST_AUTO_TEST_CASE (CopyVariantCreatesIndependentCopy)
 Test CopyVariant creates an independent copy.
 
 BOOST_AUTO_TEST_CASE (VariantFieldDifferenceDetection)
 Test variant field value difference detection.
 
 BOOST_AUTO_TEST_CASE (VariantDNPFiltering)
 Test variant DNP filtering for BOM.
 
 BOOST_AUTO_TEST_CASE (GetVariantNamesForUI)
 Test GetVariantNamesForUI returns properly formatted array.
 
 BOOST_AUTO_TEST_CASE (SetValueFieldTextPersistsVariantValue)
 Test that SetValueFieldText correctly persists variant field values.
 
 BOOST_AUTO_TEST_CASE (SetFieldTextAndSetValueFieldTextConsistency)
 Test that SetFieldText works consistently with SetValueFieldText for the VALUE field.
 
 BOOST_AUTO_TEST_CASE (VariantNameHandling)
 Test variant name handling in eeschema.
 
 BOOST_AUTO_TEST_CASE (VariantDeletionCascade)
 Test variant deletion clears symbol variant data.
 
 BOOST_AUTO_TEST_CASE (VariantFieldUnicodeAndSpecialChars)
 Test variant field values with unicode and special characters.
 
 BOOST_AUTO_TEST_CASE (VariantSpecificFieldDereferencing)
 Test variant-specific field dereferencing via ${REF:FIELD:VARIANT} syntax.
 
 BOOST_AUTO_TEST_CASE (FootprintFieldVariantSupport)
 Test footprint field variant support.
 
 BOOST_AUTO_TEST_CASE (FootprintFieldVariantNoOpWhenSame)
 Test that setting footprint to same value as base when variant is active does not create an unnecessary override entry.
 

Detailed Description

Test suite for SCH_SYMBOL object.

Definition in file test_sch_symbol.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/20]

◆ BOOST_AUTO_TEST_CASE() [2/20]

BOOST_AUTO_TEST_CASE ( DefaultProperties )

Declare the test suite.

Check that we can get the default properties as expected.

Definition at line 76 of file test_sch_symbol.cpp.

References BOOST_AUTO_TEST_CASE().

◆ BOOST_AUTO_TEST_CASE() [3/20]

BOOST_AUTO_TEST_CASE ( FieldAdditionByName )

Test field addition and retrieval by name.

Verifies that GetField(wxString) returns null for non-existent fields and that AddField properly creates new fields (fix for issue #22628).

Definition at line 160 of file test_sch_symbol.cpp.

References SCH_SYMBOL::AddField(), BOOST_REQUIRE(), KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetField(), EDA_ITEM::GetParent(), SCH_FIELD::GetText(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), EDA_ITEM::SetParent(), SCH_FIELD::SetText(), and USER.

◆ BOOST_AUTO_TEST_CASE() [4/20]

BOOST_AUTO_TEST_CASE ( FootprintFieldVariantNoOpWhenSame )

Test that setting footprint to same value as base when variant is active does not create an unnecessary override entry.

Definition at line 939 of file test_sch_symbol.cpp.

References BOOST_REQUIRE(), FOOTPRINT, KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetField(), SCH_FIELD::GetName(), SCH_SYMBOL::GetVariant(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), SCH_SYMBOL::SetFieldText(), and SCH_SYMBOL::SetFootprintFieldText().

◆ BOOST_AUTO_TEST_CASE() [5/20]

BOOST_AUTO_TEST_CASE ( FootprintFieldVariantSupport )

Test footprint field variant support.

Verifies that editing the footprint field when a variant is active creates a variant-specific override instead of modifying the base footprint value.

Definition at line 886 of file test_sch_symbol.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), FOOTPRINT, KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetField(), SCH_SYMBOL::GetFieldText(), SCH_SYMBOL::GetFootprintFieldText(), SCH_FIELD::GetName(), SCH_SYMBOL::GetVariant(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), SCH_SYMBOL::SetFieldText(), and SCH_SYMBOL::SetFootprintFieldText().

◆ BOOST_AUTO_TEST_CASE() [6/20]

BOOST_AUTO_TEST_CASE ( GetVariantNamesForUI )

Test GetVariantNamesForUI returns properly formatted array.

Definition at line 538 of file test_sch_symbol.cpp.

References BOOST_REQUIRE(), KI_TEST::GetEeschemaTestDataDir(), FILEEXT::KiCadSchematicFileExtension, and LoadSchematic().

◆ BOOST_AUTO_TEST_CASE() [7/20]

BOOST_AUTO_TEST_CASE ( Orientation )

Test the orientation transform changes.

Definition at line 84 of file test_sch_symbol.cpp.

References SYM_ORIENT_180, SYM_ORIENT_270, and SYM_ORIENT_90.

◆ BOOST_AUTO_TEST_CASE() [8/20]

◆ BOOST_AUTO_TEST_CASE() [9/20]

◆ BOOST_AUTO_TEST_CASE() [10/20]

BOOST_AUTO_TEST_CASE ( SetFieldTextAndSetValueFieldTextConsistency )

◆ BOOST_AUTO_TEST_CASE() [11/20]

BOOST_AUTO_TEST_CASE ( SetValueFieldTextPersistsVariantValue )

Test that SetValueFieldText correctly persists variant field values.

This tests the fix for a bug where variant values were not saved because GetVariant returned a copy instead of modifying the instance directly.

Definition at line 590 of file test_sch_symbol.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetField(), SCH_FIELD::GetName(), SCH_FIELD::GetText(), SCH_SYMBOL::GetValue(), SCH_SYMBOL::GetVariant(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), SCH_SYMBOL::SetValueFieldText(), and VALUE.

◆ BOOST_AUTO_TEST_CASE() [12/20]

BOOST_AUTO_TEST_CASE ( TextVariableVARIANT )

◆ BOOST_AUTO_TEST_CASE() [13/20]

BOOST_AUTO_TEST_CASE ( TextVariableVARIANT_DESC )

Test ${VARIANT_DESC} text variable resolution.

Definition at line 276 of file test_sch_symbol.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), KI_TEST::GetEeschemaTestDataDir(), FILEEXT::KiCadSchematicFileExtension, and LoadSchematic().

◆ BOOST_AUTO_TEST_CASE() [14/20]

BOOST_AUTO_TEST_CASE ( VariantDeletionCascade )

◆ BOOST_AUTO_TEST_CASE() [15/20]

BOOST_AUTO_TEST_CASE ( VariantDescription )

◆ BOOST_AUTO_TEST_CASE() [16/20]

◆ BOOST_AUTO_TEST_CASE() [17/20]

BOOST_AUTO_TEST_CASE ( VariantFieldDifferenceDetection )

◆ BOOST_AUTO_TEST_CASE() [18/20]

BOOST_AUTO_TEST_CASE ( VariantFieldUnicodeAndSpecialChars )

◆ BOOST_AUTO_TEST_CASE() [19/20]

BOOST_AUTO_TEST_CASE ( VariantNameHandling )

Test variant name handling in eeschema.

Note: Unlike PCB, eeschema variant lookups are currently case-sensitive.

Definition at line 691 of file test_sch_symbol.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), SCH_SYMBOL::GetDNP(), KI_TEST::GetEeschemaTestDataDir(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), and SCH_SYMBOL::SetDNP().

◆ BOOST_AUTO_TEST_CASE() [20/20]

BOOST_AUTO_TEST_CASE ( VariantSpecificFieldDereferencing )