diff --git a/tests/image/image.cpp b/tests/image/image.cpp index 838cb9a655..ef72876698 100644 --- a/tests/image/image.cpp +++ b/tests/image/image.cpp @@ -20,6 +20,7 @@ #endif // WX_PRECOMP #include "wx/anidecod.h" // wxImageArray +#include "wx/bitmap.h" #include "wx/palette.h" #include "wx/url.h" #include "wx/log.h" @@ -82,6 +83,7 @@ private: CPPUNIT_TEST( DibPadding ); CPPUNIT_TEST( BMPFlippingAndRLECompression ); CPPUNIT_TEST( ScaleCompare ); + CPPUNIT_TEST( CreateBitmapFromCursor ); CPPUNIT_TEST_SUITE_END(); void LoadFromSocketStream(); @@ -102,6 +104,7 @@ private: void DibPadding(); void BMPFlippingAndRLECompression(); void ScaleCompare(); + void CreateBitmapFromCursor(); wxDECLARE_NO_COPY_CLASS(ImageTestCase); }; @@ -1451,6 +1454,37 @@ void ImageTestCase::ScaleCompare() "image/cross_nearest_neighb_256x256.png"); } +const unsigned char toucan[] = +{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0xc0, 0x00, + 0x00, 0x09, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, + 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x08, 0xf8, 0x00, 0x00, 0x58, 0xf8, 0x00, 0x00, + 0x2f, 0xf8, 0x00, 0x00, 0x50, 0x78, 0x00, 0x00, 0x64, 0x00, 0x01, 0x00, 0x61, 0x80, 0x00, 0x00, + 0x7b, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x0d, 0x20, 0x00, 0x00, + 0x48, 0x10, 0x00, 0x00, 0x50, 0x80, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +void ImageTestCase::CreateBitmapFromCursor() +{ +#if !defined __WXOSX_IPHONE__ && !defined __WXDFB__ && !defined __WXMOTIF__ && !defined __WXX11__ +#ifdef __WXMSW__ + wxImage image( 32, 32, toucan ); +#else + wxImage image( "../../samples/image/toucan.png" ); +#endif + wxCursor cursor( image ); + wxBitmap bitmap( cursor ); + if( bitmap.IsOk() ) +#ifdef __WXOSX__ + CHECK_THAT( image, RGBSimilarTo( bitmap.ConvertToImage(), 2 ) ); +#else + CHECK_THAT( image, RGBSameAs( bitmap.ConvertToImage() ) ); +#endif +#endif +} + #endif //wxUSE_IMAGE TEST_CASE("wxImage::Paste", "[image][paste]") diff --git a/tests/image/toucan.png b/tests/image/toucan.png new file mode 100644 index 0000000000..03960d4939 Binary files /dev/null and b/tests/image/toucan.png differ