KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_active_layer_update.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
20// high contrast + colour/alpha display changes used to recache the whole board
21// displayOptionsRequireRecache limits recache to real geometry changes
22
24
25#include <pcb_edit_frame.h>
26#include <pcb_display_options.h>
28
29
30BOOST_AUTO_TEST_SUITE( DisplayOptionsRecache )
31
32
33BOOST_AUTO_TEST_CASE( ColorAndAlphaChangesSkipRecache )
34{
36
37 // same options no recache
38 BOOST_CHECK( !PCB_BASE_FRAME::displayOptionsRequireRecache( base, base ) );
39
40 // high contrast is a colour-lookup flag geometry unchanged
41 PCB_DISPLAY_OPTIONS contrast = base;
43 BOOST_CHECK( !PCB_BASE_FRAME::displayOptionsRequireRecache( base, contrast ) );
44
45 // opacity is a group colour so recolour suffices
46 PCB_DISPLAY_OPTIONS opacity = base;
47 opacity.m_TrackOpacity = 0.5;
48 BOOST_CHECK( !PCB_BASE_FRAME::displayOptionsRequireRecache( base, opacity ) );
49
50 // net colouring re-tints existing groups
51 PCB_DISPLAY_OPTIONS netColor = base;
53 BOOST_CHECK( !PCB_BASE_FRAME::displayOptionsRequireRecache( base, netColor ) );
54}
55
56
57BOOST_AUTO_TEST_CASE( GeometryChangesRequireRecache )
58{
60
61 // filled vs outline zones differ in geometry
62 PCB_DISPLAY_OPTIONS zoneMode = base;
64 BOOST_CHECK( PCB_BASE_FRAME::displayOptionsRequireRecache( base, zoneMode ) );
65
66 // board flip regenerates mirrored geometry
67 PCB_DISPLAY_OPTIONS flip = base;
68 flip.m_FlipBoardView = true;
69 BOOST_CHECK( PCB_BASE_FRAME::displayOptionsRequireRecache( base, flip ) );
70}
71
72
@ HIDDEN
Inactive layers are hidden.
@ ALL
Net/netclass colors are shown on all net copper.
static bool displayOptionsRequireRecache(const PCB_DISPLAY_OPTIONS &aOld, const PCB_DISPLAY_OPTIONS &aNew)
Return true when moving from aOld to aNew changes drawn item geometry and therefore requires the GAL ...
double m_TrackOpacity
Opacity override for all tracks.
bool m_FlipBoardView
true if the board is flipped to show the mirrored view
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
NET_COLOR_MODE m_NetColorMode
How to use color overrides on specific nets and netclasses.
ZONE_DISPLAY_MODE m_ZoneDisplayMode
BOOST_AUTO_TEST_CASE(ColorAndAlphaChangesSkipRecache)
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()