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 (C) 2018 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
25
26#include <title_block.h>
27
28
30{
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
48};
49
50
54BOOST_FIXTURE_TEST_SUITE( TitleBlock, TitleBlockFixture )
55
56
59BOOST_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 */
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
88BOOST_AUTO_TEST_SUITE_END()
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:41
void SetComment(int aIdx, const wxString &aComment)
Definition: title_block.h:101
void SetTitle(const wxString &aTitle)
Definition: title_block.h:58
const wxString & GetComment(int aIdx) const
Definition: title_block.h:107
void SetCompany(const wxString &aCompany)
Definition: title_block.h:91
const wxString & GetTitle() const
Definition: title_block.h:63
void SetDate(const wxString &aDate)
Set the date field, and defaults to the current time and date.
Definition: title_block.h:71
BOOST_AUTO_TEST_CASE(SimpleAccess)
Declares a struct as the Boost test fixture.