+}
+
+static void TestTIFFImage(const wxString& option, int value,
+ const wxImage *compareImage = NULL)
+{
+ wxImage image;
+ if (compareImage)
+ {
+ image = *compareImage;
+ }
+ else
+ {
+ (void) image.LoadFile("horse.png");
+ }
+ CPPUNIT_ASSERT( image.IsOk() );
+
+ wxMemoryOutputStream memOut;
+ image.SetOption(option, value);
+
+ CPPUNIT_ASSERT(image.SaveFile(memOut, wxBITMAP_TYPE_TIFF));
+
+ wxMemoryInputStream memIn(memOut);
+ CPPUNIT_ASSERT(memIn.IsOk());
+
+ wxImage savedImage(memIn);
+ CPPUNIT_ASSERT(savedImage.IsOk());
+
+ WX_ASSERT_EQUAL_MESSAGE(("While checking for option %s", option),
+ true, savedImage.HasOption(option));
+
+ WX_ASSERT_EQUAL_MESSAGE(("While testing for %s", option),
+ value, savedImage.GetOptionInt(option));
+
+ WX_ASSERT_EQUAL_MESSAGE(("HasAlpha() not equal"), image.HasAlpha(), savedImage.HasAlpha());
+}
+
+void ImageTestCase::SaveTIFF()
+{
+ TestTIFFImage(wxIMAGE_OPTION_TIFF_BITSPERSAMPLE, 1);
+ TestTIFFImage(wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL, 1);
+ TestTIFFImage(wxIMAGE_OPTION_TIFF_PHOTOMETRIC, 0/*PHOTOMETRIC_MINISWHITE*/);
+ TestTIFFImage(wxIMAGE_OPTION_TIFF_PHOTOMETRIC, 1/*PHOTOMETRIC_MINISBLACK*/);
+
+ wxImage alphaImage("horse.png");
+ CPPUNIT_ASSERT( alphaImage.IsOk() );
+ SetAlpha(&alphaImage);
+
+ // RGB with alpha
+ TestTIFFImage(wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL, 4, &alphaImage);
+
+ // Grey with alpha
+ TestTIFFImage(wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL, 2, &alphaImage);
+
+ // B/W with alpha
+ alphaImage.SetOption(wxIMAGE_OPTION_TIFF_BITSPERSAMPLE, 1);
+ TestTIFFImage(wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL, 2, &alphaImage);
+}
+
+void ImageTestCase::SaveAnimatedGIF()
+{