KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_creepage_groove_order.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 2
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
21#include <array>
22#include <board.h>
23#include <pcb_shape.h>
25
26BOOST_AUTO_TEST_CASE( CreepageCrossingOrderUsesCorrectAxis )
27{
28 BOARD board;
29 std::vector<std::unique_ptr<PCB_SHAPE>> owned;
30 std::vector<BOARD_ITEM*> edges;
31
32 for( int x : { 100, 500, 200, 600 } )
33 {
34 std::unique_ptr<PCB_SHAPE> edge = std::make_unique<PCB_SHAPE>( &board, SHAPE_T::SEGMENT );
35 edge->SetStart( { x, 900 } );
36 edge->SetEnd( { x, 1100 } );
37 edges.push_back( edge.get() );
38 owned.push_back( std::move( edge ) );
39 }
40
41 BOOST_CHECK( SegmentIntersectsBoard( { 0, 1000 }, { 1000, 1000 }, edges, {}, 200 ) );
42 std::reverse( edges.begin(), edges.end() );
43 BOOST_CHECK( SegmentIntersectsBoard( { 0, 1000 }, { 1000, 1000 }, edges, {}, 200 ) );
44 BOOST_CHECK( !SegmentIntersectsBoard( { 0, 1000 }, { 1000, 1000 }, edges, {}, 99 ) );
45}
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:411
bool SegmentIntersectsBoard(const VECTOR2I &aP1, const VECTOR2I &aP2, const std::vector< BOARD_ITEM * > &aBe, const std::vector< const BOARD_ITEM * > &aDontTestAgainst, int aMinGrooveWidth)
@ SEGMENT
Definition eda_shape.h:57
BOOST_AUTO_TEST_CASE(CreepageCrossingOrderUsesCorrectAxis)
BOOST_CHECK(res.column_datatype(0)==SQL_NUMERIC||res.column_datatype(0)==SQL_DECIMAL)