]> git.saurik.com Git - wxWidgets.git/commitdiff
made DoTestConversion() work with strings containing NULs
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 1 Apr 2006 03:24:23 +0000 (03:24 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 1 Apr 2006 03:24:23 +0000 (03:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38496 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/strings/unicode.cpp

index 6e74b1e3feac312e1d371efffa7f1f06f2a56f80..0fd5b67670ac8f5a1bcef27d801c1ece5c038343 100644 (file)
@@ -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);