36#include <wx/mstream.h>
45 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52,
46 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x08, 0x06, 0x00, 0x00, 0x00, 0xC4, 0x0F, 0xBE,
47 0x8B, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, 0x54, 0x08, 0x08, 0x08, 0x08, 0x7C, 0x08, 0x64,
48 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0E, 0xC4, 0x00, 0x00, 0x0E,
49 0xC4, 0x01, 0x95, 0x2B, 0x0E, 0x1B, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6F,
50 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x77, 0x77, 0x77, 0x2E, 0x69, 0x6E, 0x6B, 0x73, 0x63,
51 0x61, 0x70, 0x65, 0x2E, 0x6F, 0x72, 0x67, 0x9B, 0xEE, 0x3C, 0x1A, 0x00, 0x00, 0x00, 0x40, 0x49,
52 0x44, 0x41, 0x54, 0x18, 0x95, 0xA5, 0xCD, 0x4B, 0x0A, 0xC0, 0x20, 0x14, 0x43, 0xD1, 0x63, 0x77,
53 0xA7, 0xDD, 0xFF, 0x06, 0xD4, 0x7D, 0x3C, 0x07, 0x95, 0x42, 0x3F, 0xE0, 0xC0, 0x84, 0x0C, 0x02,
54 0xE1, 0x86, 0x78, 0x99, 0x13, 0x1D, 0x0D, 0xC5, 0xCF, 0xA0, 0x21, 0x66, 0xEA, 0x61, 0xA9, 0x2F,
55 0xA1, 0x4C, 0x4A, 0x45, 0x4E, 0x71, 0xA1, 0x6E, 0xA5, 0x67, 0xB5, 0xBC, 0xD8, 0x1F, 0x0C, 0xA7,
56 0xFD, 0x23, 0x67, 0x70, 0xDA, 0x89, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE,
108 const int expected_ppi = 300;
111 BOOST_CHECK_EQUAL( cempty.
GetPPI(), expected_ppi );
112 BOOST_CHECK_EQUAL( cempty.
GetScale(), 1.0 );
113 BOOST_CHECK_EQUAL( cempty.
GetPixelSizeIu(), 254000.0 / expected_ppi );
116 empty.Rotate(
true );
154 const int expected_ppi = 94;
155 BOOST_CHECK_EQUAL( img.
GetPPI(), expected_ppi );
156 BOOST_CHECK_EQUAL( img.
GetScale(), 5.0 );
175 const wxImage* img_data = m_4tile.GetImageData();
176 BOOST_REQUIRE_NE( img_data,
nullptr );
180 const std::vector<TEST_PIXEL_CASE> exp_pixels = {
187 for(
const auto& c : exp_pixels )
189 BOOST_CHECK_PREDICATE(
200 m_4tile.Rotate(
false );
202 const wxImage* img_data = m_4tile.GetImageData();
203 BOOST_REQUIRE_NE( img_data,
nullptr );
207 const std::vector<TEST_PIXEL_CASE> exp_pixels = {
214 for(
const auto& c : exp_pixels )
216 BOOST_CHECK_PREDICATE(
228 const wxImage* img_data = m_4tile.GetImageData();
229 BOOST_REQUIRE_NE( img_data,
nullptr );
233 const std::vector<TEST_PIXEL_CASE> exp_pixels = {
240 for(
const auto& c : exp_pixels )
242 BOOST_CHECK_PREDICATE(
This class handle bitmap images in KiCad.
VECTOR2I GetSizePixels() const
const BOX2I GetBoundingBox() const
Return the orthogonal, bounding box of this object for display purposes.
double GetPixelSizeIu() const
void SetPixelSizeIu(double aPixSize)
bool ReadImageFile(const wxString &aFullFilename)
Reads and stores in memory an image file.
void SetScale(double aScale)
constexpr const Vec & GetPosition() const
constexpr const Vec GetEnd() const
A color representation with 4 components: red, green, blue, alpha.
TEST_BITMAP_BASE_FIXTURE()
static bool empty(const wxTextEntryBase *aCtrl)
@ TOP_BOTTOM
Flip top to bottom (around the X axis)
bool IsImagePixelOfColor(const wxImage &aImage, int aX, int aY, const KIGFX::COLOR4D &aColor)
Predicate to check an image pixel matches color and alpha.
static const KIGFX::COLOR4D col_blue
BOOST_AUTO_TEST_CASE(Empty)
Declare the test suite.
static const VECTOR2I size_4tile
static const KIGFX::COLOR4D col_red
static const KIGFX::COLOR4D col_green
static const std::vector< unsigned char > png_data_4tile
4tile is an 8x8 image
static const KIGFX::COLOR4D col_black
BOOST_AUTO_TEST_SUITE_END()