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

Test suite for SYMBOL_LIBRARY_MANAGER object. More...

Go to the source code of this file.

Classes

class  SYMBOL_LIBRARY_MANAGER_TEST_FIXTURE
 

Functions

 BOOST_AUTO_TEST_CASE (SymbolBuffer)
 Test the SYMBOL_BUFFER object.
 
 BOOST_AUTO_TEST_CASE (LibBuffer)
 Test the LIB_BUFFER object.
 
 BOOST_AUTO_TEST_CASE (NewSymbolCreation)
 Test new symbol creation routines.
 
 BOOST_AUTO_TEST_CASE (DeletedSymbolsAreRemovedFromFile)
 Test that LIB_BUFFER correctly deletes symbols from the library file when saved.
 
 BOOST_AUTO_TEST_CASE (SaveLibraryAsToNewFile)
 Test that saving symbols to a new file using buffered mode works when the target file does not yet exist.
 

Detailed Description

Test suite for SYMBOL_LIBRARY_MANAGER object.

Definition in file test_symbol_library_manager.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/5]

BOOST_AUTO_TEST_CASE ( DeletedSymbolsAreRemovedFromFile )

Test that LIB_BUFFER correctly deletes symbols from the library file when saved.

This test verifies the fix for the bug where deleting a derived symbol from the symbol editor tree and saving would result in the symbol reappearing as a non-derived symbol when the library was reloaded. The root cause was that SaveBuffer only saved existing symbols but never called DeleteSymbol on the plugin for symbols in the m_deleted list.

Definition at line 232 of file test_symbol_library_manager.cpp.

References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), LIB_BUFFER::ClearDeletedBuffer(), LIB_BUFFER::CreateBuffer(), LIB_BUFFER::DeleteBuffer(), LIB_BUFFER::GetBuffer(), LIB_BUFFER::GetBuffers(), LIB_BUFFER::GetDeletedBuffers(), LIB_BUFFER::GetSymbol(), LIB_SYMBOL::IsDerived(), SCH_IO_KICAD_SEXPR::PropBuffering, LIB_BUFFER::SaveBuffer(), and LIB_SYMBOL::SetParent().

◆ BOOST_AUTO_TEST_CASE() [2/5]

◆ BOOST_AUTO_TEST_CASE() [3/5]

◆ BOOST_AUTO_TEST_CASE() [4/5]

BOOST_AUTO_TEST_CASE ( SaveLibraryAsToNewFile )

Test that saving symbols to a new file using buffered mode works when the target file does not yet exist.

This exercises the same code path as "Save Library As" in the symbol editor: a fresh SCH_IO plugin instance buffers symbols and then flushes to a new file path. Before the fix, cacheLib() would call Load() on the non-existent target file and throw, resulting in an empty library (header only).

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

Definition at line 370 of file test_symbol_library_manager.cpp.

References BOOST_REQUIRE(), LIB_SYMBOL::IsDerived(), SCH_IO_KICAD_SEXPR::PropBuffering, and LIB_SYMBOL::SetParent().

◆ BOOST_AUTO_TEST_CASE() [5/5]