76 std::vector<SCH_SHEET_PATH> childPaths;
80 if(
path.size() == 2 )
81 childPaths.push_back(
path );
84 BOOST_REQUIRE_EQUAL( childPaths.size(), 2U );
92 std::set<wxString> labelTexts;
105 for(
const wxString& t : labelTexts )
107 if( !labelList.IsEmpty() )
108 labelList += wxT(
"," );
116 wxString pinText =
pin->GetShownText( &childPath,
INTERNAL );
118 BOOST_CHECK_MESSAGE( !pinText.Contains( wxT(
"@{" ) )
119 && !pinText.Contains( wxT(
"${" ) ),
120 wxString::Format(
"Sheet pin '%s' on path '%s' did not fully "
121 "resolve expression variables",
123 childPath.PathHumanReadable() ) );
125 BOOST_CHECK_MESSAGE( labelTexts.count( pinText ) == 1,
126 wxString::Format(
"Sheet pin '%s' on path '%s' has no matching "
127 "hierarchical label inside the child sheet. "
130 childPath.PathHumanReadable(),
137 std::set<wxString> allPinTexts;
142 allPinTexts.insert(
pin->GetShownText( &childPath,
INTERNAL ) );
154 wxString::Format(
"Ch%ld", ( page - 2 ) * 2 + 0 ),
155 wxString::Format(
"Ch%ld", ( page - 2 ) * 2 + 1 )
158 std::set<wxString>
actual;
165 for(
const wxString& t :
actual )
167 if( !actualList.IsEmpty() )
168 actualList += wxT(
"," );
174 wxString::Format(
"Page %ld expected {Ch%ld, Ch%ld} but got {%s}",
176 ( page - 2 ) * 2 + 0,
177 ( page - 2 ) * 2 + 1,
202 std::vector<SCH_SHEET_PATH> childPaths;
206 if(
path.size() == 2 )
207 childPaths.push_back(
path );
210 BOOST_REQUIRE_EQUAL( childPaths.size(), 2U );
214 SCH_SHEET* childSheet = childPath.Last();
222 BOOST_REQUIRE_EQUAL( parentPath.
size() + 1U, childPath.size() );
226 wxString fromChildPath =
pin->GetShownText( &childPath,
INTERNAL );
227 wxString fromParentPath =
pin->GetShownText( &parentPath,
INTERNAL );
229 BOOST_CHECK_MESSAGE( fromChildPath == fromParentPath,
230 wxString::Format(
"Sheet pin resolution diverged between "
231 "path forms: child='%s' parent='%s'",
243 std::vector<SCH_SHEET_PATH> paths;
245 for(
const auto&
path : m_schematic->Hierarchy() )
247 if(
path.LastScreen()->GetFileName().EndsWith(
"LEDs.kicad_sch" ) )
248 paths.push_back(
path );
251 BOOST_REQUIRE_EQUAL( paths.size(), 2u );
252 BOOST_REQUIRE( paths[0].LastScreen() == paths[1].LastScreen() );
253 BOOST_REQUIRE( paths[0].GetPageNumber() != paths[1].GetPageNumber() );
254 std::ranges::sort( paths, [](
const auto& first,
const auto& second )
256 return first.GetVirtualPageNumber() < second.GetVirtualPageNumber();
260 auto* label =
static_cast<SCH_GLOBALLABEL*
>( ( *sources.begin() )->Duplicate(
false ) );
261 paths[0].LastScreen()->Append( label );
262 auto& settings = m_schematic->Settings();
263 settings.m_IntersheetRefsShow =
false;
264 settings.m_IntersheetRefsFormatShort =
false;
265 settings.m_IntersheetRefsPrefix.clear();
266 settings.m_IntersheetRefsSuffix.clear();
268 for(
bool perPage : {
false,
true } )
270 label->SetText( perPage ? wxString(
"R21_${#}" ) : wxString(
"R21_SHARED" ) );
271 m_schematic->RecomputeIntersheetRefs();
273 for(
bool ownPage : {
false,
true } )
275 settings.m_IntersheetRefsListOwnPage = ownPage;
277 for(
const auto& displayed : paths )
279 m_schematic->SetCurrentSheet( displayed );
281 for(
const auto& requested : paths )
284 <<
" requested=" << requested.GetPageNumber()
285 <<
" displayed=" << displayed.GetPageNumber() )
287 const wxString
name = perPage ?
"R21_" + requested.GetPageNumber()
288 : wxString(
"R21_SHARED" );
289 BOOST_REQUIRE_EQUAL( label->GetShownText( &requested,
FOR_GUI ),
name );
291 wxString expectedText;
293 for(
const auto& other : paths )
295 if( ( perPage && other.Path() != requested.Path() )
296 || ( !ownPage && other.Path() == requested.Path() ) )
299 expected.push_back( other.GetPageNumber() );
301 if( !expectedText.IsEmpty() )
304 expectedText += other.GetPageNumber();
307 std::vector<std::pair<wxString, wxString>> references;
308 label->GetIntersheetRefs( &requested, &references );
309 std::vector<wxString>
actual;
311 for(
const auto& [page, sheet] : references )
315 wxString token =
"INTERSHEET_REFS";
316 BOOST_REQUIRE( label->ResolveTextVar( &requested, &token, 0 ) );
BOOST_CHECK_EQUAL(result, "25.4")