|
KiCad PCB EDA Suite
|
Test suite for BITMAP_BASE. More...
#include <qa_utils/wx_utils/unit_test_utils.h>#include <bitmap_base.h>#include "wximage_test_utils.h"#include <wx/mstream.h>Go to the source code of this file.
Classes | |
| class | TEST_BITMAP_BASE_FIXTURE |
| struct | TEST_PIXEL_CASE |
Functions | |
| BOOST_AUTO_TEST_CASE (Empty) | |
| Declare the test suite. | |
| BOOST_AUTO_TEST_CASE (EmptyCopy) | |
| Check we can validly copy an empty bitmap. | |
| BOOST_AUTO_TEST_CASE (BasicProps) | |
| Check basic properties of the populated images. | |
| BOOST_AUTO_TEST_CASE (PPIFromNonIntegerPixelsPerCm) | |
| Verify PPI is computed without integer truncation when pixels/cm is non-integer. | |
| BOOST_AUTO_TEST_CASE (BasicImage) | |
| Check the image is right. | |
| BOOST_AUTO_TEST_CASE (RotateImageCCW) | |
| Check the image is right after rotating CCW. | |
| BOOST_AUTO_TEST_CASE (RotateImageCW) | |
| Check the image is right after rotating CW. | |
| BOOST_AUTO_TEST_CASE (MirrorImage) | |
| Check the image is right after mirroring. | |
| BOOST_AUTO_TEST_CASE (SetImageOutputsData) | |
| Check setting image data by SetImage produces saveable data via SaveImageData. | |
Variables | |
| static const std::vector< unsigned char > | png_data_4tile |
| 4tile is an 8x8 image | |
| static const VECTOR2I | size_4tile { 8, 8 } |
| static const KIGFX::COLOR4D | col_red { 1.0, 0.0, 0.0, 1.0 } |
| static const KIGFX::COLOR4D | col_green { 0.0, 1.0, 0.0, 1.0 } |
| static const KIGFX::COLOR4D | col_blue { 0.0, 0.0, 1.0, 1.0 } |
| static const KIGFX::COLOR4D | col_black { 0.0, 0.0, 0.0, 1.0 } |
Test suite for BITMAP_BASE.
Definition in file test_bitmap_base.cpp.
| BOOST_AUTO_TEST_CASE | ( | BasicImage | ) |
Check the image is right.
Definition at line 206 of file test_bitmap_base.cpp.
References BOOST_CHECK_PREDICATE(), col_black, col_blue, col_green, col_red, and KI_TEST::IsImagePixelOfColor().
| BOOST_AUTO_TEST_CASE | ( | BasicProps | ) |
Check basic properties of the populated images.
Definition at line 145 of file test_bitmap_base.cpp.
References BOOST_CHECK_EQUAL(), BITMAP_BASE::GetBoundingBox(), BOX2< Vec >::GetEnd(), BITMAP_BASE::GetImageData(), BITMAP_BASE::GetPixelSizeIu(), BOX2< Vec >::GetPosition(), BITMAP_BASE::GetPPI(), BITMAP_BASE::GetScale(), BITMAP_BASE::GetSize(), BITMAP_BASE::GetSizePixels(), and size_4tile.
| BOOST_AUTO_TEST_CASE | ( | Empty | ) |
Declare the test suite.
Check basic properties of a populated image
Definition at line 103 of file test_bitmap_base.cpp.
References BOOST_AUTO_TEST_CASE(), BOOST_CHECK_EQUAL(), empty(), BITMAP_BASE::GetImageData(), BITMAP_BASE::GetPixelSizeIu(), BITMAP_BASE::GetPPI(), BITMAP_BASE::GetScale(), and TOP_BOTTOM.
| BOOST_AUTO_TEST_CASE | ( | EmptyCopy | ) |
Check we can validly copy an empty bitmap.
Definition at line 124 of file test_bitmap_base.cpp.
References BOOST_CHECK_EQUAL(), copied, and empty().
| BOOST_AUTO_TEST_CASE | ( | MirrorImage | ) |
Check the image is right after mirroring.
Definition at line 284 of file test_bitmap_base.cpp.
References BOOST_CHECK_PREDICATE(), col_black, col_blue, col_green, col_red, KI_TEST::IsImagePixelOfColor(), and TOP_BOTTOM.
| BOOST_AUTO_TEST_CASE | ( | PPIFromNonIntegerPixelsPerCm | ) |
Verify PPI is computed without integer truncation when pixels/cm is non-integer.
PNG stores resolution as pixels-per-meter (e.g. 3780 PPM for ~96 DPI). wxWidgets converts to pixels-per-cm as a string ("37.8"). The old code used GetOptionInt() which truncated "37.8" to 37 before multiplying by 2.54, giving 94 instead of the correct 96. This tests that the full precision path is used.
Definition at line 178 of file test_bitmap_base.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BITMAP_BASE::GetPPI(), and BITMAP_BASE::ReadImageFile().
| BOOST_AUTO_TEST_CASE | ( | RotateImageCCW | ) |
Check the image is right after rotating CCW.
Definition at line 230 of file test_bitmap_base.cpp.
References BOOST_CHECK_PREDICATE(), col_black, col_blue, col_green, col_red, and KI_TEST::IsImagePixelOfColor().
| BOOST_AUTO_TEST_CASE | ( | RotateImageCW | ) |
Check the image is right after rotating CW.
Definition at line 257 of file test_bitmap_base.cpp.
References BOOST_CHECK_PREDICATE(), col_black, col_blue, col_green, col_red, and KI_TEST::IsImagePixelOfColor().
| BOOST_AUTO_TEST_CASE | ( | SetImageOutputsData | ) |
Check setting image data by SetImage produces saveable data via SaveImageData.
Regression test for: https://gitlab.com/kicad/code/kicad/-/issues/19772
Definition at line 313 of file test_bitmap_base.cpp.
References BOOST_CHECK_PREDICATE(), BOOST_REQUIRE(), KI_TEST::ImagesHaveSamePixels(), BITMAP_BASE::SaveImageData(), and BITMAP_BASE::SetImage().
|
static |
Definition at line 66 of file test_bitmap_base.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 65 of file test_bitmap_base.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 64 of file test_bitmap_base.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 63 of file test_bitmap_base.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
static |
4tile is an 8x8 image
Definition at line 44 of file test_bitmap_base.cpp.
Referenced by TEST_BITMAP_BASE_FIXTURE::TEST_BITMAP_BASE_FIXTURE().
|
static |
Definition at line 61 of file test_bitmap_base.cpp.
Referenced by BOOST_AUTO_TEST_CASE().