CPPUNIT_ASSERT_EQUAL( L"Hello", wxString(L"Hello", 5) );
#endif // wxUSE_UNICODE
+ CPPUNIT_ASSERT_EQUAL( 0, wxString(wxString(), 17).length() );
+
+#if wxUSE_UNICODE_UTF8
+ // This string has 3 characters (<h>, <e'> and <l>), 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!";
const char *start = wxStrchr(s, 'r');
const char *end = wxStrchr(s, '!');
CPPUNIT_ASSERT_EQUAL( "Hello", wxString::FromUTF8("Hello", 5) );
CPPUNIT_ASSERT_EQUAL( "Hello", wxString::FromUTF8("Hello") );
+ CPPUNIT_ASSERT_EQUAL( 2, wxString::FromUTF8("h\xc3\xa9llo", 3).length() );
+
+
//CPPUNIT_ASSERT_EQUAL( 1, wxString::FromUTF8("", 1).length() );
}