2019-01-11 22:03:45 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2021-08-03 13:32:49 +00:00
|
|
|
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2019-01-11 22:03:45 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef QA_PCBNEW_BOARD_TEST_UTILS__H
|
|
|
|
#define QA_PCBNEW_BOARD_TEST_UTILS__H
|
|
|
|
|
2021-08-03 16:02:42 +00:00
|
|
|
#include <memory>
|
2019-01-11 22:03:45 +00:00
|
|
|
#include <string>
|
2021-08-03 13:32:49 +00:00
|
|
|
#include <wx/string.h>
|
2019-01-11 22:03:45 +00:00
|
|
|
|
|
|
|
class BOARD;
|
|
|
|
class BOARD_ITEM;
|
2022-02-12 15:45:35 +00:00
|
|
|
class FOOTPRINT;
|
2022-02-15 19:56:10 +00:00
|
|
|
class FP_TEXT;
|
2022-02-12 15:45:35 +00:00
|
|
|
class FP_SHAPE;
|
|
|
|
class PAD;
|
2021-08-03 13:32:49 +00:00
|
|
|
class SETTINGS_MANAGER;
|
2019-01-11 22:03:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace KI_TEST
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* A helper that contains logic to assist in dumping boards to
|
|
|
|
* disk depending on some environment variables.
|
|
|
|
*
|
|
|
|
* This is useful when setting up or verifying unit tests that work on BOARD
|
|
|
|
* objects.
|
|
|
|
*
|
|
|
|
* To dump files set the KICAD_TEST_DUMP_BOARD_FILES environment variable.
|
|
|
|
* Files will be written to the system temp directory (/tmp on Linux, or as set
|
|
|
|
* by $TMP and friends).
|
|
|
|
*/
|
|
|
|
class BOARD_DUMPER
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BOARD_DUMPER();
|
|
|
|
|
|
|
|
void DumpBoardToFile( BOARD& aBoard, const std::string& aName ) const;
|
|
|
|
|
|
|
|
const bool m_dump_boards;
|
|
|
|
};
|
|
|
|
|
2021-08-03 13:32:49 +00:00
|
|
|
|
|
|
|
void LoadBoard( SETTINGS_MANAGER& aSettingsManager, const wxString& aRelPath,
|
|
|
|
std::unique_ptr<BOARD>& aBoard );
|
|
|
|
|
2022-02-11 12:42:09 +00:00
|
|
|
void FillZones( BOARD* m_board );
|
2021-08-03 13:32:49 +00:00
|
|
|
|
|
|
|
|
2022-02-12 15:45:35 +00:00
|
|
|
/**
|
|
|
|
* Helper method to check if two footprints are semantically the same.
|
|
|
|
*/
|
|
|
|
void CheckFootprint( const FOOTPRINT* expected, const FOOTPRINT* fp );
|
|
|
|
|
|
|
|
void CheckFpPad( const PAD* expected, const PAD* pad );
|
|
|
|
|
2022-02-15 19:56:10 +00:00
|
|
|
void CheckFpText( const FP_TEXT* expected, const FP_TEXT* text );
|
|
|
|
|
2022-02-12 15:45:35 +00:00
|
|
|
void CheckFpShape( const FP_SHAPE* expected, const FP_SHAPE* shape );
|
|
|
|
|
|
|
|
|
2019-01-11 22:03:45 +00:00
|
|
|
} // namespace KI_TEST
|
|
|
|
|
2021-08-03 16:02:42 +00:00
|
|
|
#endif // QA_PCBNEW_BOARD_TEST_UTILS__H
|