From b84db46feb224a7a169bff394e8eb01810f6dbd3 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::GetStyle() and special style values Similarly to the previous commit, verify that wxNORMAL, wxITALIC and wxSLANT still work for compatibility (note the latter is synonymous with wxITALIC under MSW). --- tests/font/fonttest.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/font/fonttest.cpp b/tests/font/fonttest.cpp index be261dc17b..620041b3d7 100644 --- a/tests/font/fonttest.cpp +++ b/tests/font/fonttest.cpp @@ -145,6 +145,39 @@ TEST_CASE("wxFont::Size", "[font][size]") } } +TEST_CASE("wxFont::Style", "[font][style]") +{ +#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.GetStyle() == wxFONTSTYLE_NORMAL ); + + wxFont fontItalic(10, wxDEFAULT, wxITALIC, wxNORMAL); + CHECK( fontItalic.GetStyle() == wxFONTSTYLE_ITALIC ); + + wxFont fontSlant(10, wxDEFAULT, wxSLANT, wxNORMAL); +#ifdef __WXMSW__ + CHECK( fontSlant.GetStyle() == wxFONTSTYLE_ITALIC ); +#else + CHECK( fontSlant.GetStyle() == wxFONTSTYLE_SLANT ); +#endif + + wxGCC_WARNING_RESTORE(deprecated-declarations) + + #ifdef __VISUALC__ + #pragma warning(pop) + #endif +#endif // WXWIN_COMPATIBILITY_3_0 +} + TEST_CASE("wxFont::Weight", "[font][weight]") { #if WXWIN_COMPATIBILITY_3_0