40 void loadTestCase( wxString aSchematicRelativePath, std::vector<REANNOTATED_REFERENCE> aRefs );
54 std::vector<REANNOTATED_REFERENCE> aRefs )
68 BOOST_REQUIRE_NE( symbol,
nullptr );
69 BOOST_REQUIRE_EQUAL( symbol->
GetRef( &symbolPath,
true ), ref.m_OriginalRef );
71 if( ref.m_IncludeInReannotationList )
85 KIID symKIID( aKIID );
100 for(
size_t i = 0; i < allRefs.
GetCount(); ++i )
103 additionalRefs.
AddItem( allRefs[i] );
106 return additionalRefs;
117 BOOST_CHECK_EQUAL( symbol->
GetRef( &symbolPath,
true ), ref.m_ExpectedRef );
139 {
"CASE 1. Rename only selected. All units selected",
140 "test_multiunit_reannotate",
143 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U3A",
true },
144 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
145 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U3C",
true },
147 {
"CASE 1. Rename only selected. Only unit B selected (A and C should NOT be reannotated)",
148 "test_multiunit_reannotate",
151 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U99A",
false },
152 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U2B",
true },
153 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U99C",
false },
155 {
"CASE 1. Rename only selected. Only units B and C selected (A should NOT be reannotated)",
156 "test_multiunit_reannotate",
159 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U99A",
false },
160 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
161 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U3C",
true },
163 {
"CASE 2. Rename only selected. All units selected",
164 "test_multiunit_reannotate_2",
167 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U3A",
true },
168 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
169 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U3C",
true },
171 {
"CASE 2. Rename only selected. Only unit B selected (A and C should NOT be reannotated)",
172 "test_multiunit_reannotate_2",
175 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U99A",
false },
176 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
177 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U99C",
false },
179 {
"CASE 2. Rename only selected. Only units B and C selected (A should NOT be reannotated)",
180 "test_multiunit_reannotate_2",
183 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U99A",
false },
184 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
185 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U3C",
true },
187 {
"CASE 3. Rename only selected. All units selected",
188 "test_multiunit_reannotate_3",
191 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U3A",
true },
192 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
193 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U3C",
true },
195 {
"CASE 3. Rename only selected. Only unit B selected (A and C should NOT be reannotated)",
196 "test_multiunit_reannotate_3",
199 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U99A",
false },
200 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
201 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U99C",
false },
203 {
"CASE 3. Rename only selected. Only units B and C selected (A should NOT be reannotated)",
204 "test_multiunit_reannotate_3",
207 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U99A",
false },
208 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
209 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U3C",
true },
211 {
"CASE 4 - Not previously annotated (does not get added to multi-unit locked group)",
212 "test_multiunit_reannotate_4",
215 {
"549455c3-ab6e-454e-94b0-5ca9e521ae0b",
"U?B",
"U2B",
true },
217 {
"CASE 5 - Duplicate annotation. 1 selected",
218 "test_multiunit_reannotate_5",
221 {
"d43a1d25-d37a-467a-8b09-10cf2e2ace09",
"U2A",
"U2A",
false },
222 {
"cd562bae-2426-44e6-8196-59eee5439809",
"U2B",
"U2B",
false },
223 {
"3f20a749-efe3-4804-8fef-435caaa8dacb",
"U2C",
"U2C",
false },
224 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U2A",
"U2A",
false },
225 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U2B",
"U11B",
true },
226 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U2C",
"U2C",
false },
228 {
"CASE 5 - Duplicate annotation. 2 selected",
229 "test_multiunit_reannotate_5",
232 {
"d43a1d25-d37a-467a-8b09-10cf2e2ace09",
"U2A",
"U2A",
false },
233 {
"cd562bae-2426-44e6-8196-59eee5439809",
"U2B",
"U11B",
true },
234 {
"3f20a749-efe3-4804-8fef-435caaa8dacb",
"U2C",
"U2C",
false },
235 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U2A",
"U2A",
false },
236 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U2B",
"U12B",
true },
237 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U2C",
"U2C",
false },
247 BOOST_TEST_INFO_SCOPE( c.m_caseName );
249 loadTestCase( c.m_SchematicRelativePath, c.m_ExpectedReannotations );
251 m_refsToReannotate.RemoveAnnotation();
252 m_refsToReannotate.SplitReferences();
253 m_refsToReannotate.Annotate(
false, 0, c.m_StartNumber, m_lockedRefs, getAdditionalRefs() );
254 m_refsToReannotate.UpdateAnnotation();
256 checkAnnotation( c.m_ExpectedReannotations );
270 {
"Reannotate Duplicates. Simple case",
271 "test_multiunit_reannotate_5",
273 {
"d43a1d25-d37a-467a-8b09-10cf2e2ace09",
"U2A",
"U2A",
false },
274 {
"cd562bae-2426-44e6-8196-59eee5439809",
"U2B",
"U2B",
false },
275 {
"3f20a749-efe3-4804-8fef-435caaa8dacb",
"U2C",
"U2C",
false },
276 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U2A",
"U3A",
true },
277 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U2B",
"U3B",
true },
278 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U2C",
"U3C",
true },
287 BOOST_TEST_INFO_SCOPE( c.m_caseName );
289 loadTestCase( c.m_SchematicRelativePath, c.m_ExpectedReannotations );
291 m_refsToReannotate.ReannotateDuplicates( getAdditionalRefs() );
292 m_refsToReannotate.UpdateAnnotation();
294 checkAnnotation( c.m_ExpectedReannotations );
299BOOST_AUTO_TEST_SUITE_END()
A generic fixture for loading schematics and associated settings for qa tests.
virtual void LoadSchematic(const wxString &aRelativePath)
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Base class for any item which can be embedded within the SCHEMATIC container class,...
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
bool Contains(const SCH_REFERENCE &aItem) const
Return true if aItem exists in this list.
void AddItem(const SCH_REFERENCE &aItem)
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
SCH_ITEM * GetItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr) const
Fetch a SCH_ITEM by ID.
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void AppendMultiUnitSymbol(SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, SCH_SYMBOL *aSymbol, bool aIncludePowerSymbols=true) const
Append a SCH_REFERENCE_LIST object to aRefList based on aSymbol, storing same-reference set of multi-...
void AppendSymbol(SCH_REFERENCE_LIST &aReferences, SCH_SYMBOL *aSymbol, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Append a SCH_REFERENCE object to aReferences based on aSymbol.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
void checkAnnotation(std::vector< REANNOTATED_REFERENCE > aRefs)
SCH_MULTI_UNIT_REFERENCE_MAP m_lockedRefs
void loadTestCase(wxString aSchematicRelativePath, std::vector< REANNOTATED_REFERENCE > aRefs)
SCH_REFERENCE_LIST m_refsToReannotate
SCH_REFERENCE_LIST getAdditionalRefs()
SCH_SYMBOL * getSymbolByKIID(wxString aKIID, SCH_SHEET_PATH *aSymbolPath)
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
std::map< wxString, SCH_REFERENCE_LIST > SCH_MULTI_UNIT_REFERENCE_MAP
Container to map reference designators for multi-unit parts.
wxString m_SchematicRelativePath
std::vector< REANNOTATED_REFERENCE > m_ExpectedReannotations
wxString m_KIID
KIID of the symbol to reannotate.
wxString m_ExpectedRef
Expected Reference Designator (after reannotating)
wxString m_OriginalRef
Original Reference Designator (prior to reannotating)
bool m_IncludeInReannotationList
True if reference is "selected" for reannotation.
std::vector< REANNOTATED_REFERENCE > m_ExpectedReannotations
wxString m_SchematicRelativePath
static const std::vector< REANNOTATION_CASE > reannotationCases
BOOST_AUTO_TEST_CASE(Reannotate)
static const std::vector< DUPLICATE_REANNOTATION_CASE > reannotateDuplicatesCases