From 4048542d54484e10cb8f0d5f8f2e8639aefb1709 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 29 Oct 2023 01:45:34 +0200 Subject: [PATCH] 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. --- tests/graphics/bitmap.cpp | 60 +++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/tests/graphics/bitmap.cpp b/tests/graphics/bitmap.cpp index 29e265a331..37a6ecda64 100644 --- a/tests/graphics/bitmap.cpp +++ b/tests/graphics/bitmap.cpp @@ -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