KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_sch_netclass.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 (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
5
*
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License as published by the
8
* Free Software Foundation, either version 3 of the License, or (at your
9
* option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License along
17
* with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#include <
qa_utils/wx_utils/unit_test_utils.h
>
21
#include "
eeschema_test_utils.h
"
22
23
#include <
sch_sheet_path.h
>
24
#include <
sch_label.h
>
25
26
class
TEST_SCH_NETCLASS_FIXTURE
:
public
KI_TEST::SCHEMATIC_TEST_FIXTURE
27
{};
28
29
BOOST_FIXTURE_TEST_SUITE( SchNetclass,
TEST_SCH_NETCLASS_FIXTURE
)
30
31
32
BOOST_AUTO_TEST_CASE
( TestSubsheetNetclass )
33
{
34
LoadSchematic
(
"issue14494"
);
35
36
SCH_SHEET_LIST
sheets = m_schematic.GetSheets();
37
SCH_SHEET_PATH
path
= sheets.at( 1 );
38
SCH_SCREEN
*screen =
path
.GetSheet( 1 )->GetScreen();
39
40
for
(
SCH_ITEM
* item : screen->
Items
().
OfType
(
SCH_HIER_LABEL_T
) )
41
{
42
SCH_HIERLABEL
* label =
static_cast<
SCH_HIERLABEL
*
>
( item );
43
44
wxString
name
= label->
GetText
();
45
46
if
(
name
== wxT(
"B"
) ||
name
== wxT(
"D"
) )
47
BOOST_CHECK_EQUAL( label->
GetEffectiveNetClass
( &
path
)->GetName(), wxT(
"net_02"
) );
48
else
49
BOOST_CHECK_EQUAL( label->
GetEffectiveNetClass
( &
path
)->GetName(), wxT(
"net_01"
) );
50
}
51
}
52
53
BOOST_AUTO_TEST_SUITE_END()
name
const char * name
Definition:
DXF_plotter.cpp:57
BITMAPS::path
@ path
EDA_TEXT::GetText
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition:
eda_text.h:95
EE_RTREE::OfType
EE_TYPE OfType(KICAD_T aType) const
Definition:
sch_rtree.h:238
KI_TEST::SCHEMATIC_TEST_FIXTURE
A generic fixture for loading schematics and associated settings for qa tests.
Definition:
eeschema_test_utils.h:51
SCH_HIERLABEL
Definition:
sch_label.h:493
SCH_ITEM
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition:
sch_item.h:150
SCH_ITEM::GetEffectiveNetClass
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition:
sch_item.cpp:176
SCH_SCREEN
Definition:
sch_screen.h:92
SCH_SCREEN::Items
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
Definition:
sch_screen.h:109
SCH_SHEET_LIST
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Definition:
sch_sheet_path.h:461
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:141
TEST_SCH_NETCLASS_FIXTURE
Definition:
test_sch_netclass.cpp:27
eeschema_test_utils.h
LoadSchematic
static void LoadSchematic(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, const wxString &aFileName)
Definition:
sch_easyeda_plugin.cpp:485
sch_label.h
sch_sheet_path.h
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(TestSubsheetNetclass)
Definition:
test_sch_netclass.cpp:32
SCH_HIER_LABEL_T
@ SCH_HIER_LABEL_T
Definition:
typeinfo.h:152
unit_test_utils.h
src
qa
tests
eeschema
test_sch_netclass.cpp
Generated on Tue Sep 26 2023 00:04:39 for KiCad PCB EDA Suite by
1.9.5