|
KiCad PCB EDA Suite
|
#include <qa_utils/wx_utils/unit_test_utils.h>#include <symbol_library_manager.h>#include <symbol_editor/symbol_edit_frame.h>#include <symbol_editor/symbol_editor_tab_context.h>#include <symbol_editor/symbol_editor_settings.h>#include <lib_symbol.h>#include <sch_screen.h>#include <undo_redo_container.h>#include <widgets/editor_tabs_panel.h>#include <settings/json_settings_internals.h>#include <nlohmann/json.hpp>Go to the source code of this file.
Classes | |
| class | INSTRUMENTED_LIB_SYMBOL |
| Headless tests for the Symbol Editor tabbed-document plumbing. More... | |
| struct | SYMBOL_EDITOR_TABS_TEST_FIXTURE |
Functions | |
| BOOST_AUTO_TEST_CASE (SymbolTabContextOwnsWorkingCopy) | |
| The context owns a working copy cloned from the buffer, seeds its dirty flag, and round-trips the per-tab unit and body style. | |
| BOOST_AUTO_TEST_CASE (InstanceTabContextIsTransientAndKeyedByUuid) | |
| An instance (schematic) tab owns its transient working symbol/screen, reports IsTransient(), and keys off the source instance UUID in a namespace disjoint from library keys. | |
| BOOST_AUTO_TEST_CASE (SymbolTabContextSeedsDirtyFromBuffer) | |
| Seeding from an already-modified buffer marks the new tab modified. | |
| BOOST_AUTO_TEST_CASE (OpenTabsJsonRoundTrip) | |
| Open-tab persistence round-trips through the settings JSON, including the active-tab key. | |
| BOOST_AUTO_TEST_CASE (FreeTransientUndoCommandsDeletesCopies) | |
| UR_TRANSIENT is flagged on the picked item, not the picker wrapper, so the container deleters that gate on the wrapper flag leaked these copies. | |
| BOOST_AUTO_TEST_CASE (FreeTransientUndoCommandsSparesLiveSymbol) | |
| The free helper must never delete the live working symbol, guarding the active-tab close path against a double-free. | |
| BOOST_AUTO_TEST_CASE (ClearTabModifiedStateSyncsContextAndModel) | |
| Saving a library clears the dirty state on both stores that drive the tab strip: the context's screen flag (read on repaint) and the strip model entry (read on close). | |
| BOOST_AUTO_TEST_CASE (LibTreeAutoHiddenRestoreAcrossSchematicEdit) | |
| The library tree is auto-hidden while editing a symbol from the schematic (issue #23543). | |
| BOOST_AUTO_TEST_CASE | ( | ClearTabModifiedStateSyncsContextAndModel | ) |
Saving a library clears the dirty state on both stores that drive the tab strip: the context's screen flag (read on repaint) and the strip model entry (read on close).
A save that cleared only the screen left the model starred, so the asterisk persisted until the next stray repaint.
Definition at line 280 of file test_symbol_editor_tabs.cpp.
References BOOST_REQUIRE(), SYMBOL_EDIT_FRAME::clearTabModifiedState(), SYMBOL_EDITOR_TAB_CONTEXT::GetScreen(), SYMBOL_EDITOR_TAB_CONTEXT::GetTabKey(), SYMBOL_EDITOR_TAB_CONTEXT::IsModified(), model, and BASE_SCREEN::SetContentModified().
| BOOST_AUTO_TEST_CASE | ( | FreeTransientUndoCommandsDeletesCopies | ) |
UR_TRANSIENT is flagged on the picked item, not the picker wrapper, so the container deleters that gate on the wrapper flag leaked these copies.
freeTransientUndoCommands walks the picked items and deletes exactly those carrying UR_TRANSIENT, which this exercises across the undo and redo lists.
Definition at line 226 of file test_symbol_editor_tabs.cpp.
References BOOST_CHECK_EQUAL(), redo, and undo.
| BOOST_AUTO_TEST_CASE | ( | FreeTransientUndoCommandsSparesLiveSymbol | ) |
The free helper must never delete the live working symbol, guarding the active-tab close path against a double-free.
The live item never carries UR_TRANSIENT, so it survives while a sibling transient command is freed.
Definition at line 252 of file test_symbol_editor_tabs.cpp.
References BOOST_CHECK_EQUAL(), LIBEDIT, PICKED_ITEMS_LIST::PushItem(), and undo.
| BOOST_AUTO_TEST_CASE | ( | InstanceTabContextIsTransientAndKeyedByUuid | ) |
An instance (schematic) tab owns its transient working symbol/screen, reports IsTransient(), and keys off the source instance UUID in a namespace disjoint from library keys.
Definition at line 141 of file test_symbol_editor_tabs.cpp.
References KIID::AsString(), BOOST_CHECK_EQUAL(), SYMBOL_EDITOR_TAB_CONTEXT::GetDisplayName(), SYMBOL_EDITOR_TAB_CONTEXT::GetReference(), SYMBOL_EDITOR_TAB_CONTEXT::GetSchematicSymbolUUID(), SYMBOL_EDITOR_TAB_CONTEXT::GetScreen(), SYMBOL_EDITOR_TAB_CONTEXT::GetSymbol(), SYMBOL_EDITOR_TAB_CONTEXT::GetTabKey(), SYMBOL_EDITOR_TAB_CONTEXT::IsFromSchematic(), SYMBOL_EDITOR_TAB_CONTEXT::IsTransient(), SYMBOL_EDITOR_TAB_CONTEXT::MakeInstanceTabKey(), and SYMBOL_EDITOR_TAB_CONTEXT::MakeTabKey().
| BOOST_AUTO_TEST_CASE | ( | LibTreeAutoHiddenRestoreAcrossSchematicEdit | ) |
The library tree is auto-hidden while editing a symbol from the schematic (issue #23543).
The pending-restore flag must track that auto-hide so SaveSettings reinstates the tree, must survive a chained schematic edit that finds the tree already hidden, and must not resurrect a tree the user deliberately hid (a user toggle clears the flag before it reaches this helper).
Definition at line 305 of file test_symbol_editor_tabs.cpp.
| BOOST_AUTO_TEST_CASE | ( | OpenTabsJsonRoundTrip | ) |
Open-tab persistence round-trips through the settings JSON, including the active-tab key.
Definition at line 182 of file test_symbol_editor_tabs.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), JSON_SETTINGS_INTERNALS::CloneFrom(), JSON_SETTINGS::FormatAsString(), JSON_SETTINGS::Internals(), JSON_SETTINGS::Load(), SYMBOL_EDITOR_SETTINGS::m_ActiveTabKey, SYMBOL_EDITOR_SETTINGS::m_OpenTabs, and JSON_SETTINGS::Store().
| BOOST_AUTO_TEST_CASE | ( | SymbolTabContextOwnsWorkingCopy | ) |
The context owns a working copy cloned from the buffer, seeds its dirty flag, and round-trips the per-tab unit and body style.
Definition at line 104 of file test_symbol_editor_tabs.cpp.
References BOOST_AUTO_TEST_CASE(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), SYMBOL_EDITOR_TAB_CONTEXT::GetBodyStyle(), SYMBOL_EDITOR_TAB_CONTEXT::GetDisplayName(), LIB_SYMBOL::GetName(), SYMBOL_EDITOR_TAB_CONTEXT::GetScreen(), SYMBOL_EDITOR_TAB_CONTEXT::GetSymbol(), SYMBOL_EDITOR_TAB_CONTEXT::GetTabKey(), SYMBOL_EDITOR_TAB_CONTEXT::GetUnit(), SYMBOL_EDITOR_TAB_CONTEXT::IsModified(), SYMBOL_EDITOR_TAB_CONTEXT::SetBodyStyle(), BASE_SCREEN::SetContentModified(), and SYMBOL_EDITOR_TAB_CONTEXT::SetUnit().
| BOOST_AUTO_TEST_CASE | ( | SymbolTabContextSeedsDirtyFromBuffer | ) |
Seeding from an already-modified buffer marks the new tab modified.
Definition at line 171 of file test_symbol_editor_tabs.cpp.
References SYMBOL_EDITOR_TAB_CONTEXT::IsModified().