|
KiCad PCB EDA Suite
|
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_shape.h>#include <sch_screen.h>#include <sch_sheet.h>#include <sch_symbol.h>#include <schematic.h>#include <kiid.h>#include <geometry/shape_segment.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 (TestSaveLoadHatchedPolygonPreservesClosingEdge) | |
| 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. | |
Test suite for saving and loading schematics with virtual root pattern.
Definition in file test_save_load_schematic.cpp.
| 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 489 of file test_save_load_schematic.cpp.
References SCH_SCREEN::Append(), 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 | ( | 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 336 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 | ( | 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.
Definition at line 554 of file test_save_load_schematic.cpp.
References SCH_SCREEN::Append(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), SCH_SCREEN::GetFileName(), SCH_SHEET::GetFileName(), SCH_SHEET::GetScreen(), SCH_SCREEN::Items(), SCH_IO_KICAD_SEXPR::LoadSchematicFile(), EE_RTREE::OfType(), SCH_IO_KICAD_SEXPR::SaveSchematicFile(), SCH_SHEET_T, SCH_SCREEN::SetFileName(), SCH_SHEET::SetFileName(), SCH_SHEET::SetName(), and SCH_SHEET::SetScreen().
| BOOST_AUTO_TEST_CASE | ( | TestSaveLoadHatchedPolygonPreservesClosingEdge | ) |
Definition at line 248 of file test_save_load_schematic.cpp.
References SEG::A, SCH_SCREEN::Append(), SEG::B, BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), SHAPE_LINE_CHAIN::CLastPoint(), EDA_ITEM::ClearFlags(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), EDA_SHAPE::GetHatchLines(), EDA_SHAPE::GetPolyShape(), SCH_SHEET::GetScreen(), SHAPE_SEGMENT::GetSeg(), EDA_SHAPE::GetShape(), HATCH, IS_MOVING, SHAPE_LINE_CHAIN::IsClosed(), SCH_SCREEN::Items(), SCH_IO_KICAD_SEXPR::LoadSchematicFile(), SCH_SHAPE::MakeEffectiveShapes(), EE_RTREE::OfType(), SHAPE_LINE_CHAIN::PointCount(), POLY, SCH_IO_KICAD_SEXPR::SaveSchematicFile(), SCH_SHAPE_T, schIUScale, SCH_SCREEN::SetFileName(), EDA_ITEM::SetFlags(), EDA_SHAPE::SetHatchingDirty(), SOLID, and SCH_SHAPE::UpdateHatching().
| BOOST_AUTO_TEST_CASE | ( | TestSaveLoadHierarchicalSchematic | ) |
Test saving/loading a hierarchical schematic.
Definition at line 177 of file test_save_load_schematic.cpp.
References SCH_SCREEN::Append(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), SCH_IO_KICAD_SEXPR::LoadSchematicFile(), SCH_IO_KICAD_SEXPR::SaveSchematicFile(), SCH_SCREEN::SetFileName(), SCH_SHEET::SetFileName(), SCH_SHEET::SetName(), and SCH_SHEET::SetScreen().
| 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 94 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().