Use theme-appropriate default colour in wxFontPickerCtrl

Don't hardcode black as the default font colour, as this can be
unreadable in dark mode.

Also update the unit test to not always expect the initial colour to be
black.
This commit is contained in:
Vadim Zeitlin 2022-12-23 01:33:04 +00:00
parent 0658dd7d15
commit 78839714a5
2 changed files with 6 additions and 3 deletions

View file

@ -22,6 +22,10 @@
#if wxUSE_FONTPICKERCTRL
#ifndef WX_PRECOMP
#include "wx/settings.h"
#endif // WX_PRECOMP
#include "wx/fontpicker.h"
#include "wx/fontdlg.h"
@ -68,7 +72,7 @@ bool wxGenericFontButton::Create( wxWindow *parent, wxWindowID id,
void wxGenericFontButton::InitFontData()
{
m_data.SetAllowSymbols(true);
m_data.SetColour(*wxBLACK);
m_data.SetColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
m_data.EnableEffects(true);
}

View file

@ -208,8 +208,7 @@ void FontPickerCtrlTestCase::ColourSelection()
{
wxColour selectedColour(0xFF4269UL);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Default font picker color must be black",
m_font->GetSelectedColour(), wxColour(*wxBLACK));
CHECK( m_font->GetSelectedColour() != selectedColour );
m_font->SetSelectedColour(selectedColour);