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

Test for issue #22576: Schematic Sheet Appears different if opened from Project Files vs. More...

#include <qa_utils/wx_utils/unit_test_utils.h>
#include <connection_graph.h>
#include <schematic.h>
#include <sch_sheet.h>
#include <sch_screen.h>
#include <sch_symbol.h>
#include <sch_sheet_path.h>
#include <settings/settings_manager.h>
#include <locale_io.h>

Go to the source code of this file.

Classes

struct  ISSUE22576_FIXTURE
 

Functions

 BOOST_FIXTURE_TEST_CASE (Issue22576MissingInstancesFallback, ISSUE22576_FIXTURE)
 Test that CheckForMissingSymbolInstances uses existing instance data as fallback.
 
 BOOST_FIXTURE_TEST_CASE (Issue22576NoInstancesFallback, ISSUE22576_FIXTURE)
 Test that symbols with no existing instances fall back to field text.
 
 BOOST_FIXTURE_TEST_CASE (Issue22576MultipleSymbolsFallback, ISSUE22576_FIXTURE)
 Test that multiple symbols all get proper fallback references.
 

Detailed Description

Test for issue #22576: Schematic Sheet Appears different if opened from Project Files vs.

Schematic Hierarchy.

When a subsheet file is opened directly as a standalone project (e.g., from File Browser or Project Files panel), symbols that only have instance data from the parent hierarchy should still display their references correctly instead of showing unannotated references (e.g., "R?" instead of "R202").

The fix ensures CheckForMissingSymbolInstances uses existing instance data as a fallback when creating instances for a new project context.

Definition in file test_issue22576_subsheet_standalone.cpp.

Function Documentation

◆ BOOST_FIXTURE_TEST_CASE() [1/3]

BOOST_FIXTURE_TEST_CASE ( Issue22576MissingInstancesFallback ,
ISSUE22576_FIXTURE  )

Test that CheckForMissingSymbolInstances uses existing instance data as fallback.

When a schematic file with existing instances is opened in a different project context (simulating opening a subsheet directly from File Browser), symbols that have instance data from other projects should use that data instead of creating unannotated references.

Definition at line 68 of file test_issue22576_subsheet_standalone.cpp.

References SCH_SYMBOL::AddHierarchicalReference(), SCH_SCREEN::Append(), BOOST_TEST_MESSAGE(), SCH_SHEET_PATH::CheckForMissingSymbolInstances(), dummy, SCH_SYMBOL::GetField(), SCH_SYMBOL::GetRef(), SCH_SYMBOL_INSTANCE::m_Path, SCH_SYMBOL_INSTANCE::m_ProjectName, SCH_SYMBOL_INSTANCE::m_Reference, SCH_SYMBOL_INSTANCE::m_Unit, SCH_SHEET_PATH::push_back(), REFERENCE, SCH_SHEET_PATH::Rehash(), SCH_SYMBOL::SetLibId(), SCH_SYMBOL::SetPosition(), SCH_SYMBOL::SetPrefix(), SCH_SHEET::SetScreen(), and SCH_FIELD::SetText().

◆ BOOST_FIXTURE_TEST_CASE() [2/3]

BOOST_FIXTURE_TEST_CASE ( Issue22576MultipleSymbolsFallback ,
ISSUE22576_FIXTURE  )

◆ BOOST_FIXTURE_TEST_CASE() [3/3]

BOOST_FIXTURE_TEST_CASE ( Issue22576NoInstancesFallback ,
ISSUE22576_FIXTURE  )

Test that symbols with no existing instances fall back to field text.

When a symbol has no instance data at all, CheckForMissingSymbolInstances should fall back to using the REFERENCE field text.

Definition at line 134 of file test_issue22576_subsheet_standalone.cpp.

References SCH_SCREEN::Append(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), SCH_SHEET_PATH::CheckForMissingSymbolInstances(), dummy, SCH_SYMBOL::GetField(), SCH_SYMBOL::GetInstances(), SCH_SYMBOL::GetRef(), SCH_SHEET_PATH::push_back(), REFERENCE, SCH_SHEET_PATH::Rehash(), SCH_SYMBOL::SetLibId(), SCH_SYMBOL::SetPosition(), SCH_SYMBOL::SetPrefix(), SCH_SHEET::SetScreen(), and SCH_FIELD::SetText().