Fix assert checking input size in wxOSX GetSubBitmap()

Extend the just added GetSubBitmap() unit test to check for this too.
This commit is contained in:
Vadim Zeitlin 2023-10-29 00:53:21 +02:00
parent 2cf77c2596
commit 8f3331e8c1
2 changed files with 8 additions and 3 deletions

View file

@ -1842,7 +1842,7 @@ TEST_CASE("wxBitmap::GetSubBitmap", "[bitmap]")
// Extracting sub-bitmap of the entire bitmap size should return the bitmap
// of the same size.
#if wxHAS_DPI_INDEPENDENT_PIXELS
#ifdef wxHAS_DPI_INDEPENDENT_PIXELS
const wxRect rectAll(wxPoint(0, 0), sizeLog);
#else
const wxRect rectAll(wxPoint(0, 0), sizePhy);
@ -1852,6 +1852,11 @@ TEST_CASE("wxBitmap::GetSubBitmap", "[bitmap]")
CHECK( sub.GetDIPSize() == sizeLog );
CHECK( sub.GetSize() == sizePhy );
CHECK( sub.GetScaleFactor() == scale );
// Using incorrect bounds should assert.
wxRect rectInvalid = rectAll;
rectInvalid.Offset(1, 0);
WX_ASSERT_FAILS_WITH_ASSERT( bmp.GetSubBitmap(rectInvalid) );
}
#endif // ports with scaled bitmaps support