21#include <boost/test/data/test_case.hpp>
41struct FOOTPRINT_LOAD_TEST_CASE
46 bool m_expectedLocked;
54 std::vector<FOOTPRINT_LOAD_TEST_CASE> m_fpCases;
58const std::vector<FOOTPRINT_LOAD_BOARD_TEST_CASE> FootprintLoadSave_testCases{
60 "footprints_load_save",
65 "898cf321-03c7-40bb-8d78-4bc5e52986c2",
70 "0775cd70-2e84-4592-a160-456c37a8f4f6",
86 boost::unit_test::data::make( FootprintLoadSave_testCases ), testCase )
88 const auto doBoardTest = [&](
const BOARD& aBoard )
90 for(
const FOOTPRINT_LOAD_TEST_CASE& fooprintTestCase : testCase.m_fpCases )
93 << fooprintTestCase.m_footprintUuid.
AsString() );
104 testCase.m_ExpectedBoardVersion );
122 userField->
SetText( wxS(
"BezelSW0" ) );
125 fp->
Add( userField );
129 fpText->
SetText( wxS(
"fp text" ) );
137 const std::filesystem::path
path = tempDir.
Path() /
"field_lock.kicad_pcb";
144 FOOTPRINT* loaded = restored->Footprints().front();
174 userField->
SetText( wxS(
"BezelSW0" ) );
177 fp->
Add( userField );
184 const std::filesystem::path
path = tempDir.
Path() /
"auto_thickness.kicad_pcb";
191 PCB_FIELD* loaded = restored->Footprints().front()->GetField( wxS(
"Label" ) );
203 const auto doBoardTest = [&](
const BOARD& aBoard )
207 PCB_FIELD* field = aBoard.Footprints().front()->GetField( wxS(
"myfield" ) );
212 aBoard.GetDesignSettings().GetTextThickness( field->
GetLayer() ) );
constexpr EDA_IU_SCALE pcbIUScale
General utilities for PCB file IO for QA programs.
int m_TextThickness[LAYER_CLASS_COUNT]
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetLocked(bool aLocked) override
bool IsLocked() const override
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
BOARD_DESIGN_SETTINGS & GetDesignSettings()
bool GetAutoThickness() const
void SetAutoThickness(bool aAuto)
virtual void SetText(const wxString &aText)
wxString AsString() const
const std::filesystem::path & Path() const
Get the path to the temporary directory as a std::filesystem::path.
int GetTextThickness() const override
std::unique_ptr< BOARD > ReadBoardFromFileOrStream(const std::string &aFilename, std::istream &aFallback)
Read a board from a file, or another stream, as appropriate.
void LoadAndTestBoardFile(const wxString aRelativePath, bool aRoundtrip, std::function< void(BOARD &)> aBoardTestFunction, std::optional< int > aExpectedBoardVersion)
Perform "some test" on a board file loaded from the path, then optionally save and reload and run the...
void DumpBoardToFile(BOARD &board, const std::filesystem::path &aFilename)
Utility function to simply write a Board out to a file.
BOARD_ITEM & RequireBoardItemWithTypeAndId(const BOARD &aBoard, KICAD_T aItemType, const KIID &aID)
Get an item from the given board with a certain type and UUID.
@ USER
The field ID hasn't been set yet; field is invalid.
@ REFERENCE
Field Reference of part, i.e. "IC21".
BOOST_CHECK(res.column_datatype(0)==SQL_NUMERIC||res.column_datatype(0)==SQL_DECIMAL)
BOOST_REQUIRE_EQUAL(rows.size(), 1)
BOOST_CHECK_EQUAL(std::any_cast< std::string >(rows[0].at("val")), "12345678901234567.89")
BOOST_REQUIRE(res.columns()==1)
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
VECTOR2< int32_t > VECTOR2I