KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_legacy_power_symbols.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, you may find one at
18 * http://www.gnu.org/licenses/
19 */
20
23
24#include <connection_graph.h>
25#include <schematic.h>
26#include <sch_screen.h>
28#include <locale_io.h>
29
31{
34
36 {
37 for( SCH_ITEM* item : m_schematic->RootScreen()->Items().OfType( SCH_SYMBOL_T ) )
38 {
39 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
40
41 // Fix pre-8.0 legacy power symbols with invisible pins
42 // that have mismatched pin names and value fields
43 if( symbol->GetLibSymbolRef()
44 && symbol->GetLibSymbolRef()->IsGlobalPower()
45 && symbol->GetAllLibPins().size() > 0
46 && symbol->GetAllLibPins()[0]->IsGlobalPower()
47 && !symbol->GetAllLibPins()[0]->IsVisible() )
48 {
50 symbol->GetAllLibPins()[0]->GetName() );
51 }
52 }
53 }
54
56 std::unique_ptr<SCHEMATIC> m_schematic;
57};
58
59
61{
62 KI_TEST::LoadSchematic( m_settingsManager, "netlists/legacy_power/legacy_power", m_schematic );
63
64 CheckSymbols();
65}
66
67
69{
70 KI_TEST::LoadSchematic( m_settingsManager, "netlists/legacy_power/legacy_power", m_schematic );
71
72 CheckSymbols();
73}
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:98
bool IsGlobalPower() const override
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:167
Schematic symbol object.
Definition sch_symbol.h:76
std::vector< SCH_PIN * > GetAllLibPins() const
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition sch_symbol.h:184
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
void LoadSchematic(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< SCHEMATIC > &aSchematic)
@ VALUE
Field Value of part, i.e. "3.3K".
BOOST_FIXTURE_TEST_CASE(LegacyPowerFixup, LEGACY_POWER_SYMBOLS_TEST_FIXTURE)
BOOST_CHECK_EQUAL(result, "25.4")
@ SCH_SYMBOL_T
Definition typeinfo.h:176