Construct the test bitmaps directly in wxImageList test code
Don't use external image files, this makes it simpler to run the test (it can be now done from any directory) and also experiment with it (e.g. by making the test image fully transparent or fully opaque). Remove the now unneeded .ico file but keep the .png one still used by another test.
This commit is contained in:
parent
1ed13da86e
commit
2373b4ca24
3 changed files with 10 additions and 5 deletions
|
|
@ -182,7 +182,6 @@ set(TEST_GUI_DATA
|
|||
image/paste_result_background_plus_overlay_transparent_border_semitransparent_square.png
|
||||
image/paste_result_no_background_square_over_circle.png
|
||||
image/wx.png
|
||||
image/wx.ico
|
||||
image/toucan.png
|
||||
image/toucan_hue_0.538.png
|
||||
image/toucan_sat_-0.41.png
|
||||
|
|
|
|||
|
|
@ -68,8 +68,6 @@ ImageListTestCase::ImageListTestCase()
|
|||
: bmpRGB(32, 32, 24),
|
||||
bmpMask(32, 32, 1)
|
||||
{
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
{
|
||||
wxMemoryDC mdc(bmpRGB);
|
||||
mdc.SetBackground(*wxBLUE_BRUSH);
|
||||
|
|
@ -79,7 +77,15 @@ ImageListTestCase::ImageListTestCase()
|
|||
}
|
||||
REQUIRE(bmpRGB.IsOk());
|
||||
|
||||
bmpRGBA.LoadFile("image/wx.png", wxBITMAP_TYPE_PNG);
|
||||
// Make a bitmap with some transparent and semi-transparent pixels.
|
||||
wxImage imgWithAlpha(32, 32);
|
||||
imgWithAlpha.SetAlpha();
|
||||
unsigned char* const alpha = imgWithAlpha.GetAlpha();
|
||||
for ( unsigned char* a = alpha; a < alpha + 32*32; ++a )
|
||||
*a = wxALPHA_OPAQUE;
|
||||
alpha[0] = wxALPHA_TRANSPARENT;
|
||||
alpha[1] = wxALPHA_OPAQUE / 2;
|
||||
bmpRGBA = wxBitmap(imgWithAlpha);
|
||||
REQUIRE(bmpRGBA.IsOk());
|
||||
|
||||
{
|
||||
|
|
@ -103,7 +109,7 @@ ImageListTestCase::ImageListTestCase()
|
|||
bmpRGBAWithMask.SetMask(new wxMask(bmpMask));
|
||||
REQUIRE(bmpRGBAWithMask.IsOk());
|
||||
|
||||
ico.LoadFile("image/wx.ico", wxBITMAP_TYPE_ICO);
|
||||
ico.CopyFromBitmap(bmpRGBWithMask);
|
||||
REQUIRE(ico.IsOk());
|
||||
|
||||
REQUIRE(bmpRGB.HasAlpha() == false);
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
Loading…
Add table
Add a link
Reference in a new issue