From: Vadim Zeitlin Date: Wed, 9 May 2012 14:24:10 +0000 (+0000) Subject: Fix wxString unit test when not using UTF-8. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/39d169639b01d4902583d4e541746a93a156ab78?ds=inline Fix wxString unit test when not using UTF-8. Restrict the tests added in r70987 to run when using UTF-8 strings only, they test for something that is simply not true (and for a bug that can't happen) with non-multibyte encodings. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71384 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/tests/strings/strings.cpp b/tests/strings/strings.cpp index 13904976ac..98e6619a80 100644 --- a/tests/strings/strings.cpp +++ b/tests/strings/strings.cpp @@ -192,10 +192,16 @@ void StringTestCase::Constructors() CPPUNIT_ASSERT_EQUAL( 0, wxString(wxString(), 17).length() ); - // This string has 3 characters (, and ), not 4! - wxString s3("h\xc3\xa9llo", 4); - CPPUNIT_ASSERT_EQUAL( 3, s3.length() ); - CPPUNIT_ASSERT_EQUAL( 'l', (char)s3[2] ); +#if wxUSE_UNICODE_UTF8 + // This string has 3 characters (, and ), not 4 when using UTF-8 + // locale! + if ( wxConvLibc.IsUTF8() ) + { + wxString s3("h\xc3\xa9llo", 4); + CPPUNIT_ASSERT_EQUAL( 3, s3.length() ); + CPPUNIT_ASSERT_EQUAL( 'l', (char)s3[2] ); + } +#endif // wxUSE_UNICODE_UTF8 static const char *s = "?really!";