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
21
22#include <title_block.h>
23
24
26{
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
44};
45
46
50BOOST_FIXTURE_TEST_SUITE( TitleBlock, TitleBlockFixture )
51
52
55BOOST_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 */
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
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition title_block.h:37
const wxString & GetComment(int aIdx) const
const wxString & GetTitle() const
Definition title_block.h:59
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")
BOOST_AUTO_TEST_CASE(SimpleAccess)
Declares a struct as the Boost test fixture.