KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_text_attributes.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 (C) 2023 Wayne Stambaugh <[email protected]>
5 * Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
22
24#include <font/font.h>
25
26
27BOOST_AUTO_TEST_SUITE( TextAttributes )
28
29
31{
32 std::hash<TEXT_ATTRIBUTES> hasher;
35
36 BOOST_CHECK_EQUAL( a, b );
37 BOOST_CHECK_EQUAL( hasher( a ), hasher( b ) );
38
40 BOOST_CHECK_GT( a, b );
41 BOOST_CHECK_NE( hasher( a ), hasher( b ) );
42
43 a.m_Font = nullptr;
45 BOOST_CHECK_LT( a, b );
46
47 b.m_Font = nullptr;
49 BOOST_CHECK_GT( a, b );
50
53 BOOST_CHECK_LT( a, b );
54
57 BOOST_CHECK_GT( a, b );
58
61 BOOST_CHECK_LT( a, b );
62
64 a.m_Angle = EDA_ANGLE( 90.0, DEGREES_T );
65 BOOST_CHECK_GT( a, b );
66
67 a.m_Angle = EDA_ANGLE( 0.0, DEGREES_T );
68 b.m_Angle = EDA_ANGLE( 90.0, DEGREES_T );
69 BOOST_CHECK_LT( a, b );
70
71 b.m_Angle = EDA_ANGLE( 0.0, DEGREES_T );
72 a.m_StrokeWidth = 1;
73 BOOST_CHECK_GT( a, b );
74
75 a.m_StrokeWidth = 0;
76 b.m_StrokeWidth = 1;
77 BOOST_CHECK_LT( a, b );
78
79 b.m_StrokeWidth = 0;
80 a.m_Italic = true;
81 BOOST_CHECK_GT( a, b );
82
83 a.m_Italic = false;
84 b.m_Italic = true;
85 BOOST_CHECK_LT( a, b );
86
87 b.m_Italic = false;
88 a.m_Bold = true;
89 BOOST_CHECK_GT( a, b );
90
91 a.m_Bold = false;
92 b.m_Bold = true;
93 BOOST_CHECK_LT( a, b );
94
95 b.m_Bold = false;
96 a.m_Underlined = true;
97 BOOST_CHECK_GT( a, b );
98
99 a.m_Underlined = false;
100 b.m_Underlined = true;
101 BOOST_CHECK_LT( a, b );
102
103 b.m_Underlined = false;
105 BOOST_CHECK_GT( a, b );
106
109 BOOST_CHECK_LT( a, b );
110
112 b.m_Visible = false;
113 BOOST_CHECK_GT( a, b );
114
115 b.m_Visible = true;
116 a.m_Visible = false;
117 BOOST_CHECK_LT( a, b );
118
119 a.m_Visible = true;
120 a.m_Mirrored = true;
121 BOOST_CHECK_GT( a, b );
122
123 a.m_Mirrored = false;
124 b.m_Mirrored = true;
125 BOOST_CHECK_LT( a, b );
126
127 b.m_Mirrored = false;
128 b.m_Multiline = false;
129 BOOST_CHECK_GT( a, b );
130
131 b.m_Multiline = true;
132 a.m_Multiline = false;
133 BOOST_CHECK_LT( a, b );
134
135 a.m_Multiline = true;
136 a.m_Size.x = 1;
137 BOOST_CHECK_GT( a, b );
138
139 a.m_Size.x = 0;
140 b.m_Size.x = 1;
141 BOOST_CHECK_LT( a, b );
142
143 b.m_Size.x = 0;
144 a.m_KeepUpright = true;
145 BOOST_CHECK_GT( a, b );
146
147 a.m_KeepUpright = false;
148 b.m_KeepUpright = true;
149 BOOST_CHECK_LT( a, b );
150
151 b.m_KeepUpright = false;
152}
153
154
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
Definition: font.cpp:146
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
KIGFX::COLOR4D m_Color
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
KIFONT::FONT * m_Font
@ UNSPECIFIED_COLOR
Definition: color4d.h:43
@ RED
Definition: color4d.h:59
@ DEGREES_T
Definition: eda_angle.h:31
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(Compare)
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_CENTER