diff --git a/tests/image/horse_bicubic_100x100.png b/tests/image/horse_bicubic_100x100.png new file mode 100644 index 0000000000..1ac57b0585 Binary files /dev/null and b/tests/image/horse_bicubic_100x100.png differ diff --git a/tests/image/horse_bicubic_150x150.png b/tests/image/horse_bicubic_150x150.png new file mode 100644 index 0000000000..7e4c81de25 Binary files /dev/null and b/tests/image/horse_bicubic_150x150.png differ diff --git a/tests/image/horse_bicubic_300x300.png b/tests/image/horse_bicubic_300x300.png new file mode 100644 index 0000000000..1bcce1ca8a Binary files /dev/null and b/tests/image/horse_bicubic_300x300.png differ diff --git a/tests/image/horse_bicubic_50x50.png b/tests/image/horse_bicubic_50x50.png new file mode 100644 index 0000000000..1ad94a2609 Binary files /dev/null and b/tests/image/horse_bicubic_50x50.png differ diff --git a/tests/image/horse_bilinear_100x100.png b/tests/image/horse_bilinear_100x100.png new file mode 100644 index 0000000000..390ed5843c Binary files /dev/null and b/tests/image/horse_bilinear_100x100.png differ diff --git a/tests/image/horse_bilinear_150x150.png b/tests/image/horse_bilinear_150x150.png new file mode 100644 index 0000000000..b17ca3a603 Binary files /dev/null and b/tests/image/horse_bilinear_150x150.png differ diff --git a/tests/image/horse_bilinear_300x300.png b/tests/image/horse_bilinear_300x300.png new file mode 100644 index 0000000000..d4c5d06f76 Binary files /dev/null and b/tests/image/horse_bilinear_300x300.png differ diff --git a/tests/image/horse_bilinear_50x50.png b/tests/image/horse_bilinear_50x50.png new file mode 100644 index 0000000000..6e7a7eee2d Binary files /dev/null and b/tests/image/horse_bilinear_50x50.png differ diff --git a/tests/image/horse_box_average_100x100.png b/tests/image/horse_box_average_100x100.png new file mode 100644 index 0000000000..7e4b0a069d Binary files /dev/null and b/tests/image/horse_box_average_100x100.png differ diff --git a/tests/image/horse_box_average_150x150.png b/tests/image/horse_box_average_150x150.png new file mode 100644 index 0000000000..bd42d0ca70 Binary files /dev/null and b/tests/image/horse_box_average_150x150.png differ diff --git a/tests/image/horse_box_average_300x300.png b/tests/image/horse_box_average_300x300.png new file mode 100644 index 0000000000..bb4bb6bbf6 Binary files /dev/null and b/tests/image/horse_box_average_300x300.png differ diff --git a/tests/image/horse_box_average_50x50.png b/tests/image/horse_box_average_50x50.png new file mode 100644 index 0000000000..5d06ced576 Binary files /dev/null and b/tests/image/horse_box_average_50x50.png differ diff --git a/tests/image/image.cpp b/tests/image/image.cpp index f0f8ad2c4c..0201f271e5 100644 --- a/tests/image/image.cpp +++ b/tests/image/image.cpp @@ -79,6 +79,7 @@ private: CPPUNIT_TEST( GIFComment ); CPPUNIT_TEST( DibPadding ); CPPUNIT_TEST( BMPFlippingAndRLECompression ); + CPPUNIT_TEST( ScaleCompare ); CPPUNIT_TEST_SUITE_END(); void LoadFromSocketStream(); @@ -94,6 +95,7 @@ private: void GIFComment(); void DibPadding(); void BMPFlippingAndRLECompression(); + void ScaleCompare(); DECLARE_NO_COPY_CLASS(ImageTestCase) }; @@ -1343,6 +1345,48 @@ void ImageTestCase::BMPFlippingAndRLECompression() 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"); +} + #endif //wxUSE_IMAGE diff --git a/tests/makefile.bcc b/tests/makefile.bcc index 74b2218b56..331b2563cb 100644 --- a/tests/makefile.bcc +++ b/tests/makefile.bcc @@ -486,7 +486,7 @@ data: data-images: if not exist image mkdir image - for %f in (horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp) do if not exist image\%f copy .\image\%f image + for %f in (horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp horse_bicubic_50x50.png horse_bicubic_100x100.png horse_bicubic_150x150.png horse_bicubic_300x300.png horse_bilinear_50x50.png horse_bilinear_100x100.png horse_bilinear_150x150.png horse_bilinear_300x300.png horse_box_average_50x50.png horse_box_average_100x100.png horse_box_average_150x150.png horse_box_average_300x300.png) do if not exist image\%f copy .\image\%f image fr: if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr diff --git a/tests/makefile.gcc b/tests/makefile.gcc index 252a63a5c0..b64a38ad07 100644 --- a/tests/makefile.gcc +++ b/tests/makefile.gcc @@ -475,7 +475,7 @@ data: data-images: if not exist image mkdir image - for %%f in (horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp) do if not exist image\%%f copy .\image\%%f image + for %%f in (horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp horse_bicubic_50x50.png horse_bicubic_100x100.png horse_bicubic_150x150.png horse_bicubic_300x300.png horse_bilinear_50x50.png horse_bilinear_100x100.png horse_bilinear_150x150.png horse_bilinear_300x300.png horse_box_average_50x50.png horse_box_average_100x100.png horse_box_average_150x150.png horse_box_average_300x300.png) do if not exist image\%%f copy .\image\%%f image fr: if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr diff --git a/tests/makefile.vc b/tests/makefile.vc index 5890b203a1..4054a2f575 100644 --- a/tests/makefile.vc +++ b/tests/makefile.vc @@ -626,7 +626,7 @@ data: data-images: if not exist image mkdir image - for %f in (horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp) do if not exist image\%f copy .\image\%f image + for %f in (horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp horse_bicubic_50x50.png horse_bicubic_100x100.png horse_bicubic_150x150.png horse_bicubic_300x300.png horse_bilinear_50x50.png horse_bilinear_100x100.png horse_bilinear_150x150.png horse_bilinear_300x300.png horse_box_average_50x50.png horse_box_average_100x100.png horse_box_average_150x150.png horse_box_average_300x300.png) do if not exist image\%f copy .\image\%f image fr: if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr diff --git a/tests/makefile.wat b/tests/makefile.wat index 8c4d53fdb5..88a3f23823 100644 --- a/tests/makefile.wat +++ b/tests/makefile.wat @@ -535,7 +535,7 @@ data : .SYMBOLIC data-images : .SYMBOLIC if not exist image mkdir image - for %f in (horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp) do if not exist image\%f copy .\image\%f image + for %f in (horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp horse_bicubic_50x50.png horse_bicubic_100x100.png horse_bicubic_150x150.png horse_bicubic_300x300.png horse_bilinear_50x50.png horse_bilinear_100x100.png horse_bilinear_150x150.png horse_bilinear_300x300.png horse_box_average_50x50.png horse_box_average_100x100.png horse_box_average_150x150.png horse_box_average_300x300.png) do if not exist image\%f copy .\image\%f image fr : .SYMBOLIC if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr diff --git a/tests/test.bkl b/tests/test.bkl index cedfbe8c58..4fc52db5a8 100644 --- a/tests/test.bkl +++ b/tests/test.bkl @@ -246,9 +246,26 @@ $(SRCDIR)/image image - horse_grey.bmp horse_grey_flipped.bmp - horse_rle4.bmp horse_rle4_flipped.bmp - horse_rle8.bmp horse_rle8_flipped.bmp + + horse_grey.bmp horse_grey_flipped.bmp + horse_rle4.bmp horse_rle4_flipped.bmp + horse_rle8.bmp horse_rle8_flipped.bmp + + horse_bicubic_50x50.png + horse_bicubic_100x100.png + horse_bicubic_150x150.png + horse_bicubic_300x300.png + + horse_bilinear_50x50.png + horse_bilinear_100x100.png + horse_bilinear_150x150.png + horse_bilinear_300x300.png + + horse_box_average_50x50.png + horse_box_average_100x100.png + horse_box_average_150x150.png + horse_box_average_300x300.png +