|
KiCad PCB EDA Suite
|
#include <qa_utils/wx_utils/unit_test_utils.h>#include <schematic_utils/schematic_file_util.h>#include <schematic.h>#include <sch_sheet.h>#include <sch_sheet_path.h>#include <sch_sheet_pin.h>#include <sch_screen.h>#include <sch_label.h>#include <settings/settings_manager.h>#include <locale_io.h>Go to the source code of this file.
Classes | |
| struct | ISSUE_24044_FIXTURE |
Functions | |
| BOOST_FIXTURE_TEST_CASE (Issue24044ExpressionNetNames, ISSUE_24044_FIXTURE) | |
| Test for issue #24044: Inconsistent internal evaluation of net names when using expressions. | |
| BOOST_FIXTURE_TEST_CASE (Issue24044PathFormEquivalence, ISSUE_24044_FIXTURE) | |
| Companion regression test that pins the contract SCH_LABEL_BASE::ResolveTextVar relies on. | |
| BOOST_FIXTURE_TEST_CASE | ( | Issue24044ExpressionNetNames | , |
| ISSUE_24044_FIXTURE | ) |
Test for issue #24044: Inconsistent internal evaluation of net names when using expressions.
When a hierarchical sheet pin uses an expression that depends on the sheet instance (e.g. "@{(${#}-2)*2+1}" where ${#} is the page number), the net name resolved for the sheet pin on the parent sheet must match the name resolved for the matching hierarchical label inside the child sheet.
Schematic structure: Root sheet (page 1) with connector J1
Expected resolved names (pin on parent must equal label inside child): Instance "Channels 0-1" (page 2): Ch0, Ch1 Instance "Channels 2-3" (page 3): Ch2, Ch3
The bug caused the parent-side sheet pin to resolve with a doubly-nested path that yielded an empty page number, producing bogus names (e.g. Ch-4/Ch-3) and breaking connectivity across the hierarchy.
Definition at line 68 of file test_issue24044_expression_net_names.cpp.
References actual, BOOST_CHECK_EQUAL(), BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), dummy, expected, SCH_SHEET::GetPins(), SCH_SHEET::GetScreen(), SCH_LABEL_BASE::GetShownText(), SCH_SCREEN::Items(), KI_TEST::LoadSchematic(), path, pin, and SCH_HIER_LABEL_T.
| BOOST_FIXTURE_TEST_CASE | ( | Issue24044PathFormEquivalence | , |
| ISSUE_24044_FIXTURE | ) |
Companion regression test that pins the contract SCH_LABEL_BASE::ResolveTextVar relies on.
Callers use one of two path forms when resolving a sheet pin's text:
Both forms must resolve to the same text for the same sheet instance. The bug fixed by issue #24044 broke form (1) by unconditionally pushing the owner sheet again, yielding a doubly-nested path whose page-number lookup failed.
Definition at line 198 of file test_issue24044_expression_net_names.cpp.
References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), dummy, SCH_SHEET::GetPins(), KI_TEST::LoadSchematic(), path, pin, SCH_SHEET_PATH::pop_back(), and SCH_SHEET_PATH::size().