|
KiCad PCB EDA Suite
|
#include <boost/test/data/test_case.hpp>#include <qa_utils/wx_utils/unit_test_utils.h>#include <board.h>#include <kiid.h>#include <layer_ids.h>#include <pcb_reference_image.h>#include <reference_image.h>#include <bitmap_base.h>#include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>#include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.h>#include <pcbnew_utils/board_file_utils.h>#include <pcbnew_utils/board_test_utils.h>#include <richio.h>#include <settings/settings_manager.h>#include <filesystem>#include <fstream>#include <sstream>#include <wx/image.h>Go to the source code of this file.
Classes | |
| class | REFERENCE_IMAGE_BOARD_FIXTURE |
Functions | |
| BOOST_DATA_TEST_CASE_F (REFERENCE_IMAGE_LOAD_TEST_FIXTURE, ReferenceImageLoading, boost::unit_test::data::make(ReferenceImageLoading_testCases), testCase) | |
| 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 PCB item types. | |
| BOOST_FIXTURE_TEST_CASE (ReferenceImagePpiScaleMigration, REFERENCE_IMAGE_BOARD_FIXTURE) | |
| A board predating the PNG pixel-density fix stored an image scale that compensated for the truncated PPI. | |
| BOOST_FIXTURE_TEST_CASE (ReferenceImageRotateTransformOrigin, REFERENCE_IMAGE_BOARD_FIXTURE) | |
| Rotating a reference image must rotate the transform origin with the image content, so the origin keeps pointing at the same pixel of the image. | |
| BOOST_FIXTURE_TEST_CASE (ReferenceImageStoresRotation, REFERENCE_IMAGE_BOARD_FIXTURE) | |
| A rotation is stored on the image and applied when drawing, so the raster is never resampled and the bounding box follows the drawn orientation. | |
| BOOST_DATA_TEST_CASE_F | ( | REFERENCE_IMAGE_LOAD_TEST_FIXTURE | , |
| ReferenceImageLoading | , | ||
| boost::unit_test::data::make(ReferenceImageLoading_testCases) | , | ||
| testCase | ) |
Definition at line 137 of file test_reference_image_load.cpp.
References KIID::AsString(), BOOST_CHECK_EQUAL(), BOOST_TEST_MESSAGE(), REFERENCE_IMAGE::GetImage(), REFERENCE_IMAGE::GetImageScale(), BITMAP_BASE::GetSizePixels(), image, KI_TEST::LoadAndTestBoardFile(), PCB_REFERENCE_IMAGE_T, and KI_TEST::RequireBoardItemWithTypeAndId().
| 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 PCB item types.
Definition at line 171 of file test_reference_image_load.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOARD::FlipLayer(), image, LEFT_RIGHT, KI_TEST::LoadAndTestBoardFile(), PCB_REFERENCE_IMAGE_T, KI_TEST::RequireBoardItemWithTypeAndId(), and TOP_BOTTOM.
| BOOST_FIXTURE_TEST_CASE | ( | ReferenceImagePpiScaleMigration | , |
| REFERENCE_IMAGE_BOARD_FIXTURE | ) |
A board predating the PNG pixel-density fix stored an image scale that compensated for the truncated PPI.
Loading it must re-scale by the corrected/truncated PPI ratio so the rendered size is preserved, while a current-version board is loaded verbatim.
Definition at line 249 of file test_reference_image_load.cpp.
References BOOST_REQUIRE(), KI_TEST::DumpBoardToFile(), F_Cu, REFERENCE_IMAGE::GetImage(), BITMAP_BASE::GetLegacyPPI(), BITMAP_BASE::GetPPI(), image, path, REFERENCE_IMAGE::SetImageScale(), and SEXPR_BOARD_FILE_VERSION.
| BOOST_FIXTURE_TEST_CASE | ( | ReferenceImageRotateTransformOrigin | , |
| REFERENCE_IMAGE_BOARD_FIXTURE | ) |
Rotating a reference image must rotate the transform origin with the image content, so the origin keeps pointing at the same pixel of the image.
Definition at line 296 of file test_reference_image_load.cpp.
References ANGLE_90, BOOST_CHECK_EQUAL(), REFERENCE_IMAGE::Flip(), REFERENCE_IMAGE::GetPosition(), REFERENCE_IMAGE::GetTransformOriginOffset(), image, LEFT_RIGHT, REFERENCE_IMAGE::Rotate(), REFERENCE_IMAGE::SetPosition(), and REFERENCE_IMAGE::SetTransformOriginOffset().
| BOOST_FIXTURE_TEST_CASE | ( | ReferenceImageStoresRotation | , |
| REFERENCE_IMAGE_BOARD_FIXTURE | ) |
A rotation is stored on the image and applied when drawing, so the raster is never resampled and the bounding box follows the drawn orientation.
Definition at line 328 of file test_reference_image_load.cpp.
References ANGLE_0, ANGLE_270, ANGLE_45, ANGLE_90, BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), REFERENCE_IMAGE::GetBoundingBox(), BOX2< Vec >::GetHeight(), REFERENCE_IMAGE::GetOrientation(), REFERENCE_IMAGE::GetPosition(), BOX2< Vec >::GetSize(), REFERENCE_IMAGE::GetSize(), BOX2< Vec >::GetWidth(), image, REFERENCE_IMAGE::Rotate(), REFERENCE_IMAGE::SetImage(), REFERENCE_IMAGE::SetPosition(), VECTOR2< T >::x, and VECTOR2< T >::y.