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
20
#include <
qa_utils/wx_utils/unit_test_utils.h
>
21
#include <
schematic_utils/schematic_file_util.h
>
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
>
29
#include <
settings/settings_manager.h
>
30
31
32
struct
ISSUE_25508_FIXTURE
33
{
34
SETTINGS_MANAGER
m_settingsManager
;
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
41
BOOST_FIXTURE_TEST_CASE
( Issue25508,
ISSUE_25508_FIXTURE
)
42
{
43
LOCALE_IO
dummy
;
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)"
),
57
settings.
m_IntersheetRefsPrefix
,
58
settings.
m_IntersheetRefsSuffix
);
59
60
BOOST_CHECK_EQUAL
( label->
GetShownText
( &sheet,
INTERNAL
),
expected
);
61
}
EE_RTREE::OfType
EE_TYPE OfType(KICAD_T aType) const
Definition
sch_rtree.h:248
LOCALE_IO
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition
locale_io.h:37
SCHEMATIC_SETTINGS
These are loaded from Eeschema settings but then overwritten by the project settings.
Definition
schematic_settings.h:65
SCHEMATIC_SETTINGS::m_IntersheetRefsPrefix
wxString m_IntersheetRefsPrefix
Definition
schematic_settings.h:116
SCHEMATIC_SETTINGS::m_IntersheetRefsSuffix
wxString m_IntersheetRefsSuffix
Definition
schematic_settings.h:117
SCH_GLOBALLABEL
Definition
sch_label.h:529
SCH_ITEM
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition
sch_item.h:165
SCH_LABEL_BASE::GetShownText
wxString GetShownText(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, int aDepth=0) const override
Definition
sch_label.cpp:954
SCH_SCREEN::Items
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Definition
sch_screen.h:118
SCH_SHEET_PATH
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Definition
sch_sheet_path.h:246
SCH_SHEET_PATH::LastScreen
SCH_SCREEN * LastScreen()
Definition
sch_sheet_path.cpp:336
SCH_SHEET_PATH::at
SCH_SHEET * at(size_t aIndex) const
Forwarded method from std::vector.
Definition
sch_sheet_path.h:264
SETTINGS_MANAGER
Definition
settings_manager.h:48
INTERNAL
@ INTERNAL
Definition
common.h:92
locale_io.h
KI_TEST::LoadSchematic
void LoadSchematic(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< SCHEMATIC > &aSchematic)
Definition
schematic_file_util.cpp:117
sch_label.h
sch_screen.h
sch_sheet_path.h
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
schematic.h
schematic_file_util.h
schematic_settings.h
settings_manager.h
dummy
std::vector< FAB_LAYER_COLOR > dummy
Definition
stackup_predefined_prms.cpp:93
ISSUE_25508_FIXTURE
Definition
test_issue25508_intersheet_refs_recursion.cpp:33
ISSUE_25508_FIXTURE::m_schematic
std::unique_ptr< SCHEMATIC > m_schematic
Definition
test_issue25508_intersheet_refs_recursion.cpp:35
ISSUE_25508_FIXTURE::m_settingsManager
SETTINGS_MANAGER m_settingsManager
Definition
test_issue25508_intersheet_refs_recursion.cpp:34
BOOST_REQUIRE
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_FIXTURE_TEST_CASE
BOOST_FIXTURE_TEST_CASE(Issue25508, ISSUE_25508_FIXTURE)
Definition
test_issue25508_intersheet_refs_recursion.cpp:41
expected
VECTOR3I expected(15, 30, 45)
BOOST_CHECK_EQUAL
BOOST_CHECK_EQUAL(result, "25.4")
SCH_GLOBAL_LABEL_T
@ SCH_GLOBAL_LABEL_T
Definition
typeinfo.h:164
unit_test_utils.h
src
qa
tests
eeschema
test_issue25508_intersheet_refs_recursion.cpp
Generated on Thu Sep 17 2026 00:06:26 for KiCad PCB EDA Suite by
1.13.2