Save/Load test to make sure we don't bugger up the PCBNew file format.

This commit is contained in:
Jeff Young 2022-01-09 13:02:41 +00:00
parent 2fea9e7513
commit 393ccf1187
3 changed files with 69 additions and 3 deletions

View File

@ -199,9 +199,9 @@ void TEST_NETLISTS_FIXTURE::compareNetlists()
// The video test has a bunch of unconnected RESERVED pins which cause duplicate // The video test has a bunch of unconnected RESERVED pins which cause duplicate
// auto-generated netnames. The connectivity algo disambiguates these with "_n" // auto-generated netnames. The connectivity algo disambiguates these with "_n"
// suffixes, but since the algorithm is multi-threaded which ones get which suffix // suffixes, but since the algorithm is multi-threaded, which ones get which suffix
// is not deterministic. So skip these. // is not deterministic. So skip these.
if( testNet.GetPinName().Contains( "RESERVED" ) ) if( testNet.GetPinFunction().Contains( "RESERVED" ) )
continue; continue;
// The two nets at the same index should be identical // The two nets at the same index should be identical

View File

@ -1,6 +1,6 @@
# This program source code file is part of KiCad, a free EDA CAD application. # This program source code file is part of KiCad, a free EDA CAD application.
# #
# Copyright (C) 2018 KiCad Developers, see CHANGELOG.TXT for contributors. # Copyright (C) 2018-2022 KiCad Developers, see CHANGELOG.TXT for contributors.
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -38,6 +38,7 @@ set( QA_PCBNEW_SRCS
test_lset.cpp test_lset.cpp
test_pad_numbering.cpp test_pad_numbering.cpp
test_libeval_compiler.cpp test_libeval_compiler.cpp
test_save_load.cpp
test_tracks_cleaner.cpp test_tracks_cleaner.cpp
test_zone_filler.cpp test_zone_filler.cpp

View File

@ -0,0 +1,65 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <qa/pcbnew/board_test_utils.h>
#include <pcbnew_utils/board_file_utils.h>
#include <boost/filesystem.hpp>
#include <board.h>
#include <settings/settings_manager.h>
struct SAVE_LOAD_TEST_FIXTURE
{
SAVE_LOAD_TEST_FIXTURE() :
m_settingsManager( true /* headless */ )
{ }
SETTINGS_MANAGER m_settingsManager;
std::unique_ptr<BOARD> m_board;
};
BOOST_FIXTURE_TEST_CASE( RegressionSaveLoadTests, SAVE_LOAD_TEST_FIXTURE )
{
std::vector<wxString> tests = { "issue18",
"issue832",
"issue2568",
"issue5313",
"issue5854",
"issue6260",
"issue6945",
"issue7267",
"issue8003" };
auto savePath = boost::filesystem::temp_directory_path() / "group_saveload_tst.kicad_pcb";
for( const wxString& relPath : tests )
{
KI_TEST::LoadBoard( m_settingsManager, relPath, m_board );
KI_TEST::DumpBoardToFile( *m_board.get(), savePath.string() );
std::unique_ptr<BOARD> board2 = KI_TEST::ReadBoardFromFileOrStream( savePath.string() );
}
}