Browse Source

Do not update value when selecting

We are meant to update only the temparary value not the symbol actual

Fixes https://gitlab.com/kicad/code/kicad/issues/21776
master
Seth Hillbrand 3 weeks ago
parent
commit
629155bbc7
  1. 8
      eeschema/sch_reference_list.cpp
  2. 27
      qa/tests/eeschema/test_sch_reference_list.cpp

8
eeschema/sch_reference_list.cpp

@ -771,10 +771,12 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_SYMBOL* aSymbol, const SCH_SHEET_PATH& aSheetP
m_numRef = -1;
if( aSymbol->GetValue( false, &aSheetPath, false ).IsEmpty() )
aSymbol->SetValueFieldText( wxT( "~" ) );
wxString value = aSymbol->GetValue( false, &aSheetPath, false );
m_value = aSymbol->GetValue( false, &aSheetPath, false );
if( value.IsEmpty() )
value = wxT( "~" );
m_value = value;
}

27
qa/tests/eeschema/test_sch_reference_list.cpp

@ -297,4 +297,31 @@ BOOST_AUTO_TEST_CASE( ReannotateDuplicates )
}
BOOST_AUTO_TEST_CASE( ReferenceListDoesNotMutateEmptyValue )
{
loadTestCase( "test_multiunit_reannotate", {} );
SCH_SHEET_PATH sheetPath = m_schematic->CurrentSheet();
SCH_SYMBOL* symbol = nullptr;
for( SCH_ITEM* item : sheetPath.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
{
symbol = static_cast<SCH_SYMBOL*>( item );
break;
}
BOOST_REQUIRE( symbol != nullptr );
symbol->SetValueFieldText( wxEmptyString );
BOOST_REQUIRE( symbol->GetValue( false, &sheetPath, false ).IsEmpty() );
SCH_REFERENCE_LIST refs;
sheetPath.AppendSymbol( refs, symbol );
BOOST_CHECK( symbol->GetValue( false, &sheetPath, false ).IsEmpty() );
BOOST_REQUIRE_EQUAL( refs.GetCount(), 1 );
BOOST_CHECK_EQUAL( refs[0].GetValue(), wxT( "~" ) );
}
BOOST_AUTO_TEST_SUITE_END()
Loading…
Cancel
Save