KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_mathplot_layers.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
21#include <widgets/mathplot.h>
22
23BOOST_AUTO_TEST_SUITE( MathplotLayers )
24
25
26BOOST_AUTO_TEST_CASE( ConstructWithoutToolkit )
27{
28 // A layer that took a stock font in its constructor would abort this console-mode binary
29 // outright, so the checks below can only be reached, let alone pass, if none of them do
30 mpInfoLegend legend;
31 mpScaleX scaleX( wxS( "freq" ) );
32 mpScaleY scaleY( wxS( "gain" ) );
33
34 BOOST_CHECK( !legend.GetFont().IsOk() );
35 BOOST_CHECK( !scaleX.GetFont().IsOk() );
36 BOOST_CHECK( !scaleY.GetFont().IsOk() );
37
38 // GetPlotFont() only reaches the toolkit for the default, so an explicitly set font
39 // resolves without one
40 wxFont font( wxFontInfo( 11 ).Family( wxFONTFAMILY_SWISS ) );
41
42 scaleX.SetFont( font );
43 BOOST_CHECK( scaleX.GetFont().IsOk() );
44 BOOST_CHECK_EQUAL( scaleX.GetPlotFont().GetPointSize(), 11 );
45}
46
47
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
Definition mathplot.h:421
void SetFont(const wxFont &font)
Set layer font.
Definition mathplot.h:304
const wxFont & GetFont() const
Get font set for this layer.
Definition mathplot.h:259
const wxFont & GetPlotFont() const
Get the font to draw this layer with, which is the default one when none was set.
Definition mathplot.h:269
Plot layer implementing a y-scale ruler.
Definition mathplot.h:873
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")