From: Vadim Zeitlin Date: Sat, 1 Apr 2006 03:24:23 +0000 (+0000) Subject: made DoTestConversion() work with strings containing NULs X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7e0a8463ebe347333fa27d70fe8910a5b7e8b8e1?hp=6901ac371fdedbd206ba0eee5f5d3e47ffbf9663 made DoTestConversion() work with strings containing NULs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38496 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/tests/strings/unicode.cpp b/tests/strings/unicode.cpp index 6e74b1e3fe..0fd5b67670 100644 --- a/tests/strings/unicode.cpp +++ b/tests/strings/unicode.cpp @@ -175,19 +175,19 @@ UnicodeTestCase::DoTestConversion(const char *s, #if wxUSE_UNICODE if ( ws ) { - wxCharBuffer buf(wxString(ws).mb_str(conv)); + wxCharBuffer buf = conv.cWC2MB(ws, (size_t)-1, NULL); CPPUNIT_ASSERT( strcmp(buf, s) == 0 ); } #else // wxUSE_UNICODE if ( s ) { - wxWCharBuffer wbuf(wxString(s).wc_str(conv)); + wxWCharBuffer wbuf = conv.cMB2WC(s, (size_t)-1, NULL); if ( ws ) CPPUNIT_ASSERT( wx_wcscmp(wbuf, ws) == 0 ); else - CPPUNIT_ASSERT_EQUAL( L'\0', *wbuf ); + CPPUNIT_ASSERT_EQUAL( (wchar_t *)NULL, wbuf.data() ); } #endif // wxUSE_UNICODE/!wxUSE_UNICODE } @@ -248,10 +248,10 @@ void UnicodeTestCase::ConversionUTF16() static const StringConversionData utf16data[] = { #ifdef wxHAVE_U_ESCAPE - { "\x04\x1f\x04\x40\x04\x38\x04\x32\x04\x35\x04\x42", + { "\x04\x1f\x04\x40\x04\x38\x04\x32\x04\x35\x04\x42\0\0", L"\u041f\u0440\u0438\u0432\u0435\u0442" }, #endif - { "\0f\0o\0o", L"foo" }, + { "\0f\0o\0o\0\0", L"foo" }, }; wxCSConv conv(wxFONTENCODING_UTF16BE);