KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_issue18346_junction_fixup.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
28
30#include <eeschema_test_utils.h>
31
32#include <deque>
33#include <eeschema_helpers.h>
34#include <locale_io.h>
35#include <sch_screen.h>
36#include <schematic.h>
37
38
39BOOST_AUTO_TEST_CASE( Issue18346JunctionFixupOnLoad )
40{
42
43 wxString schPath = wxString::FromUTF8( KI_TEST::GetEeschemaTestDataDir() ) +
44 wxS( "issue18346.kicad_sch" );
45
46 std::unique_ptr<SCHEMATIC> sch( EESCHEMA_HELPERS::LoadSchematic( schPath, true, true ) );
47 BOOST_REQUIRE( sch != nullptr );
48
49 SCH_SCREENS screens( sch->Root() );
50 int needed = 0;
51
52 for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
53 {
54 std::deque<EDA_ITEM*> allItems;
55
56 for( SCH_ITEM* item : screen->Items() )
57 allItems.push_back( item );
58
59 needed += static_cast<int>( screen->GetNeededJunctions( allItems ).size() );
60 }
61
62 BOOST_CHECK_MESSAGE( needed == 0,
63 "Normal load path left " << needed
64 << " junction(s) missing; FixupJunctionsAfterImport did not run" );
65}
static SCHEMATIC * LoadSchematic(const wxString &aFileName, bool aSetActive, bool aForceDefaultProject, PROJECT *aProject=nullptr, bool aCalculateConnectivity=true)
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition locale_io.h:37
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:162
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition sch_screen.h:746
SCH_SCREEN * GetNext()
SCH_SCREEN * GetFirst()
std::string GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
std::vector< FAB_LAYER_COLOR > dummy
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_CASE(Issue18346JunctionFixupOnLoad)
A native schematic written by an older version can carry an implied junction that was never persisted...
BOOST_CHECK_MESSAGE(totalMismatches==0, std::to_string(totalMismatches)+" board(s) with strategy disagreements")