From ff3cb34d184aff243f6a4b266332c19451ce030e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 21 Aug 2020 18:05:56 +0200 Subject: [PATCH] Add a unit test for using bitmaps with image and empty label This used to be broken, see #18898, and now that it is fixed by 5a70051c7e (Avoid assertion failure in wxButton with bitmap and empty label, see #18898, 2020-08-21) add a unit test so that it stays fixed. --- tests/controls/buttontest.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/controls/buttontest.cpp b/tests/controls/buttontest.cpp index ffc4480f8c..0abac1cc05 100644 --- a/tests/controls/buttontest.cpp +++ b/tests/controls/buttontest.cpp @@ -176,12 +176,17 @@ void ButtonTestCase::Bitmap() //We start with no bitmaps CPPUNIT_ASSERT(!m_button->GetBitmap().IsOk()); + // Some bitmap, doesn't really matter which. + const wxBitmap bmp = wxArtProvider::GetBitmap(wxART_INFORMATION); - m_button->SetBitmap(wxArtProvider::GetIcon(wxART_INFORMATION, - wxART_OTHER, - wxSize(32, 32))); + m_button->SetBitmap(bmp); CPPUNIT_ASSERT(m_button->GetBitmap().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()); + CHECK_NOTHROW( m_button->Disable() ); } #endif //wxUSE_BUTTON