35struct REFERENCE_IMAGE_LOAD_TEST_FIXTURE
37 REFERENCE_IMAGE_LOAD_TEST_FIXTURE() {}
41struct REFERENCE_IMAGE_LOAD_TEST_CASE
46 bool m_expectedLocked;
48 double m_expectedScale;
54struct REFERENCE_IMAGE_LOAD_BOARD_TEST_CASE
57 wxString m_boardFileRelativePath;
59 std::vector<REFERENCE_IMAGE_LOAD_TEST_CASE> m_imageCases;
66 const std::vector<REFERENCE_IMAGE_LOAD_BOARD_TEST_CASE> testCases{
68 "reference_images_load_save",
72 "7dde345e-020a-4fdd-af77-588b452be5e0",
79 "e4fd52dd-1d89-4c43-b621-aebfc9788d5c",
86 "d402397e-bce0-4cae-a398-b5aeef397e87",
96 for(
const REFERENCE_IMAGE_LOAD_BOARD_TEST_CASE& testCase : testCases )
98 const auto doBoardTest = [&](
const BOARD& aBoard )
100 for(
const REFERENCE_IMAGE_LOAD_TEST_CASE& imageTestCase : testCase.m_imageCases )
103 "Checking for image with UUID: " << imageTestCase.m_imageUuid.AsString() );
110 BOOST_CHECK_EQUAL(
image.IsLocked(), imageTestCase.m_expectedLocked );
111 BOOST_CHECK_EQUAL(
image.GetPosition(), imageTestCase.m_expectedPos * 1000000 );
112 BOOST_CHECK_CLOSE( refImage.
GetImageScale(), imageTestCase.m_expectedScale, 1e-6 );
116 BOOST_CHECK_EQUAL( bitmap.
GetSizePixels(), imageTestCase.m_expectedPixelSize );
General utilities for PCB file IO for QA programs.
This class handle bitmap images in KiCad.
VECTOR2I GetSizePixels() const
Information pertinent to a Pcbnew printed circuit board.
Object to handle a bitmap image that can be inserted in a PCB.
A REFERENCE_IMAGE is a wrapper around a BITMAP_IMAGE that is displayed in an editor as a reference fo...
const BITMAP_BASE & GetImage() const
Get the underlying image.
double GetImageScale() const
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...
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.
BOOST_FIXTURE_TEST_CASE(ReferenceImageLoading, REFERENCE_IMAGE_LOAD_TEST_FIXTURE)
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer