From d9a48edc8148d452f384965e4cd8fd438b82b84d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 20 Mar 2022 21:54:33 +0100 Subject: [PATCH] Restore the old default size of Tango art provider bitmaps The default size of the bitmaps created from bitmap bundles returned by the Tango art provider for the client strings different from wxART_MENU and wxART_BUTTON was changed from 24x24 to 16x16 in 766fefeb34 (Use SVG instead of PNGs in tango art provider, 2022-01-27), see #22067, without any real need and perhaps even non intentionally at all. Restore the old default size to restore the old behaviour. See #22189. --- src/common/arttango.cpp | 8 ++++++-- tests/graphics/bmpbundle.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/common/arttango.cpp b/src/common/arttango.cpp index 8cd77db770..969597968c 100644 --- a/src/common/arttango.cpp +++ b/src/common/arttango.cpp @@ -209,8 +209,12 @@ wxTangoArtProvider::CreateBitmapBundle(const wxArtID& id, wxSize sizeDef = size != wxDefaultSize ? size : GetSizeHint(client); if (sizeDef == wxDefaultSize) { - // We really need some default size here. - sizeDef = wxSize(16, 16); + // We really need some default size here, so keep using the same + // sizes we used for PNG-based implementation we had before. + if ( client == wxART_MENU || client == wxART_BUTTON ) + sizeDef = wxSize(16, 16); + else + sizeDef = wxSize(24, 24); } return wxBitmapBundle::FromSVG(entry.data, entry.len, sizeDef); } diff --git a/tests/graphics/bmpbundle.cpp b/tests/graphics/bmpbundle.cpp index 25002b29ef..a703fe0bec 100644 --- a/tests/graphics/bmpbundle.cpp +++ b/tests/graphics/bmpbundle.cpp @@ -162,6 +162,30 @@ TEST_CASE("BitmapBundle::ArtProvider", "[bmpbundle][art]") b = wxArtProvider::GetBitmapBundle(wxART_INFORMATION, wxART_MENU, size); CHECK( b.IsOk() ); CHECK( b.GetDefaultSize() == size ); + +#if wxUSE_ARTPROVIDER_TANGO + // Tango art provider is supposed to use 16px for the default size of the + // menu and button images and 24px for all the other ones, but we need to + // choose the client kind for which the current platform doesn't define its + // own default/fallback size to be able to test for it, i.e. this is the + // client for which GetNativeSizeHint() of the native art provider returns + // wxDefaultSize. + const wxArtClient artClient = +#ifdef __WXMSW__ + wxART_TOOLBAR +#else + wxART_LIST +#endif + ; + + // We also need to use an image provided by Tango but not by the native art + // provider, but here we can at least avoid the platform checks by using an + // image not provided by any native providers. + b = wxArtProvider::GetBitmapBundle(wxART_REFRESH, artClient); + + CHECK( b.IsOk() ); + CHECK( b.GetDefaultSize() == wxSize(24, 24) ); +#endif // wxUSE_ARTPROVIDER_TANGO } // This test only makes sense for the ports that actually support scaled