25#include <boost/test/data/test_case.hpp>
38struct REFERENCE_IMAGE_LOAD_TEST_FIXTURE
40 REFERENCE_IMAGE_LOAD_TEST_FIXTURE() {}
44struct REFERENCE_IMAGE_LOAD_TEST_CASE
49 bool m_expectedLocked;
51 double m_expectedScale;
60 std::vector<REFERENCE_IMAGE_LOAD_TEST_CASE> m_imageCases;
63const std::vector<REFERENCE_IMAGE_LOAD_BOARD_TEST_CASE> ReferenceImageLoading_testCases{
65 "reference_images_load_save",
70 "7dde345e-020a-4fdd-af77-588b452be5e0",
77 "e4fd52dd-1d89-4c43-b621-aebfc9788d5c",
84 "d402397e-bce0-4cae-a398-b5aeef397e87",
98 boost::unit_test::data::make( ReferenceImageLoading_testCases ), testCase )
100 const auto doBoardTest = [&](
const BOARD& aBoard )
102 for(
const REFERENCE_IMAGE_LOAD_TEST_CASE& imageTestCase : testCase.m_imageCases )
105 "Checking for image with UUID: " << imageTestCase.m_imageUuid.
AsString() );
114 BOOST_CHECK_CLOSE( refImage.
GetImageScale(), imageTestCase.m_expectedScale, 1e-6 );
123 testCase.m_ExpectedBoardVersion );
133 const auto doBoardTest = [&](
const BOARD& aBoard )
135 KIID targetUuid(
"7dde345e-020a-4fdd-af77-588b452be5e0" );
149 PCB_LAYER_ID flippedLayer = aBoard.FlipLayer( origLayer );
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.
wxString AsString() const
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
PCB_LAYER_ID
A quick note on layer IDs:
@ LEFT_RIGHT
Flip left to right (around the Y axis)
@ TOP_BOTTOM
Flip top to bottom (around the X axis)
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_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_FIXTURE_TEST_CASE(ReferenceImageFlipLayer, REFERENCE_IMAGE_LOAD_TEST_FIXTURE)
Test that flipping a reference image changes its associated layer, matching the behavior of all other...
BOOST_DATA_TEST_CASE_F(REFERENCE_IMAGE_LOAD_TEST_FIXTURE, ReferenceImageLoading, boost::unit_test::data::make(ReferenceImageLoading_testCases), testCase)
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
BOOST_CHECK_EQUAL(result, "25.4")
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
VECTOR2< int32_t > VECTOR2I