|
KiCad PCB EDA Suite
|
Test suite for issue #22241: Symbol editor truncates symbol library after parse error. More...
#include <qa_utils/wx_utils/unit_test_utils.h>#include <lib_symbol.h>#include <richio.h>#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr.h>#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr_lib_cache.h>#include <sch_io/sch_io_mgr.h>#include <wx/filename.h>#include <wx/file.h>#include <wx/stdpaths.h>#include <fstream>Go to the source code of this file.
Classes | |
| class | SYMBOL_LIBRARY_PARSE_ERROR_FIXTURE |
Functions | |
| BOOST_AUTO_TEST_CASE (ValidLibraryLoadsCompletely) | |
| Test that a valid library can be created, loaded, and all symbols are present. | |
| BOOST_AUTO_TEST_CASE (ParseErrorSkipsCorruptSymbol) | |
| Test that a library with a parse error loads all valid symbols (skipping only the bad one). | |
| BOOST_AUTO_TEST_CASE (SaveAfterParseErrorIsPrevented) | |
| Test that saving a library after a parse error is prevented. | |
| BOOST_AUTO_TEST_CASE (CacheTracksParseErrorState) | |
| Test that the cache correctly tracks parse error state. | |
Test suite for issue #22241: Symbol editor truncates symbol library after parse error.
When a symbol library has a parse error, only symbols before the error are loaded. If the user then saves the library, symbols after the parse error are permanently lost. This test verifies that the save operation is blocked when a library has parse errors.
Definition in file test_symbol_library_parse_error.cpp.
| BOOST_AUTO_TEST_CASE | ( | CacheTracksParseErrorState | ) |
Test that the cache correctly tracks parse error state.
Definition at line 302 of file test_symbol_library_parse_error.cpp.
References SCH_IO_LIB_CACHE::HasParseError(), SCH_IO_KICAD_SEXPR_LIB_CACHE::Load(), SCH_IO_KICAD_SEXPR_LIB_CACHE::Save(), and SCH_IO_LIB_CACHE::SetModified().
| BOOST_AUTO_TEST_CASE | ( | ParseErrorSkipsCorruptSymbol | ) |
Test that a library with a parse error loads all valid symbols (skipping only the bad one).
This is the fix for issue #22241 - we continue loading after errors instead of stopping.
Definition at line 191 of file test_symbol_library_parse_error.cpp.
References BOOST_CHECK_EQUAL(), SCH_IO_LIB_CACHE::GetSymbolMap(), and SCH_IO_KICAD_SEXPR_LIB_CACHE::Load().
| BOOST_AUTO_TEST_CASE | ( | SaveAfterParseErrorIsPrevented | ) |
Test that saving a library after a parse error is prevented.
This is the core test for issue #22241 - we need to ensure that saving a library with parse errors doesn't silently lose the corrupt symbol.
Definition at line 246 of file test_symbol_library_parse_error.cpp.
References BOOST_CHECK_EQUAL(), SCH_IO_LIB_CACHE::GetSymbolMap(), SCH_IO_LIB_CACHE::HasParseError(), SCH_IO_KICAD_SEXPR_LIB_CACHE::Load(), SCH_IO_KICAD_SEXPR_LIB_CACHE::Save(), and SCH_IO_LIB_CACHE::SetModified().
| BOOST_AUTO_TEST_CASE | ( | ValidLibraryLoadsCompletely | ) |
Test that a valid library can be created, loaded, and all symbols are present.
This is a baseline test to ensure our test infrastructure works correctly.
Definition at line 161 of file test_symbol_library_parse_error.cpp.
References BOOST_AUTO_TEST_CASE(), BOOST_CHECK_EQUAL(), SCH_IO_LIB_CACHE::GetSymbolMap(), and SCH_IO_KICAD_SEXPR_LIB_CACHE::Load().