From 2373b4ca24e115219364514b882d2ebca2ab7b6b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 18 May 2022 15:40:55 +0100 Subject: [PATCH] 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. --- build/cmake/tests/gui/CMakeLists.txt | 1 - tests/graphics/imagelist.cpp | 14 ++++++++++---- tests/image/wx.ico | Bin 1078 -> 0 bytes 3 files changed, 10 insertions(+), 5 deletions(-) delete mode 100644 tests/image/wx.ico diff --git a/build/cmake/tests/gui/CMakeLists.txt b/build/cmake/tests/gui/CMakeLists.txt index a412248df5..9ed420cfaa 100644 --- a/build/cmake/tests/gui/CMakeLists.txt +++ b/build/cmake/tests/gui/CMakeLists.txt @@ -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 diff --git a/tests/graphics/imagelist.cpp b/tests/graphics/imagelist.cpp index 83f3055d2d..a8795b562d 100644 --- a/tests/graphics/imagelist.cpp +++ b/tests/graphics/imagelist.cpp @@ -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); diff --git a/tests/image/wx.ico b/tests/image/wx.ico deleted file mode 100644 index 435cca2471cd31bb825ff1e6eb180c1939a9eb4a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1078 zcmc&zF%p6>5L_S)1H}g<-VtX@^EF=Zz9{mlQwW;#il~Wy%sJax^Jn}JGe|Bw=NmFB ge8aqPJmI~ud$Eb6)2}9ELOWr8V4xU|6W(XUPqgg+2mk;8