Centralize backwards compatibility code in wxFont
Add wxFontBase::AccountForCompatValues() and use it in all ports instead of redoing the same comparison with wxDEFAULT in all of them. This is done not so much to avoid the code duplication, which was minimal anyhow, but to make the code more clear and make it easier to remove it from all ports at once in the bright (but remote) future when we don't need these compatibility hacks any more. Also document that wxDEFAULT and wxNORMAL are only handled specially in the old-style ctor taking the individual font components and not the new one using wxFontInfo and extend the unit test to check this.
This commit is contained in:
parent
b84db46feb
commit
08e5acedcc
10 changed files with 54 additions and 42 deletions
|
|
@ -143,6 +143,11 @@ TEST_CASE("wxFont::Size", "[font][size]")
|
|||
", expected = " << size.expected);
|
||||
CHECK( font.GetPointSize() == expected );
|
||||
}
|
||||
|
||||
// Note that the compatibility hacks only apply to the old ctors, the newer
|
||||
// one, taking wxFontInfo, doesn't support them.
|
||||
CHECK( wxFont(wxFontInfo(70)).GetPointSize() == 70 );
|
||||
CHECK( wxFont(wxFontInfo(90)).GetPointSize() == 90 );
|
||||
}
|
||||
|
||||
TEST_CASE("wxFont::Style", "[font][style]")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue