KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_api_module.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 modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * 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 <boost/test/unit_test.hpp>
21#include <wx/app.h>
22
23#include <mock_pgm_base.h>
24#include <pcbnew_settings.h>
25#include <pgm_base.h>
29#include <locale_io.h>
30
32{
33 SetPgm( new MOCK_PGM_BASE() );
34
35 boost::unit_test::framework::master_test_suite().p_name.value = "IPC API tests";
36
37 wxApp::SetInstance( new wxAppConsole );
38
39 // Ensure the "C" locale is used
41
42 bool ok = wxInitialize( boost::unit_test::framework::master_test_suite().argc,
43 boost::unit_test::framework::master_test_suite().argv );
44
45 if( ok )
46 {
47 wxSetAssertHandler( &KI_TEST::wxAssertThrower );
48
49 Pgm().InitPgm( true, true );
51
52 // Board commits read PCBNEW_SETTINGS from the program settings manager, which the
53 // pcbnew kiface registers in a real session
55 }
56
57 return ok;
58}
59
60
61int main( int argc, char* argv[] )
62{
63 return boost::unit_test::unit_test_main( &init_unit_test, argc, argv );
64}
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition locale_io.h:37
bool InitPgm(bool aHeadless=false, bool aIsUnitTest=false)
Initialize this program.
Definition pgm_base.cpp:320
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:124
T * RegisterSettings(T *aSettings, bool aLoadNow=true)
Take ownership of the pointer passed in.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Load a project or sets up a new project with a specified path.
void wxAssertThrower(const wxString &aFile, int aLine, const wxString &aFunc, const wxString &aCond, const wxString &aMsg)
Definition wx_assert.h:67
void SetPgm(PGM_BASE *pgm)
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
std::vector< FAB_LAYER_COLOR > dummy
bool init_unit_test()