+ }
+
+ // test that clearly invalid font info strings do not work
+ wxFont font;
+ CPPUNIT_ASSERT( !font.SetNativeFontInfo("") );
+
+ // pango_font_description_from_string() used by wxFont in wxGTK and wxX11
+ // never returns an error at all so this assertion fails there -- and as it
+ // doesn't seem to be possible to do anything about it maybe we should
+ // change wxMSW and other ports to also accept any strings?
+#if !defined(__WXGTK__) && !defined(__WXX11__)
+ CPPUNIT_ASSERT( !font.SetNativeFontInfo("bloordyblop") );
+#endif
+
+ // Pango font description doesn't have 'underlined' and 'strikethrough'
+ // attributes, so wxNativeFontInfo implements these itself. Test if these
+ // are properly preserved by wxNativeFontInfo or its string description.
+ font.SetUnderlined(true);
+ font.SetStrikethrough(true);
+ CPPUNIT_ASSERT_EQUAL(font, wxFont(font));
+ CPPUNIT_ASSERT_EQUAL(font, wxFont(*font.GetNativeFontInfo()));
+ CPPUNIT_ASSERT_EQUAL(font, wxFont(font.GetNativeFontInfoDesc()));
+ font.SetUnderlined(false);
+ CPPUNIT_ASSERT_EQUAL(font, wxFont(font));
+ CPPUNIT_ASSERT_EQUAL(font, wxFont(*font.GetNativeFontInfo()));
+ CPPUNIT_ASSERT_EQUAL(font, wxFont(font.GetNativeFontInfoDesc()));
+ font.SetUnderlined(true);
+ font.SetStrikethrough(false);
+ CPPUNIT_ASSERT_EQUAL(font, wxFont(font));
+ CPPUNIT_ASSERT_EQUAL(font, wxFont(*font.GetNativeFontInfo()));
+ CPPUNIT_ASSERT_EQUAL(font, wxFont(font.GetNativeFontInfoDesc()));
+ // note: the GetNativeFontInfoUserDesc() doesn't preserve all attributes
+ // according to docs, so it is not tested.
+}
+
+void FontTestCase::NativeFontInfoUserDesc()
+{
+ unsigned numFonts;
+ const wxFont *pf = GetTestFonts(numFonts);
+ for ( size_t n = 0; n < numFonts; n++ )
+ {
+ wxFont test(*pf++);