|
KiCad PCB EDA Suite
|
Test suite for SCH_SYMBOL object. More...
#include <qa_utils/wx_utils/unit_test_utils.h>#include "eeschema_test_utils.h"#include <sch_symbol.h>#include <sch_edit_frame.h>#include <wildcards_and_files_ext.h>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. | |
Test suite for SCH_SYMBOL object.
Definition in file test_sch_symbol.cpp.
| BOOST_AUTO_TEST_CASE | ( | CopyVariantCreatesIndependentCopy | ) |
Test CopyVariant creates an independent copy.
Definition at line 370 of file test_sch_symbol.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), SCH_SYMBOL::GetDNP(), KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetExcludedFromBoard(), SCH_SYMBOL::GetExcludedFromBOM(), SCH_SYMBOL::GetExcludedFromPosFiles(), SCH_SYMBOL::GetField(), SCH_FIELD::GetShownText(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), SCH_SYMBOL::SetDNP(), SCH_SYMBOL::SetExcludedFromBoard(), SCH_SYMBOL::SetExcludedFromBOM(), SCH_SYMBOL::SetExcludedFromPosFiles(), SCH_FIELD::SetText(), and VALUE.
| 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 | ( | 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 | ( | 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 | ( | 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 | ( | 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 | ( | 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 | ( | RenameVariantPreservesData | ) |
Test RenameVariant preserves data.
Definition at line 313 of file test_sch_symbol.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), SCH_SYMBOL::GetDNP(), KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetField(), SCH_FIELD::GetShownText(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), SCH_SYMBOL::SetDNP(), SCH_FIELD::SetText(), and VALUE.
| BOOST_AUTO_TEST_CASE | ( | SchSymbolVariantTest | ) |
Test symbol variant handling.
Definition at line 102 of file test_sch_symbol.cpp.
References SCH_SYMBOL::GetDNP(), KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetExcludedFromBoard(), SCH_SYMBOL::GetExcludedFromBOM(), SCH_SYMBOL::GetExcludedFromPosFiles(), SCH_SYMBOL::GetExcludedFromSim(), SCH_SYMBOL::GetField(), SCH_FIELD::GetShownText(), SCH_SYMBOL::GetVariant(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), SCH_SYMBOL::SetDNP(), SCH_SYMBOL::SetExcludedFromBoard(), SCH_SYMBOL::SetExcludedFromBOM(), SCH_SYMBOL::SetExcludedFromPosFiles(), SCH_SYMBOL::SetExcludedFromSim(), SCH_FIELD::SetText(), and VALUE.
| BOOST_AUTO_TEST_CASE | ( | SetFieldTextAndSetValueFieldTextConsistency | ) |
Test that SetFieldText works consistently with SetValueFieldText for the VALUE field.
Definition at line 635 of file test_sch_symbol.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetField(), SCH_SYMBOL::GetFieldText(), SCH_FIELD::GetName(), SCH_SYMBOL::GetValue(), SCH_SYMBOL::GetVariant(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), SCH_SYMBOL::SetFieldText(), SCH_SYMBOL::SetValueFieldText(), and VALUE.
| 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 | ( | TextVariableVARIANT | ) |
Test ${VARIANT} text variable resolution.
Definition at line 235 of file test_sch_symbol.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), KI_TEST::GetEeschemaTestDataDir(), FILEEXT::KiCadSchematicFileExtension, and LoadSchematic().
| 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 | ( | VariantDeletionCascade | ) |
Test variant deletion clears symbol variant data.
Definition at line 731 of file test_sch_symbol.cpp.
References BOOST_REQUIRE(), SCH_SYMBOL::GetDNP(), KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetField(), SCH_SYMBOL::GetVariant(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), SCH_SYMBOL::SetDNP(), SCH_FIELD::SetText(), and VALUE.
| BOOST_AUTO_TEST_CASE | ( | VariantDescription | ) |
Test variant description methods.
Definition at line 201 of file test_sch_symbol.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), KI_TEST::GetEeschemaTestDataDir(), FILEEXT::KiCadSchematicFileExtension, and LoadSchematic().
| BOOST_AUTO_TEST_CASE | ( | VariantDNPFiltering | ) |
Test variant DNP filtering for BOM.
Definition at line 484 of file test_sch_symbol.cpp.
References BOOST_REQUIRE(), SCH_SYMBOL::GetDNP(), KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetExcludedFromBoard(), SCH_SYMBOL::GetExcludedFromBOM(), SCH_SYMBOL::GetExcludedFromPosFiles(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), SCH_SYMBOL::SetDNP(), SCH_SYMBOL::SetExcludedFromBoard(), SCH_SYMBOL::SetExcludedFromBOM(), and SCH_SYMBOL::SetExcludedFromPosFiles().
| BOOST_AUTO_TEST_CASE | ( | VariantFieldDifferenceDetection | ) |
Test variant field value difference detection.
Definition at line 436 of file test_sch_symbol.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetField(), SCH_FIELD::GetShownText(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), SCH_FIELD::SetText(), and VALUE.
| BOOST_AUTO_TEST_CASE | ( | VariantFieldUnicodeAndSpecialChars | ) |
Test variant field values with unicode and special characters.
Definition at line 771 of file test_sch_symbol.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetField(), SCH_FIELD::GetShownText(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), SCH_FIELD::SetText(), and VALUE.
| 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 | ( | VariantSpecificFieldDereferencing | ) |
Test variant-specific field dereferencing via ${REF:FIELD:VARIANT} syntax.
Definition at line 820 of file test_sch_symbol.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetField(), SCH_SYMBOL::GetRef(), SCH_FIELD::GetShownText(), FILEEXT::KiCadSchematicFileExtension, LoadSchematic(), SCH_SYMBOL::ResolveTextVar(), SCH_FIELD::SetText(), and VALUE.