Add a unit test for wxImage::Scale() method.
Check that resizing the test horse image produces the same results in the future as it does now, by saving the current results in files and verifying that images resized directly and loaded from these files are the same. See #15281. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74318 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
BIN
tests/image/horse_bicubic_100x100.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
tests/image/horse_bicubic_150x150.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
tests/image/horse_bicubic_300x300.png
Normal file
After Width: | Height: | Size: 102 KiB |
BIN
tests/image/horse_bicubic_50x50.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
tests/image/horse_bilinear_100x100.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
tests/image/horse_bilinear_150x150.png
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
tests/image/horse_bilinear_300x300.png
Normal file
After Width: | Height: | Size: 110 KiB |
BIN
tests/image/horse_bilinear_50x50.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
tests/image/horse_box_average_100x100.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
tests/image/horse_box_average_150x150.png
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
tests/image/horse_box_average_300x300.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
tests/image/horse_box_average_50x50.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
@@ -79,6 +79,7 @@ private:
|
|||||||
CPPUNIT_TEST( GIFComment );
|
CPPUNIT_TEST( GIFComment );
|
||||||
CPPUNIT_TEST( DibPadding );
|
CPPUNIT_TEST( DibPadding );
|
||||||
CPPUNIT_TEST( BMPFlippingAndRLECompression );
|
CPPUNIT_TEST( BMPFlippingAndRLECompression );
|
||||||
|
CPPUNIT_TEST( ScaleCompare );
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
void LoadFromSocketStream();
|
void LoadFromSocketStream();
|
||||||
@@ -94,6 +95,7 @@ private:
|
|||||||
void GIFComment();
|
void GIFComment();
|
||||||
void DibPadding();
|
void DibPadding();
|
||||||
void BMPFlippingAndRLECompression();
|
void BMPFlippingAndRLECompression();
|
||||||
|
void ScaleCompare();
|
||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(ImageTestCase)
|
DECLARE_NO_COPY_CLASS(ImageTestCase)
|
||||||
};
|
};
|
||||||
@@ -1343,6 +1345,48 @@ void ImageTestCase::BMPFlippingAndRLECompression()
|
|||||||
|
|
||||||
CompareBMPImage("image/horse_rle4.bmp", "image/horse_rle4_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");
|
||||||
|
}
|
||||||
|
|
||||||
#endif //wxUSE_IMAGE
|
#endif //wxUSE_IMAGE
|
||||||
|
|
||||||
|
|
||||||
|
@@ -486,7 +486,7 @@ data:
|
|||||||
|
|
||||||
data-images:
|
data-images:
|
||||||
if not exist image mkdir image
|
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:
|
fr:
|
||||||
if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr
|
if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr
|
||||||
|
@@ -475,7 +475,7 @@ data:
|
|||||||
|
|
||||||
data-images:
|
data-images:
|
||||||
if not exist image mkdir image
|
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:
|
fr:
|
||||||
if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr
|
if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr
|
||||||
|
@@ -626,7 +626,7 @@ data:
|
|||||||
|
|
||||||
data-images:
|
data-images:
|
||||||
if not exist image mkdir image
|
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:
|
fr:
|
||||||
if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr
|
if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr
|
||||||
|
@@ -535,7 +535,7 @@ data : .SYMBOLIC
|
|||||||
|
|
||||||
data-images : .SYMBOLIC
|
data-images : .SYMBOLIC
|
||||||
if not exist image mkdir image
|
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
|
fr : .SYMBOLIC
|
||||||
if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr
|
if not exist $(OBJS)\intl\fr mkdir $(OBJS)\intl\fr
|
||||||
|
@@ -246,9 +246,26 @@
|
|||||||
<wx-data id="data-images">
|
<wx-data id="data-images">
|
||||||
<srcdir>$(SRCDIR)/image</srcdir>
|
<srcdir>$(SRCDIR)/image</srcdir>
|
||||||
<dstdir>image</dstdir>
|
<dstdir>image</dstdir>
|
||||||
<files>horse_grey.bmp horse_grey_flipped.bmp
|
<files>
|
||||||
horse_rle4.bmp horse_rle4_flipped.bmp
|
horse_grey.bmp horse_grey_flipped.bmp
|
||||||
horse_rle8.bmp horse_rle8_flipped.bmp</files>
|
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
|
||||||
|
</files>
|
||||||
</wx-data>
|
</wx-data>
|
||||||
|
|
||||||
<template id="catalog">
|
<template id="catalog">
|
||||||
|