From 5bf920775a6a159c0d434c028be987bf3fe8021e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 6 Sep 2018 01:34:25 +0200 Subject: [PATCH] Add unit test for wxFont::GetWeight() and special weight values Verify that using wxNORMAL, wxBOLD and wxLIGHT still works, as they must do for compatibility reasons. --- tests/font/fonttest.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/font/fonttest.cpp b/tests/font/fonttest.cpp index aa32346912..be261dc17b 100644 --- a/tests/font/fonttest.cpp +++ b/tests/font/fonttest.cpp @@ -145,6 +145,35 @@ TEST_CASE("wxFont::Size", "[font][size]") } } +TEST_CASE("wxFont::Weight", "[font][weight]") +{ +#if WXWIN_COMPATIBILITY_3_0 + // Disable the warning about deprecated wxNORMAL as we use it here + // intentionally. + #ifdef __VISUALC__ + #pragma warning(push) + #pragma warning(disable:4996) + #endif + + wxGCC_WARNING_SUPPRESS(deprecated-declarations) + + wxFont fontNormal(10, wxDEFAULT, wxNORMAL, wxNORMAL); + CHECK( fontNormal.GetWeight() == wxFONTWEIGHT_NORMAL ); + + wxFont fontBold(10, wxDEFAULT, wxNORMAL, wxBOLD); + CHECK( fontBold.GetWeight() == wxFONTWEIGHT_BOLD ); + + wxFont fontLight(10, wxDEFAULT, wxNORMAL, wxLIGHT); + CHECK( fontLight.GetWeight() == wxFONTWEIGHT_LIGHT ); + + wxGCC_WARNING_RESTORE(deprecated-declarations) + + #ifdef __VISUALC__ + #pragma warning(pop) + #endif +#endif // WXWIN_COMPATIBILITY_3_0 +} + TEST_CASE("wxFont::GetSet", "[font][getters]") { unsigned numFonts;