Test if wxString::Format() works with non-ASCII format string.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72374 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2012-08-25 11:14:17 +00:00
parent ebefc86eae
commit bb0907b743

View File

@ -35,6 +35,7 @@ private:
CPPUNIT_TEST( String ); CPPUNIT_TEST( String );
CPPUNIT_TEST( PChar ); CPPUNIT_TEST( PChar );
CPPUNIT_TEST( Format ); CPPUNIT_TEST( Format );
CPPUNIT_TEST( FormatUnicode );
CPPUNIT_TEST( Constructors ); CPPUNIT_TEST( Constructors );
CPPUNIT_TEST( StaticConstructors ); CPPUNIT_TEST( StaticConstructors );
CPPUNIT_TEST( Extraction ); CPPUNIT_TEST( Extraction );
@ -68,6 +69,7 @@ private:
void String(); void String();
void PChar(); void PChar();
void Format(); void Format();
void FormatUnicode();
void Constructors(); void Constructors();
void StaticConstructors(); void StaticConstructors();
void Extraction(); void Extraction();
@ -174,6 +176,20 @@ void StringTestCase::Format()
); );
} }
void StringTestCase::FormatUnicode()
{
#if wxUSE_UNICODE
const char *UNICODE_STR = "Iestat\xC4\xAB %i%i";
//const char *UNICODE_STR = "Iestat\xCC\x84 %i%i";
wxString fmt = wxString::FromUTF8(UNICODE_STR);
wxString s = wxString::Format(fmt, 1, 1);
wxString expected(fmt);
expected.Replace("%i", "1");
CPPUNIT_ASSERT_EQUAL( expected, s );
#endif // wxUSE_UNICODE
}
void StringTestCase::Constructors() void StringTestCase::Constructors()
{ {
CPPUNIT_ASSERT_EQUAL( "", wxString('Z', 0) ); CPPUNIT_ASSERT_EQUAL( "", wxString('Z', 0) );