Move test not depending on it outside wxHAS_RAW_BITMAP check

No real changes, just don't put the test not using raw bitmap access
inside the section guarded by "#if wxHAS_RAW_BITMAP".

This commit is best viewed with Git --color-moved option.
This commit is contained in:
Vadim Zeitlin 2023-10-29 01:45:34 +02:00
parent 34bce88b23
commit 4048542d54

View file

@ -1705,36 +1705,6 @@ TEST_CASE("Bitmap::DC", "[bitmap][dc]")
#endif // wxUSE_SVG
}
#if defined(wxHAS_DPI_INDEPENDENT_PIXELS) || defined(__WXMSW__)
TEST_CASE("Bitmap::ScaleFactor", "[bitmap][dc][scale]")
{
// Create a bitmap with scale factor != 1.
wxBitmap bmp;
bmp.CreateWithDIPSize(8, 8, 2);
REQUIRE( bmp.GetScaleFactor() == 2 );
CHECK( bmp.GetSize() == wxSize(16, 16) );
// wxMemoryDC should use the same scale factor as the bitmap.
wxMemoryDC dc(bmp);
CHECK( dc.GetContentScaleFactor() == 2 );
// A bitmap "compatible" with this DC should also use the same scale factor.
wxBitmap bmp2(4, 4, dc);
CHECK( bmp2.GetScaleFactor() == 2 );
CHECK( bmp2.GetSize() == wxSize(8, 8) );
// A compatible bitmap created from wxImage and this DC should also inherit
// the same scale factor, but its size should be still the same as that of
// the image.
wxImage img(16, 16);
wxBitmap bmp3(img, dc);
CHECK( bmp3.GetScaleFactor() == 2 );
CHECK( bmp3.GetSize() == wxSize(16, 16) );
}
#endif // ports with scaled bitmaps support
#if wxUSE_GRAPHICS_CONTEXT
inline void DrawScaledBmp(wxBitmap& bmp, float scale, wxGraphicsRenderer* renderer)
@ -1827,3 +1797,33 @@ TEST_CASE("GC::DrawBitmap", "[bitmap][drawbitmap]")
#endif //wxUSE_GRAPHICS_CONTEXT
#endif //wxHAS_RAW_BITMAP
#if defined(wxHAS_DPI_INDEPENDENT_PIXELS) || defined(__WXMSW__)
TEST_CASE("Bitmap::ScaleFactor", "[bitmap][dc][scale]")
{
// Create a bitmap with scale factor != 1.
wxBitmap bmp;
bmp.CreateWithDIPSize(8, 8, 2);
REQUIRE( bmp.GetScaleFactor() == 2 );
CHECK( bmp.GetSize() == wxSize(16, 16) );
// wxMemoryDC should use the same scale factor as the bitmap.
wxMemoryDC dc(bmp);
CHECK( dc.GetContentScaleFactor() == 2 );
// A bitmap "compatible" with this DC should also use the same scale factor.
wxBitmap bmp2(4, 4, dc);
CHECK( bmp2.GetScaleFactor() == 2 );
CHECK( bmp2.GetSize() == wxSize(8, 8) );
// A compatible bitmap created from wxImage and this DC should also inherit
// the same scale factor, but its size should be still the same as that of
// the image.
wxImage img(16, 16);
wxBitmap bmp3(img, dc);
CHECK( bmp3.GetScaleFactor() == 2 );
CHECK( bmp3.GetSize() == wxSize(16, 16) );
}
#endif // ports with scaled bitmaps support