Added saving support to TGA image handler.
Supports saving 24-bit and 32-bit (RGB with alpha). Updated image unit test to verify the alpha channel of saved TGA images. Also removed a condition skipping a test which only was in place for TGA (formerly its saving handler would do nothing yet say saving was succesful). See also #7661. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66485 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -874,13 +874,14 @@ static
|
||||
void CompareImage(const wxImageHandler& handler, const wxImage& expected)
|
||||
{
|
||||
bool testAlpha = expected.HasAlpha();
|
||||
if (testAlpha && type != wxBITMAP_TYPE_PNG)
|
||||
wxBitmapType type = handler.GetType();
|
||||
if (testAlpha
|
||||
&& !(type == wxBITMAP_TYPE_PNG || type == wxBITMAP_TYPE_TGA) )
|
||||
{
|
||||
// don't test images with alpha if this handler doesn't support alpha
|
||||
return;
|
||||
}
|
||||
|
||||
wxBitmapType type = handler.GetType();
|
||||
if (type == wxBITMAP_TYPE_JPEG /* skip lossy JPEG */
|
||||
|| type == wxBITMAP_TYPE_TIF)
|
||||
{
|
||||
@@ -901,14 +902,6 @@ void CompareImage(const wxImageHandler& handler, const wxImage& expected)
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !memOut.GetSize() )
|
||||
{
|
||||
// A handler that does not support saving can return true during
|
||||
// SaveFile, in that case the stream is empty.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
wxMemoryInputStream memIn(memOut);
|
||||
CPPUNIT_ASSERT(memIn.IsOk());
|
||||
|
||||
|
Reference in New Issue
Block a user