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

Test suite for saving and loading schematics with virtual root pattern. More...

#include <boost/test/unit_test.hpp>
#include <eeschema_test_utils.h>
#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr.h>
#include <sch_screen.h>
#include <sch_sheet.h>
#include <sch_symbol.h>
#include <schematic.h>
#include <kiid.h>
#include <sch_file_versions.h>
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <wx/ffile.h>
#include <wx/filename.h>
#include <wx/stdpaths.h>

Go to the source code of this file.

Classes

struct  SAVE_LOAD_FIXTURE
 

Functions

 BOOST_AUTO_TEST_CASE (TestSaveLoadSimpleSchematic)
 Test that we can save and reload a schematic with the virtual root pattern and that symbol instances are preserved correctly.
 
 BOOST_AUTO_TEST_CASE (TestSaveLoadHierarchicalSchematic)
 Test saving/loading a hierarchical schematic.
 
 BOOST_AUTO_TEST_CASE (TestLoadLegacyHierarchicalSchematic)
 Test that symbol instances are properly loaded and preserved from a legacy hierarchical schematic This tests loading a schematic that was converted from the legacy format and has complex hierarchy with the same sub-sheet used multiple times (shared sheet)
 
 BOOST_AUTO_TEST_CASE (TestEmbeddedFilesPersistedInHierarchy)
 Regression: embedded worksheet files were dropped on save for hierarchical schematics because the (embedded_files) block was gated on SCH_SHEET::HasRootInstance().
 
 BOOST_AUTO_TEST_CASE (TestLoadSheetFileWithTextVariable)
 Regression for #24664: text variables in a hierarchical sheet's "Sheet file" field must be resolved when locating the file on disk, while the stored field stays raw.
 

Detailed Description

Test suite for saving and loading schematics with virtual root pattern.

Definition in file test_save_load_schematic.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/5]

BOOST_AUTO_TEST_CASE ( TestEmbeddedFilesPersistedInHierarchy )

Regression: embedded worksheet files were dropped on save for hierarchical schematics because the (embedded_files) block was gated on SCH_SHEET::HasRootInstance().

Embedded files are schematic-level data and must round-trip regardless of which top-level sheet happens to carry the empty-path instance.

Definition at line 404 of file test_save_load_schematic.cpp.

References SCH_SCREEN::Append(), BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), SCH_SHEET::GetScreen(), SCH_IO_KICAD_SEXPR::SaveSchematicFile(), SCH_SCREEN::SetFileName(), SCH_SHEET::SetFileName(), SCH_SHEET::SetName(), and SCH_SHEET::SetScreen().

◆ BOOST_AUTO_TEST_CASE() [2/5]

BOOST_AUTO_TEST_CASE ( TestLoadLegacyHierarchicalSchematic )

Test that symbol instances are properly loaded and preserved from a legacy hierarchical schematic This tests loading a schematic that was converted from the legacy format and has complex hierarchy with the same sub-sheet used multiple times (shared sheet)

Definition at line 251 of file test_save_load_schematic.cpp.

References KIID::AsString(), KIID_PATH::AsString(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), SCH_SHEET_LIST::CheckForMissingSymbolInstances(), KI_TEST::GetEeschemaTestDataDir(), SCH_SYMBOL::GetInstance(), SCH_SHEET::GetName(), FILEEXT::KiCadSchematicFileExtension, SCH_IO_KICAD_SEXPR::LoadSchematicFile(), SCH_SYMBOL_INSTANCE::m_Path, SCH_SYMBOL_INSTANCE::m_Reference, EDA_ITEM::m_Uuid, path, SCH_IO_KICAD_SEXPR::SaveSchematicFile(), and SCH_SYMBOL_T.

◆ BOOST_AUTO_TEST_CASE() [3/5]

BOOST_AUTO_TEST_CASE ( TestLoadSheetFileWithTextVariable )

◆ BOOST_AUTO_TEST_CASE() [4/5]

◆ BOOST_AUTO_TEST_CASE() [5/5]

BOOST_AUTO_TEST_CASE ( TestSaveLoadSimpleSchematic )

Test that we can save and reload a schematic with the virtual root pattern and that symbol instances are preserved correctly.

Definition at line 92 of file test_save_load_schematic.cpp.

References BOOST_AUTO_TEST_CASE(), BOOST_REQUIRE(), SCH_SHEET_PATH::empty(), SCH_SHEET_PATH::Last(), SCH_IO_KICAD_SEXPR::LoadSchematicFile(), EDA_ITEM::m_Uuid, niluuid, SCH_IO_KICAD_SEXPR::SaveSchematicFile(), and SCH_SCREEN::SetFileName().