KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_net_chain_hierarchical_roundtrip.cpp File Reference
#include <boost/test/unit_test.hpp>
#include <connection_graph.h>
#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr.h>
#include <sch_netchain.h>
#include <sch_screen.h>
#include <sch_sheet.h>
#include <schematic.h>
#include <settings/settings_manager.h>
#include <locale_io.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  NETCHAIN_HIER_ROUNDTRIP_FIXTURE
 

Functions

void boost_test_inject_committed_net_chain (CONNECTION_GRAPH &aGraph, std::unique_ptr< SCH_NETCHAIN > aChain)
 
 BOOST_FIXTURE_TEST_CASE (NetChainHierarchicalRoundTripPreservesOverrides, NETCHAIN_HIER_ROUNDTRIP_FIXTURE)
 Regression: net-chain override maps (class, color, terminal refs) are schematic-level state owned by the connection graph.
 

Function Documentation

◆ BOOST_FIXTURE_TEST_CASE()

BOOST_FIXTURE_TEST_CASE ( NetChainHierarchicalRoundTripPreservesOverrides ,
NETCHAIN_HIER_ROUNDTRIP_FIXTURE  )

Regression: net-chain override maps (class, color, terminal refs) are schematic-level state owned by the connection graph.

They are written into the root sheet's file by SaveSchematicFile, but loadFile/LoadContent run for every sheet in the hierarchy. Without gating the setter calls on aSheet == m_rootSheet, every sub-sheet load silently overwrote the override maps with the parser's empty defaults, wiping all chain metadata as soon as a hierarchical schematic was opened.

This test builds a two-sheet hierarchy with a committed chain that carries terminal refs, a netclass override and a color override. It saves the hierarchy through the full IO plugin, reloads it through LoadSchematicFile (which exercises loadHierarchy and therefore loadFile for both the root and the sub-sheet), and verifies the three override maps survived the load.

Definition at line 106 of file test_net_chain_hierarchical_roundtrip.cpp.

References KIGFX::COLOR4D::a, SCH_SCREEN::Append(), KIGFX::COLOR4D::b, BOOST_CHECK_EQUAL(), BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), boost_test_inject_committed_net_chain(), chain, dummy, KIGFX::COLOR4D::g, SCH_SHEET::GetScreen(), SCH_IO_KICAD_SEXPR::LoadSchematicFile(), KIGFX::COLOR4D::r, SCH_IO_KICAD_SEXPR::SaveSchematicFile(), SCH_SCREEN::SetFileName(), SCH_SHEET::SetFileName(), SCH_SHEET::SetName(), and SCH_SHEET::SetScreen().

◆ boost_test_inject_committed_net_chain()

void boost_test_inject_committed_net_chain ( CONNECTION_GRAPH & aGraph,
std::unique_ptr< SCH_NETCHAIN > aChain )

Definition at line 40 of file test_net_chain_save_root_only.cpp.

Referenced by BOOST_FIXTURE_TEST_CASE().