Return empty bitmaps from wxButton if not explicitly set in wxMSW

Do this for consistency with the other ports and because this seems more
useful anyhow.

Update the documentation to make this behaviour more clear and document
this change as a (minor) incompatibility in wxMSW.

Also add more unit tests to check for this behaviour. Note this also
fixes the problem with the unit test added in the grandparent commit
under MSW.
This commit is contained in:
Vadim Zeitlin
2021-09-03 20:12:19 +01:00
parent 169a33c238
commit 0f79f69d88
4 changed files with 90 additions and 26 deletions

View File

@@ -156,6 +156,17 @@ TEST_CASE_METHOD(ButtonTestCase, "Button::Bitmap", "[button]")
CHECK(m_button->GetBitmap().IsOk());
// The call above shouldn't affect any other bitmaps as returned by the API
// even though the same (normal) bitmap does appear for all the states.
CHECK( !m_button->GetBitmapCurrent().IsOk() );
CHECK( !m_button->GetBitmapDisabled().IsOk() );
CHECK( !m_button->GetBitmapFocus().IsOk() );
CHECK( !m_button->GetBitmapPressed().IsOk() );
// Do set one of the bitmaps now.
m_button->SetBitmapPressed(wxArtProvider::GetBitmap(wxART_ERROR));
CHECK( m_button->GetBitmapPressed().IsOk() );
// Check that resetting the button label doesn't result in problems when
// updating the bitmap later, as it used to be the case in wxGTK (#18898).
m_button->SetLabel(wxString());