Prevent unit test from crashing under wxGTK3

Under wxGTK3 default color depth for wxBitmap is 24 bpp and therefore wxAlphaPixelData cannot be used to get access to wxBitmap's internal data in this case.

See #17666.
This commit is contained in:
Artur Wieczorek
2017-04-13 23:39:23 +02:00
parent 5a7570bf7d
commit 34e19a7449

View File

@@ -107,9 +107,10 @@ void BitmapTestCase::OverlappingBlit()
dc.Blit( 0, 1, 10, 9, &dc, 0, 0 );
} // Select the bitmap out of the memory DC before using it directly.
// Now, lines 0 and 1 should be red, lines 2++ should still be white.
if ( m_bmp.GetDepth() == 32 )
{
wxAlphaPixelData npd( m_bmp );
wxAlphaPixelData::Iterator it( npd );
@@ -120,4 +121,24 @@ void BitmapTestCase::OverlappingBlit()
ASSERT_EQUAL_RGB( it, 255, 255, 255 );
it.OffsetY( npd, 1 );
ASSERT_EQUAL_RGB( it, 255, 255, 255 );
}
else
{
wxNativePixelData npd( m_bmp );
wxNativePixelData::Iterator it( npd );
if ( !npd )
{
CPPUNIT_FAIL( "Raw access to bitmap data unavailable" );
}
else
{
ASSERT_EQUAL_RGB( it, 255, 0, 0 );
it.OffsetY( npd, 1 );
ASSERT_EQUAL_RGB( it, 255, 0, 0 );
it.OffsetY( npd, 1 );
ASSERT_EQUAL_RGB( it, 255, 255, 255 );
it.OffsetY( npd, 1 );
ASSERT_EQUAL_RGB( it, 255, 255, 255 );
}
}
}