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
20
#include <
qa_utils/wx_utils/unit_test_utils.h
>
21
#include <
widgets/mathplot.h
>
22
23
BOOST_AUTO_TEST_SUITE
( MathplotLayers )
24
25
26
BOOST_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
48
BOOST_AUTO_TEST_SUITE_END
()
mpInfoLegend
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
mpLayer::SetFont
void SetFont(const wxFont &font)
Set layer font.
Definition
mathplot.h:304
mpLayer::GetFont
const wxFont & GetFont() const
Get font set for this layer.
Definition
mathplot.h:259
mpLayer::GetPlotFont
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
mpScaleX
Definition
mathplot.h:820
mpScaleY
Plot layer implementing a y-scale ruler.
Definition
mathplot.h:873
mathplot.h
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
Definition
test_api_enums.cpp:79
BOOST_AUTO_TEST_SUITE
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL
BOOST_CHECK_EQUAL(result, "25.4")
unit_test_utils.h
src
qa
tests
eeschema
test_mathplot_layers.cpp
Generated on Thu Sep 17 2026 00:06:26 for KiCad PCB EDA Suite by
1.13.2