+ image = image.Scale(99, 99);
+
+ wxMemoryOutputStream memOut;
+ CPPUNIT_ASSERT( image.SaveFile(memOut, wxBITMAP_TYPE_ICO) );
+}
+
+static void CompareBMPImage(const wxString& file1, const wxString& file2)
+{
+ wxImage image1(file1);
+ CPPUNIT_ASSERT( image1.IsOk() );
+
+ wxImage image2(file2);
+ CPPUNIT_ASSERT( image2.IsOk() );
+
+ CompareImage(*wxImage::FindHandler(wxBITMAP_TYPE_BMP), image1, 0, &image2);
+}
+
+void ImageTestCase::BMPFlippingAndRLECompression()
+{
+ CompareBMPImage("image/horse_grey.bmp", "image/horse_grey_flipped.bmp");
+
+ CompareBMPImage("image/horse_rle8.bmp", "image/horse_grey.bmp");
+ CompareBMPImage("image/horse_rle8.bmp", "image/horse_rle8_flipped.bmp");
+
+ CompareBMPImage("image/horse_rle4.bmp", "image/horse_rle4_flipped.bmp");
+}
+
+
+#define ASSERT_IMAGE_EQUAL_TO_FILE(image, file) \
+ { \
+ wxImage imageFromFile(file); \
+ CPPUNIT_ASSERT_MESSAGE( "Failed to load " file, imageFromFile.IsOk() ); \
+ CPPUNIT_ASSERT_EQUAL( imageFromFile, image ); \
+ }
+
+void ImageTestCase::ScaleCompare()
+{
+ wxImage original;
+ CPPUNIT_ASSERT(original.LoadFile("horse.bmp"));
+
+ ASSERT_IMAGE_EQUAL_TO_FILE(original.Scale( 50, 50, wxIMAGE_QUALITY_BICUBIC),
+ "image/horse_bicubic_50x50.png");
+ ASSERT_IMAGE_EQUAL_TO_FILE(original.Scale(100, 100, wxIMAGE_QUALITY_BICUBIC),
+ "image/horse_bicubic_100x100.png");
+ ASSERT_IMAGE_EQUAL_TO_FILE(original.Scale(150, 150, wxIMAGE_QUALITY_BICUBIC),
+ "image/horse_bicubic_150x150.png");
+ ASSERT_IMAGE_EQUAL_TO_FILE(original.Scale(300, 300, wxIMAGE_QUALITY_BICUBIC),
+ "image/horse_bicubic_300x300.png");
+
+ ASSERT_IMAGE_EQUAL_TO_FILE(original.Scale( 50, 50, wxIMAGE_QUALITY_BOX_AVERAGE),
+ "image/horse_box_average_50x50.png");
+ ASSERT_IMAGE_EQUAL_TO_FILE(original.Scale(100, 100, wxIMAGE_QUALITY_BOX_AVERAGE),
+ "image/horse_box_average_100x100.png");
+ ASSERT_IMAGE_EQUAL_TO_FILE(original.Scale(150, 150, wxIMAGE_QUALITY_BOX_AVERAGE),
+ "image/horse_box_average_150x150.png");
+ ASSERT_IMAGE_EQUAL_TO_FILE(original.Scale(300, 300, wxIMAGE_QUALITY_BOX_AVERAGE),
+ "image/horse_box_average_300x300.png");
+
+ ASSERT_IMAGE_EQUAL_TO_FILE(original.Scale( 50, 50, wxIMAGE_QUALITY_BILINEAR),
+ "image/horse_bilinear_50x50.png");
+ ASSERT_IMAGE_EQUAL_TO_FILE(original.Scale(100, 100, wxIMAGE_QUALITY_BILINEAR),
+ "image/horse_bilinear_100x100.png");
+ ASSERT_IMAGE_EQUAL_TO_FILE(original.Scale(150, 150, wxIMAGE_QUALITY_BILINEAR),
+ "image/horse_bilinear_150x150.png");
+ ASSERT_IMAGE_EQUAL_TO_FILE(original.Scale(300, 300, wxIMAGE_QUALITY_BILINEAR),
+ "image/horse_bilinear_300x300.png");