KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_issue25508_intersheet_refs_recursion.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.TXT for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
22
23#include <locale_io.h>
24#include <sch_label.h>
25#include <sch_screen.h>
26#include <sch_sheet_path.h>
27#include <schematic.h>
28#include <schematic_settings.h>
30
31
33{
35 std::unique_ptr<SCHEMATIC> m_schematic;
36};
37
38
39// A global label embedding ${INTERSHEET_REFS} in its own text resolves through itself; the
40// expansion has no fixed point, so all it can do is stop on the unknown-page placeholder
42{
44
45 KI_TEST::LoadSchematic( m_settingsManager, "issue25508/issue25508", m_schematic );
46
47 SCH_SHEET_PATH sheet = m_schematic->BuildSheetListSortedByPageNumbers().at( 0 );
48 SCH_GLOBALLABEL* label = nullptr;
49
50 for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_GLOBAL_LABEL_T ) )
51 label = static_cast<SCH_GLOBALLABEL*>( item );
52
53 BOOST_REQUIRE( label );
54
55 SCHEMATIC_SETTINGS& settings = m_schematic->Settings();
56 wxString expected = wxString::Format( wxS( "foo (%s?%s)" ),
58 settings.m_IntersheetRefsSuffix );
59
60 BOOST_CHECK_EQUAL( label->GetShownText( &sheet, INTERNAL ), expected );
61}
EE_TYPE OfType(KICAD_T aType) const
Definition sch_rtree.h:248
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition locale_io.h:37
These are loaded from Eeschema settings but then overwritten by the project settings.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:165
wxString GetShownText(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, int aDepth=0) const override
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Definition sch_screen.h:118
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SCREEN * LastScreen()
SCH_SHEET * at(size_t aIndex) const
Forwarded method from std::vector.
@ INTERNAL
Definition common.h:92
void LoadSchematic(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< SCHEMATIC > &aSchematic)
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
std::vector< FAB_LAYER_COLOR > dummy
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_FIXTURE_TEST_CASE(Issue25508, ISSUE_25508_FIXTURE)
VECTOR3I expected(15, 30, 45)
BOOST_CHECK_EQUAL(result, "25.4")
@ SCH_GLOBAL_LABEL_T
Definition typeinfo.h:164