]>
git.saurik.com Git - wxWidgets.git/blob - tests/fontmap/fontmap.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/fontmap/fontmap.cpp
3 // Purpose: wxFontMapper unit test
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2003 TT-Solutions
8 ///////////////////////////////////////////////////////////////////////////////
10 // ----------------------------------------------------------------------------
12 // ----------------------------------------------------------------------------
14 #include "wx/wxprec.h"
26 #include "wx/fontmap.h"
28 #include "wx/cppunit.h"
30 // ----------------------------------------------------------------------------
32 // ----------------------------------------------------------------------------
34 class FontMapperTestCase
: public CppUnit::TestCase
37 FontMapperTestCase() { }
40 CPPUNIT_TEST_SUITE( FontMapperTestCase
);
41 CPPUNIT_TEST( NamesAndDesc
);
42 CPPUNIT_TEST_SUITE_END();
46 DECLARE_NO_COPY_CLASS(FontMapperTestCase
)
49 // register in the unnamed registry so that these tests are run by default
50 CPPUNIT_TEST_SUITE_REGISTRATION( FontMapperTestCase
);
52 // also include in it's own registry so that these tests can be run alone
53 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FontMapperTestCase
, "FontMapperTestCase" );
56 void FontMapperTestCase::NamesAndDesc()
58 static const wxChar
*charsets
[] =
60 // some valid charsets
69 // and now some bogus ones
76 static const wxChar
*names
[] =
78 // some valid charsets
87 // and now some bogus ones
94 static const wxChar
*descriptions
[] =
97 _T("Default encoding" ),
98 _T("Western European (ISO-8859-1)" ),
99 _T("Indian (ISO-8859-12)" ),
101 _T("Unicode 7 bit (UTF-7)" ),
102 _T("Windows Central European (CP 1250)"),
103 _T("Windows Western European (CP 1252)"),
105 // and now some bogus ones
106 _T("Default encoding" ),
107 _T("Unknown encoding (-1)" ),
108 _T("Unknown encoding (-1)" ),
109 _T("Unknown encoding (-1)" ),
112 for ( size_t n
= 0; n
< WXSIZEOF(charsets
); n
++ )
114 wxFontEncoding enc
= wxFontMapper::Get()->CharsetToEncoding(charsets
[n
]);
115 CPPUNIT_ASSERT( wxFontMapper::Get()->GetEncodingName(enc
) == names
[n
] );
116 CPPUNIT_ASSERT( wxFontMapper::Get()->GetEncodingDescription(enc
) == descriptions
[n
] );
120 #endif // wxUSE_FONTMAP