KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_net_chain_save_root_only.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_SAVE_ROOT_FIXTURE
 

Functions

void boost_test_inject_committed_net_chain (CONNECTION_GRAPH &aGraph, std::unique_ptr< SCH_NETCHAIN > aChain)
 
 BOOST_FIXTURE_TEST_CASE (NetChainSavedOnlyOnRootSheetFile, NETCHAIN_SAVE_ROOT_FIXTURE)
 Regression: net_chain emission is schematic-level state owned by the connection graph.
 

Function Documentation

◆ BOOST_FIXTURE_TEST_CASE()

BOOST_FIXTURE_TEST_CASE ( NetChainSavedOnlyOnRootSheetFile ,
NETCHAIN_SAVE_ROOT_FIXTURE  )

Regression: net_chain emission is schematic-level state owned by the connection graph.

It must be written exactly once, by the first top-level sheet's file. Prior to the fix, every per-sheet Format() call iterated GetCommittedNetChains() unconditionally, so a multi-sheet save duplicated the (net_chain ...) block into every sub-sheet file and broke round-trip stability.

Definition at line 97 of file test_net_chain_save_root_only.cpp.

References SCH_SCREEN::Append(), BOOST_CHECK_EQUAL(), BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), boost_test_inject_committed_net_chain(), chain, dummy, SCH_SHEET::GetScreen(), 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 )