KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_title_block.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, you may find one here:
18
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19
* or you may search the http://www.gnu.org website for the version 2 license,
20
* or you may write to the Free Software Foundation, Inc.,
21
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22
*/
23
24
#include <
qa_utils/wx_utils/unit_test_utils.h
>
25
26
#include <
title_block.h
>
27
28
29
struct
TitleBlockFixture
30
{
31
TitleBlockFixture
()
32
{
33
m_tb
.SetTitle(
"title"
);
34
m_tb
.SetDate(
"date"
);
35
m_tb
.SetCompany(
"company"
);
36
37
// leave revision blank
38
//m_tb.SetRevision( "revision" );
39
40
// set more than one comment to make sure the indexing of comments works
41
m_tb
.SetComment( 0,
"comment1"
);
42
m_tb
.SetComment( 1,
"comment2"
);
43
m_tb
.SetComment( 2,
"comment3"
);
44
m_tb
.SetComment( 3,
"comment4"
);
45
}
46
47
TITLE_BLOCK
m_tb
;
48
};
49
50
54
BOOST_FIXTURE_TEST_SUITE( TitleBlock,
TitleBlockFixture
)
55
56
59
BOOST_AUTO_TEST_CASE
( SimpleAccess )
60
{
61
BOOST_CHECK_EQUAL
(
"title"
, m_tb.GetTitle() );
62
BOOST_CHECK_EQUAL
(
"date"
, m_tb.GetDate() );
63
BOOST_CHECK_EQUAL
(
"company"
, m_tb.GetCompany() );
64
65
// This one is blank
66
BOOST_CHECK_EQUAL
(
""
, m_tb.GetRevision() );
67
68
BOOST_CHECK_EQUAL
(
"comment1"
, m_tb.GetComment( 0 ) );
69
BOOST_CHECK_EQUAL
(
"comment2"
, m_tb.GetComment( 1 ) );
70
BOOST_CHECK_EQUAL
(
"comment3"
, m_tb.GetComment( 2 ) );
71
BOOST_CHECK_EQUAL
(
"comment4"
, m_tb.GetComment( 3 ) );
72
}
73
74
/*
75
* Check copy construction
76
*/
77
BOOST_AUTO_TEST_CASE
( Copy )
78
{
79
TITLE_BLOCK
tb_cpy = m_tb;
80
81
// Check that values came through
82
BOOST_CHECK_EQUAL
(
"title"
, tb_cpy.
GetTitle
() );
83
BOOST_CHECK_EQUAL
(
"comment1"
, tb_cpy.
GetComment
( 0 ) );
84
BOOST_CHECK_EQUAL
(
"comment2"
, tb_cpy.
GetComment
( 1 ) );
85
}
86
87
88
BOOST_AUTO_TEST_SUITE_END
()
TITLE_BLOCK
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition
title_block.h:41
TITLE_BLOCK::GetComment
const wxString & GetComment(int aIdx) const
Definition
title_block.h:107
TITLE_BLOCK::GetTitle
const wxString & GetTitle() const
Definition
title_block.h:63
TitleBlockFixture
Definition
test_title_block.cpp:30
TitleBlockFixture::m_tb
TITLE_BLOCK m_tb
Definition
test_title_block.cpp:47
TitleBlockFixture::TitleBlockFixture
TitleBlockFixture()
Definition
test_title_block.cpp:31
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
Definition
test_api_enums.cpp:134
BOOST_AUTO_TEST_SUITE_END
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL
BOOST_CHECK_EQUAL(result, "25.4")
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(SimpleAccess)
Declares a struct as the Boost test fixture.
Definition
test_title_block.cpp:59
title_block.h
unit_test_utils.h
src
qa
tests
common
test_title_block.cpp
Generated on Mon Oct 13 2025 00:06:27 for KiCad PCB EDA Suite by
1.13.2