From: Václav Slavík Date: Sat, 25 Aug 2012 11:14:17 +0000 (+0000) Subject: Test if wxString::Format() works with non-ASCII format string. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/bb0907b7437af9e4aed9f8f3f9bee0e334743d7e 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 --- diff --git a/tests/strings/strings.cpp b/tests/strings/strings.cpp index 98e6619a80..e1d7262bb9 100644 --- a/tests/strings/strings.cpp +++ b/tests/strings/strings.cpp @@ -35,6 +35,7 @@ private: CPPUNIT_TEST( String ); CPPUNIT_TEST( PChar ); CPPUNIT_TEST( Format ); + CPPUNIT_TEST( FormatUnicode ); CPPUNIT_TEST( Constructors ); CPPUNIT_TEST( StaticConstructors ); CPPUNIT_TEST( Extraction ); @@ -68,6 +69,7 @@ private: void String(); void PChar(); void Format(); + void FormatUnicode(); void Constructors(); void StaticConstructors(); 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() { CPPUNIT_ASSERT_EQUAL( "", wxString('Z', 0) );