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

Regression test for https://gitlab.com/kicad/code/kicad/-/issues/23743. More...

Go to the source code of this file.

Functions

 BOOST_AUTO_TEST_CASE (PullsValueAndNewFieldFromParent)
 A parent value change and a brand-new parent field both propagate to the derived child.
 
 BOOST_AUTO_TEST_CASE (RespectsSelectedFieldSubset)
 Only the field names in m_updateFields are touched when m_updateAllFields is false.
 
 BOOST_AUTO_TEST_CASE (MandatoryFieldSelectedByCanonicalName)
 A mandatory field is selected by its canonical name.
 
 BOOST_AUTO_TEST_CASE (EmptySelectionUpdatesNothing)
 An empty selection (dialog "Select None") touches nothing, even with reset flags set.
 
 BOOST_AUTO_TEST_CASE (RemoveExtraFieldsOptional)
 A child-only field is dropped only when removeExtraFields is requested.
 
 BOOST_AUTO_TEST_CASE (ResetVisibilityFromParent)
 Visibility flags are reconciled from the parent only when requested.
 
 BOOST_AUTO_TEST_CASE (RootSymbolUnchanged)
 A non-derived symbol is left untouched (the action is meaningless without a parent).
 
 BOOST_AUTO_TEST_CASE (CanUpdateFieldsGate)
 The "Update Symbol Fields" action gate (and its tool handler) both key off CanUpdateFieldsFromParent(); it must be true for a derived symbol and false for a root.
 

Detailed Description

Regression test for https://gitlab.com/kicad/code/kicad/-/issues/23743.

Exercises LIB_SYMBOL::SyncFieldsFromParent, the non-GUI core driven by the symbol editor's "Update Symbol Fields..." action for derived symbols.

Definition in file test_issue23743_sync_derived_fields.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/8]

BOOST_AUTO_TEST_CASE ( CanUpdateFieldsGate )

The "Update Symbol Fields" action gate (and its tool handler) both key off CanUpdateFieldsFromParent(); it must be true for a derived symbol and false for a root.

This is the predicate whose mis-wiring was issue 23743.

Definition at line 233 of file test_issue23743_sync_derived_fields.cpp.

◆ BOOST_AUTO_TEST_CASE() [2/8]

BOOST_AUTO_TEST_CASE ( EmptySelectionUpdatesNothing )

An empty selection (dialog "Select None") touches nothing, even with reset flags set.

Definition at line 132 of file test_issue23743_sync_derived_fields.cpp.

References BOOST_CHECK_EQUAL(), LIB_FIELD_SYNC_OPTIONS::m_resetText, LIB_FIELD_SYNC_OPTIONS::m_updateAllFields, SCH_FIELD::SetText(), and USER.

◆ BOOST_AUTO_TEST_CASE() [3/8]

BOOST_AUTO_TEST_CASE ( MandatoryFieldSelectedByCanonicalName )

A mandatory field is selected by its canonical name.

The dialog populates the listbox with translated mandatory names, so it must feed canonical names into m_updateFields; a non-English UI would otherwise never update mandatory fields (e.g. Value).

Definition at line 111 of file test_issue23743_sync_derived_fields.cpp.

References BOOST_CHECK_EQUAL(), GetCanonicalFieldName(), LIB_FIELD_SYNC_OPTIONS::m_resetText, LIB_FIELD_SYNC_OPTIONS::m_updateAllFields, LIB_FIELD_SYNC_OPTIONS::m_updateFields, and VALUE.

◆ BOOST_AUTO_TEST_CASE() [4/8]

BOOST_AUTO_TEST_CASE ( PullsValueAndNewFieldFromParent )

A parent value change and a brand-new parent field both propagate to the derived child.

Definition at line 44 of file test_issue23743_sync_derived_fields.cpp.

References BOOST_AUTO_TEST_CASE(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), SCH_FIELD::GetText(), LIB_FIELD_SYNC_OPTIONS::m_resetText, SCH_FIELD::SetText(), and USER.

◆ BOOST_AUTO_TEST_CASE() [5/8]

BOOST_AUTO_TEST_CASE ( RemoveExtraFieldsOptional )

A child-only field is dropped only when removeExtraFields is requested.

Definition at line 157 of file test_issue23743_sync_derived_fields.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), LIB_FIELD_SYNC_OPTIONS::m_removeExtraFields, SCH_FIELD::SetText(), and USER.

◆ BOOST_AUTO_TEST_CASE() [6/8]

BOOST_AUTO_TEST_CASE ( ResetVisibilityFromParent )

Visibility flags are reconciled from the parent only when requested.

Definition at line 182 of file test_issue23743_sync_derived_fields.cpp.

References BOOST_REQUIRE(), LIB_FIELD_SYNC_OPTIONS::m_resetText, LIB_FIELD_SYNC_OPTIONS::m_resetVisibility, SCH_FIELD::SetText(), EDA_TEXT::SetVisible(), and USER.

◆ BOOST_AUTO_TEST_CASE() [7/8]

BOOST_AUTO_TEST_CASE ( RespectsSelectedFieldSubset )

Only the field names in m_updateFields are touched when m_updateAllFields is false.

Definition at line 77 of file test_issue23743_sync_derived_fields.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), LIB_FIELD_SYNC_OPTIONS::m_resetText, LIB_FIELD_SYNC_OPTIONS::m_updateAllFields, LIB_FIELD_SYNC_OPTIONS::m_updateFields, SCH_FIELD::SetText(), and USER.

◆ BOOST_AUTO_TEST_CASE() [8/8]

BOOST_AUTO_TEST_CASE ( RootSymbolUnchanged )

A non-derived symbol is left untouched (the action is meaningless without a parent).

Definition at line 213 of file test_issue23743_sync_derived_fields.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), and LIB_FIELD_SYNC_OPTIONS::m_resetText.