Add a simple test allowing to load an arbitrary image

This test is disabled by default but useful for checking if the given
image can be loaded.
This commit is contained in:
Vadim Zeitlin 2022-06-08 17:04:15 +01:00
parent 5e1f4910b2
commit 1a6c5746db

View File

@ -2326,6 +2326,28 @@ TEST_CASE("wxImage::SizeLimits", "[image]")
#endif // SIZEOF_VOID_P == 8
}
// This can be used to test loading an arbitrary image file by setting the
// environment variable WX_TEST_IMAGE_PATH to point to it.
TEST_CASE("wxImage::LoadPath", "[.]")
{
wxString path;
REQUIRE( wxGetEnv("WX_TEST_IMAGE_PATH", &path) );
TestLogEnabler enableLogs;
wxInitAllImageHandlers();
wxImage image;
REQUIRE( image.LoadFile(path) );
WARN("Image "
<< image.GetWidth()
<< "*"
<< image.GetHeight()
<< (image.HasAlpha() ? " with alpha" : "")
<< " loaded");
}
/*
TODO: add lots of more tests to wxImage functions
*/