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, see <https://www.gnu.org/licenses/>.
18
*/
19
20
#include <
qa_utils/wx_utils/unit_test_utils.h
>
21
22
#include <
title_block.h
>
23
24
25
struct
TitleBlockFixture
26
{
27
TitleBlockFixture
()
28
{
29
m_tb
.SetTitle(
"title"
);
30
m_tb
.SetDate(
"date"
);
31
m_tb
.SetCompany(
"company"
);
32
33
// leave revision blank
34
//m_tb.SetRevision( "revision" );
35
36
// set more than one comment to make sure the indexing of comments works
37
m_tb
.SetComment( 0,
"comment1"
);
38
m_tb
.SetComment( 1,
"comment2"
);
39
m_tb
.SetComment( 2,
"comment3"
);
40
m_tb
.SetComment( 3,
"comment4"
);
41
}
42
43
TITLE_BLOCK
m_tb
;
44
};
45
46
50
BOOST_FIXTURE_TEST_SUITE( TitleBlock,
TitleBlockFixture
)
51
52
55
BOOST_AUTO_TEST_CASE
( SimpleAccess )
56
{
57
BOOST_CHECK_EQUAL
(
"title"
, m_tb.GetTitle() );
58
BOOST_CHECK_EQUAL
(
"date"
, m_tb.GetDate() );
59
BOOST_CHECK_EQUAL
(
"company"
, m_tb.GetCompany() );
60
61
// This one is blank
62
BOOST_CHECK_EQUAL
(
""
, m_tb.GetRevision() );
63
64
BOOST_CHECK_EQUAL
(
"comment1"
, m_tb.GetComment( 0 ) );
65
BOOST_CHECK_EQUAL
(
"comment2"
, m_tb.GetComment( 1 ) );
66
BOOST_CHECK_EQUAL
(
"comment3"
, m_tb.GetComment( 2 ) );
67
BOOST_CHECK_EQUAL
(
"comment4"
, m_tb.GetComment( 3 ) );
68
}
69
70
/*
71
* Check copy construction
72
*/
73
BOOST_AUTO_TEST_CASE
( Copy )
74
{
75
TITLE_BLOCK
tb_cpy = m_tb;
76
77
// Check that values came through
78
BOOST_CHECK_EQUAL
(
"title"
, tb_cpy.
GetTitle
() );
79
BOOST_CHECK_EQUAL
(
"comment1"
, tb_cpy.
GetComment
( 0 ) );
80
BOOST_CHECK_EQUAL
(
"comment2"
, tb_cpy.
GetComment
( 1 ) );
81
}
82
83
84
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:37
TITLE_BLOCK::GetComment
const wxString & GetComment(int aIdx) const
Definition
title_block.h:103
TITLE_BLOCK::GetTitle
const wxString & GetTitle() const
Definition
title_block.h:59
TitleBlockFixture
Definition
test_title_block.cpp:26
TitleBlockFixture::m_tb
TITLE_BLOCK m_tb
Definition
test_title_block.cpp:43
TitleBlockFixture::TitleBlockFixture
TitleBlockFixture()
Definition
test_title_block.cpp:27
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
Definition
test_api_enums.cpp:71
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:55
title_block.h
unit_test_utils.h
src
qa
tests
common
test_title_block.cpp
Generated on Fri Jun 26 2026 00:05:43 for KiCad PCB EDA Suite by
1.13.2