Fix bug with wrong GetIndexToUpscale() return value
Only assign known good values of the index to "indexLast" as otherwise we could end up returning an invalid index value from it if "indexBest" was never set and the last index wasn't a valid one, as it happened in wxBitmapBundleImplSet containing an original bitmap and a x2 scaled copy of it, which shouldn't be used for further scaling. Add a unit test checking that this bug is fixed now.
This commit is contained in:
@@ -50,6 +50,15 @@ TEST_CASE("BitmapBundle::FromBitmaps", "[bmpbundle]")
|
||||
CHECK( b.GetBitmap(wxSize(24, 24)).GetSize() == wxSize(24, 24) );
|
||||
}
|
||||
|
||||
TEST_CASE("BitmapBundle::GetBitmap", "[bmpbundle]")
|
||||
{
|
||||
const wxBitmapBundle b = wxBitmapBundle::FromBitmap(wxBitmap(16, 16));
|
||||
|
||||
CHECK( b.GetBitmap(wxSize(16, 16)).GetSize() == wxSize(16, 16) );
|
||||
CHECK( b.GetBitmap(wxSize(32, 32)).GetSize() == wxSize(32, 32) );
|
||||
CHECK( b.GetBitmap(wxSize(24, 24)).GetSize() == wxSize(24, 24) );
|
||||
}
|
||||
|
||||
// Helper functions for the test below.
|
||||
namespace
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user