KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_eda_text.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
21#include <boost/test/unit_test.hpp>
22#include <base_units.h>
23#include <eda_text.h>
24
25
26BOOST_AUTO_TEST_SUITE( EdaText )
27
28
30{
31 std::hash<EDA_TEXT> hasher;
34
35 BOOST_CHECK_EQUAL( a, b );
36 BOOST_CHECK_EQUAL( hasher( a ), hasher( b ) );
37
38 a.SetText( wxS( "A" ) );
39 BOOST_CHECK_GT( a, b );
40 BOOST_CHECK_NE( hasher( a ), hasher( b ) );
41
42 b.SetText( wxS( "B" ) );
43 BOOST_CHECK_LT( a, b );
44 BOOST_CHECK_NE( hasher( a ), hasher( b ) );
45
46 a.SetText( wxS( "B" ) );
47 a.SetTextPos( VECTOR2I( 1, 0 ) );
48 BOOST_CHECK_GT( a, b );
49
50 a.SetTextPos( VECTOR2I( -1, 0 ) );
51 BOOST_CHECK_LT( a, b );
52
53 a.SetTextPos( VECTOR2I( 0, 0 ) );
54 b.SetTextPos( VECTOR2I( 0, 1 ) );
55 BOOST_CHECK_LT( a, b );
56
57 b.SetTextPos( VECTOR2I( 0, -1 ) );
58 BOOST_CHECK_GT( a, b );
59
60 // Text attributes are tested in the TEXT_ATTRIBUTES unit tests.
61}
62
63
constexpr EDA_IU_SCALE unityScale
Definition: base_units.h:111
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:80
void SetTextPos(const VECTOR2I &aPoint)
Definition: eda_text.cpp:551
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:269
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(Compare)
BOOST_AUTO_TEST_SUITE_END()
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:691