KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_issue25583_equidistant_pins.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
25
27#include <eeschema_test_utils.h>
28
29#include <eeschema_helpers.h>
30#include <locale_io.h>
31#include <sch_pin.h>
32#include <sch_screen.h>
33#include <sch_symbol.h>
34#include <schematic.h>
35
36#include <set>
37
38
39BOOST_AUTO_TEST_CASE( Issue25583EquidistantPinsStayDistinct )
40{
42
43 wxString schPath = wxString::FromUTF8( KI_TEST::GetEeschemaTestDataDir() )
44 + wxS( "issue25583/issue25583.kicad_sch" );
45
46 std::unique_ptr<SCHEMATIC> sch( EESCHEMA_HELPERS::LoadSchematic( schPath, true, true ) );
47 BOOST_REQUIRE( sch != nullptr );
48
49 std::set<VECTOR2I, std::less<>> positions;
50
51 for( SCH_ITEM* item : sch->RootScreen()->Items().OfType( SCH_SYMBOL_T ) )
52 {
53 for( SCH_PIN* pin : static_cast<SCH_SYMBOL*>( item )->GetPinsByNumber( wxS( "1" ) ) )
54 positions.insert( pin->GetPosition() );
55 }
56
57 BOOST_CHECK_EQUAL( positions.size(), 2 );
58}
static SCHEMATIC * LoadSchematic(const wxString &aFileName, bool aSetActive, bool aForceDefaultProject, PROJECT *aProject=nullptr, bool aCalculateConnectivity=true, REPORTER *aRootReporter=nullptr)
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:170
Schematic symbol object.
Definition sch_symbol.h:75
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(Issue25583EquidistantPinsStayDistinct)
R1 pin 1 (38.1, 50.8) and R2 pin 1 (50.8, 38.1) are unconnected but equidistant from the origin.
KIBIS_PIN * pin
BOOST_CHECK_EQUAL(result, "25.4")
@ SCH_SYMBOL_T
Definition typeinfo.h:168