]>
git.saurik.com Git - wxWidgets.git/blob - tests/fontmap/fontmaptest.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 // ----------------------------------------------------------------------------
26 #include "wx/fontmap.h"
28 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
32 class FontMapperTestCase
: public CppUnit::TestCase
35 FontMapperTestCase() { }
38 CPPUNIT_TEST_SUITE( FontMapperTestCase
);
39 CPPUNIT_TEST( NamesAndDesc
);
40 CPPUNIT_TEST_SUITE_END();
44 DECLARE_NO_COPY_CLASS(FontMapperTestCase
)
47 // register in the unnamed registry so that these tests are run by default
48 CPPUNIT_TEST_SUITE_REGISTRATION( FontMapperTestCase
);
50 // also include in it's own registry so that these tests can be run alone
51 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FontMapperTestCase
, "FontMapperTestCase" );
54 void FontMapperTestCase::NamesAndDesc()
56 static const wxChar
*charsets
[] =
58 // some valid charsets
67 // and now some bogus ones
74 static const wxChar
*names
[] =
76 // some valid charsets
85 // and now some bogus ones
92 static const wxChar
*descriptions
[] =
95 _T("Default encoding" ),
96 _T("Western European (ISO-8859-1)" ),
97 _T("Indian (ISO-8859-12)" ),
99 _T("Unicode 7 bit (UTF-7)" ),
100 _T("Windows Central European (CP 1250)"),
101 _T("Windows Western European (CP 1252)"),
103 // and now some bogus ones
104 _T("Default encoding" ),
105 _T("Unknown encoding (-1)" ),
106 _T("Unknown encoding (-1)" ),
107 _T("Unknown encoding (-1)" ),
110 for ( size_t n
= 0; n
< WXSIZEOF(charsets
); n
++ )
112 wxFontEncoding enc
= wxFontMapper::Get()->CharsetToEncoding(charsets
[n
]);
113 CPPUNIT_ASSERT( wxFontMapper::Get()->GetEncodingName(enc
) == names
[n
] );
114 CPPUNIT_ASSERT( wxFontMapper::Get()->GetEncodingDescription(enc
) == descriptions
[n
] );
118 #endif // wxUSE_FONTMAP