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 )
83 KIID symKIID( aKIID );
98 for(
size_t i = 0; i < allRefs.
GetCount(); ++i )
101 additionalRefs.
AddItem( allRefs[i] );
104 return additionalRefs;
115 BOOST_CHECK_EQUAL( symbol->
GetRef( &symbolPath,
true ), ref.m_ExpectedRef );
137 {
"CASE 1. Rename only selected. All units selected",
138 "test_multiunit_reannotate",
141 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U3A",
true },
142 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
143 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U3C",
true },
145 {
"CASE 1. Rename only selected. Only unit B selected (A and C should NOT be reannotated)",
146 "test_multiunit_reannotate",
149 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U99A",
false },
150 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U2B",
true },
151 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U99C",
false },
153 {
"CASE 1. Rename only selected. Only units B and C selected (A should NOT be reannotated)",
154 "test_multiunit_reannotate",
157 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U99A",
false },
158 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
159 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U3C",
true },
161 {
"CASE 2. Rename only selected. All units selected",
162 "test_multiunit_reannotate_2",
165 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U3A",
true },
166 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
167 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U3C",
true },
169 {
"CASE 2. Rename only selected. Only unit B selected (A and C should NOT be reannotated)",
170 "test_multiunit_reannotate_2",
173 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U99A",
false },
174 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
175 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U99C",
false },
177 {
"CASE 2. Rename only selected. Only units B and C selected (A should NOT be reannotated)",
178 "test_multiunit_reannotate_2",
181 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U99A",
false },
182 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
183 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U3C",
true },
185 {
"CASE 3. Rename only selected. All units selected",
186 "test_multiunit_reannotate_3",
189 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U3A",
true },
190 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
191 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U3C",
true },
193 {
"CASE 3. Rename only selected. Only unit B selected (A and C should NOT be reannotated)",
194 "test_multiunit_reannotate_3",
197 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U99A",
false },
198 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
199 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U99C",
false },
201 {
"CASE 3. Rename only selected. Only units B and C selected (A should NOT be reannotated)",
202 "test_multiunit_reannotate_3",
205 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U99A",
"U99A",
false },
206 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U99B",
"U3B",
true },
207 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U99C",
"U3C",
true },
209 {
"CASE 4 - Not previously annotated (does not get added to multi-unit locked group)",
210 "test_multiunit_reannotate_4",
213 {
"549455c3-ab6e-454e-94b0-5ca9e521ae0b",
"U?B",
"U2B",
true },
215 {
"CASE 5 - Duplicate annotation. 1 selected",
216 "test_multiunit_reannotate_5",
219 {
"d43a1d25-d37a-467a-8b09-10cf2e2ace09",
"U2A",
"U2A",
false },
220 {
"cd562bae-2426-44e6-8196-59eee5439809",
"U2B",
"U2B",
false },
221 {
"3f20a749-efe3-4804-8fef-435caaa8dacb",
"U2C",
"U2C",
false },
222 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U2A",
"U2A",
false },
223 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U2B",
"U11B",
true },
224 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U2C",
"U2C",
false },
226 {
"CASE 5 - Duplicate annotation. 2 selected",
227 "test_multiunit_reannotate_5",
230 {
"d43a1d25-d37a-467a-8b09-10cf2e2ace09",
"U2A",
"U2A",
false },
231 {
"cd562bae-2426-44e6-8196-59eee5439809",
"U2B",
"U11B",
true },
232 {
"3f20a749-efe3-4804-8fef-435caaa8dacb",
"U2C",
"U2C",
false },
233 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U2A",
"U2A",
false },
234 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U2B",
"U12B",
true },
235 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U2C",
"U2C",
false },
245 BOOST_TEST_INFO_SCOPE( c.m_caseName );
247 loadTestCase( c.m_SchematicRelativePath, c.m_ExpectedReannotations );
249 m_refsToReannotate.RemoveAnnotation();
250 m_refsToReannotate.SplitReferences();
251 m_refsToReannotate.Annotate(
false, 0, c.m_StartNumber, m_lockedRefs, getAdditionalRefs() );
252 m_refsToReannotate.UpdateAnnotation();
254 checkAnnotation( c.m_ExpectedReannotations );
268 {
"Reannotate Duplicates. Simple case",
269 "test_multiunit_reannotate_5",
271 {
"d43a1d25-d37a-467a-8b09-10cf2e2ace09",
"U2A",
"U2A",
false },
272 {
"cd562bae-2426-44e6-8196-59eee5439809",
"U2B",
"U2B",
false },
273 {
"3f20a749-efe3-4804-8fef-435caaa8dacb",
"U2C",
"U2C",
false },
274 {
"cf058f25-2bad-4c49-a0c4-f059825c427f",
"U2A",
"U3A",
true },
275 {
"e6c8127f-e282-4128-8744-05f7893bc3ec",
"U2B",
"U3B",
true },
276 {
"db066797-b21c-4c1c-9591-8c7c549f8087",
"U2C",
"U3C",
true },
285 BOOST_TEST_INFO_SCOPE( c.m_caseName );
287 loadTestCase( c.m_SchematicRelativePath, c.m_ExpectedReannotations );
289 m_refsToReannotate.ReannotateDuplicates( getAdditionalRefs() );
290 m_refsToReannotate.UpdateAnnotation();
292 checkAnnotation( c.m_ExpectedReannotations );
A generic fixture for loading schematics and associated settings for qa tests.
virtual void LoadSchematic(const wxString &aRelativePath)
SCH_ITEM * GetItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr) const
SCH_SHEET_LIST BuildSheetListSortedByPageNumbers() const override
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)
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 override
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
BOOST_AUTO_TEST_SUITE_END()
static const std::vector< REANNOTATION_CASE > reannotationCases
BOOST_AUTO_TEST_CASE(Reannotate)
static const std::vector< DUPLICATE_REANNOTATION_CASE > reannotateDuplicatesCases