|
KiCad PCB EDA Suite
|
Test for issue #22620: Symbols are not automatically annotated when placing design blocks. More...
#include <boost/test/unit_test.hpp>#include <lib_symbol.h>#include <refdes_tracker.h>#include <sch_group.h>#include <sch_reference_list.h>#include <sch_screen.h>#include <sch_sheet_path.h>#include <sch_symbol.h>#include <schematic.h>#include <settings/settings_manager.h>#include <tools/sch_selection.h>#include <qa_utils/wx_utils/unit_test_utils.h>#include <wx/filename.h>#include <wx/stdpaths.h>Go to the source code of this file.
Classes | |
| struct | GROUP_ANNOTATION_FIXTURE |
Functions | |
| std::unordered_set< SCH_SYMBOL * > | getInferredSymbols (const SCH_SELECTION &aSelection) |
| BOOST_AUTO_TEST_CASE (TestGroupRunOnChildrenFindsSymbols) | |
| Test that SCH_GROUP::RunOnChildren correctly finds symbols inside a group. | |
| BOOST_AUTO_TEST_CASE (TestGroupRunOnChildrenWithNestedGroups) | |
| Test that SCH_GROUP::RunOnChildren handles nested groups correctly. | |
| BOOST_AUTO_TEST_CASE (Issue23519_GroupSelectionReannotatesPowerSymbols) | |
| Test for issue #23519: design block power symbols should be reannotated even when normal symbol annotation is skipped. | |
Test for issue #22620: Symbols are not automatically annotated when placing design blocks.
When placing a design block as a group with auto-annotation enabled and "Keep Annotations" disabled, symbols in the group should be automatically annotated. The root cause was that getInferredSymbols() in annotate.cpp did not handle SCH_GROUP_T items, so symbols inside groups were not found and thus not annotated.
This test verifies that SCH_GROUP::RunOnChildren correctly iterates through group members, which is the mechanism used by the fix.
Definition in file test_issue22620_group_annotation.cpp.
| BOOST_AUTO_TEST_CASE | ( | Issue23519_GroupSelectionReannotatesPowerSymbols | ) |
Test for issue #23519: design block power symbols should be reannotated even when normal symbol annotation is skipped.
This simulates design-block placement with either "Keep Annotations" enabled or automatic annotation disabled:
The normal symbol keeps its annotation while the power symbol is silently renumbered to the next available power reference.
Definition at line 219 of file test_issue22620_group_annotation.cpp.
References SELECTION::Add(), SCH_REFERENCE_LIST::AddItem(), SCH_REFERENCE_LIST::Annotate(), SCH_SCREEN::Append(), SCH_SHEET_PATH::AppendSymbol(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), SCH_REFERENCE_LIST::Contains(), SCH_REFERENCE_LIST::GetCount(), getInferredSymbols(), LIB_SYMBOL::GetLibId(), SCH_SYMBOL::GetRef(), SCH_SHEET::GetScreen(), SCH_SHEET_PATH::GetSymbols(), group, SCH_SHEET_PATH::push_back(), SCH_REFERENCE_LIST::RemoveAnnotation(), LIB_SYMBOL::SetGlobalPower(), SCH_SYMBOL::SetRef(), SCH_REFERENCE_LIST::SetRefDesTracker(), SCH_SYMBOL::SetValueFieldText(), SCH_REFERENCE_LIST::SplitReferences(), SYMBOL_FILTER_ALL, SYMBOL_FILTER_POWER, and SCH_REFERENCE_LIST::UpdateAnnotation().
| BOOST_AUTO_TEST_CASE | ( | TestGroupRunOnChildrenFindsSymbols | ) |
Test that SCH_GROUP::RunOnChildren correctly finds symbols inside a group.
This verifies the mechanism used by the fix for issue #22620.
Definition at line 100 of file test_issue22620_group_annotation.cpp.
References SCH_SCREEN::Append(), BOOST_AUTO_TEST_CASE(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), group, RECURSE, SCH_SYMBOL_T, SCH_SYMBOL::SetPosition(), and EDA_ITEM::Type().
| BOOST_AUTO_TEST_CASE | ( | TestGroupRunOnChildrenWithNestedGroups | ) |
Test that SCH_GROUP::RunOnChildren handles nested groups correctly.
Definition at line 149 of file test_issue22620_group_annotation.cpp.
References EDA_GROUP::AddItem(), SCH_SCREEN::Append(), BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), RECURSE, SCH_GROUP::RunOnChildren(), SCH_SYMBOL_T, EDA_GROUP::SetName(), SCH_SYMBOL::SetPosition(), and EDA_ITEM::Type().
| std::unordered_set< SCH_SYMBOL * > getInferredSymbols | ( | const SCH_SELECTION & | aSelection | ) |
Definition at line 183 of file annotate.cpp.
References SCH_FIELD::GetId(), EDA_ITEM::GetParent(), group, RECURSE, REFERENCE, SCH_FIELD_T, SCH_GROUP_T, SCH_SYMBOL_T, and EDA_ITEM::Type().
Referenced by SCH_EDIT_FRAME::AnnotateSymbols(), BOOST_AUTO_TEST_CASE(), and SCH_EDIT_FRAME::CheckAnnotate().